zephyr/subsys/testsuite
Gregory Shue 5623f54a35 fff: Add fff_extensions.h, RETURN_HANDLED_CONTEXT()
Add supplementary header <zephyr/fff_extensions.h>.  Add macro
to fff_extensions.h for simplifying definition of custom fake functions
needing call-unique information for producing desired output data.
When an array of custom fake context structures is defined and
the return field within the first structure instance is registered
with the standard SET_RETURN_SEQ() macro of FFF, the
RETURN_HANDLED_CONTEXT() macro provides the inverse logic to
recover the context structure for this called instance. The body of
the custom fake handler is provided to the RETURN_HANDLED_CONTEXT()
macro for appropriate execution and access to the custom fake
parameters.

A test suite is also provided to verify macro implementation and
illustrate usage. It is at:
zephyr/tests/subsys/testsuite/fff_fake_contexts/

This code was verified by:

1. (Pass) west build -p always \
            -b unit_testing tests/subsys/testsuite/fff_fake_contexts/ && \
         ./build/testbinary
2. (Pass) west build -p always \
            -b native_posix tests/subsys/testsuite/fff_fake_contexts/ && \
         ./build/zephyr/zephyr.exe
3. (Pass) ./scripts/twister -p unit_testing \
            -T tests/subsys/testsuite/fff_fake_contexts/
4. (Pass) ./scripts/twister -p native_posix \
            -T tests/subsys/testsuite/fff_fake_contexts/
5. (Pass) cd doc && build html-fast

Fix #55246

Signed-off-by: Gregory Shue <gregory.shue@legrand.com>
2023-03-16 13:43:33 -04:00
..
arch/unit_testing cmake: kconfig: introduce dedicated unit testing board 2022-08-18 14:29:14 +02:00
boards/unit_testing/unit_testing unittest: add support for coverage 2022-11-28 16:26:02 -05:00
busy_sim devices: constify statically initialized device pointers 2022-08-19 11:51:26 +02:00
coverage testsuite: coverage: fix -Wcast-align warning 2023-01-19 06:51:44 -05:00
include/zephyr fff: Add fff_extensions.h, RETURN_HANDLED_CONTEXT() 2023-03-16 13:43:33 -04:00
soc/unit_testing/unit_testing cmake: kconfig: introduce dedicated unit testing board 2022-08-18 14:29:14 +02:00
ztest ztest: Add initial zexpect API for delayed failing 2023-02-23 20:34:39 +01:00
CMakeLists.txt build: drop LEGACY_INCLUDE_PATH support 2023-02-21 15:06:48 +01:00
Kconfig testsuite: coverage: create kconfig option for gcov dump heap size 2022-11-10 08:48:06 -05:00
Kconfig.defconfig testsuite: ztress: Use XOSHIRO generator when ztress is used 2022-09-08 05:43:17 -04:00