Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/51803 )
Change subject: include/rules.h: Add ENV_TEST definition ......................................................................
include/rules.h: Add ENV_TEST definition
Some functions/macros like assert() require redefinition for testing purposes. ENV_TEST is introduced to make it possible without using bypass hacks. This patch also adds a global __TEST__ define to TEST_CFLAGS for all test targets in order to enable ENV_TEST.
Signed-off-by: Jakub Czapiga jacz@semihalf.com Change-Id: Ib8f2932902a73a7dbe181adc82cc18437abb48e8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/51803 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Paul Fagerburg pfagerburg@chromium.org Reviewed-by: Julius Werner jwerner@chromium.org --- M src/include/rules.h M tests/Makefile.inc 2 files changed, 8 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Paul Fagerburg: Looks good to me, approved
diff --git a/src/include/rules.h b/src/include/rules.h index 6ebb37e..ec3d22d 100644 --- a/src/include/rules.h +++ b/src/include/rules.h @@ -3,6 +3,12 @@ #ifndef _RULES_H #define _RULES_H
+#if defined(__TEST__) +#define ENV_TEST 1 +#else +#define ENV_TEST 0 +#endif + #if defined(__TIMELESS__) #define ENV_TIMELESS 1 #else diff --git a/tests/Makefile.inc b/tests/Makefile.inc index ca974a9..027091c 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -39,6 +39,8 @@
TEST_CFLAGS += -std=gnu11 -Os -ffunction-sections -fdata-sections -fno-builtin
+TEST_CFLAGS += -D__TEST__ + # Checkout Cmocka repository forgetthis:=$(shell git submodule update --init --checkout 3rdparty/cmocka)