summaryrefslogtreecommitdiffstats
path: root/tests/device
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-05-04 17:44:04 -0700
committerJulius Werner <jwerner@chromium.org>2020-05-19 03:21:44 +0000
commit21744811bb7638830a7ca495694d295acbadc150 (patch)
treea867e9b86d35c942a4154ca185a3c8c72aa2536c /tests/device
parented03371e76239dae16b6397efef4814f8c30451e (diff)
downloadcoreboot-21744811bb7638830a7ca495694d295acbadc150.tar.gz
coreboot-21744811bb7638830a7ca495694d295acbadc150.tar.bz2
coreboot-21744811bb7638830a7ca495694d295acbadc150.zip
tests: Add <tests/test.h> wrapper header and fix --gc-sections
<cmocka.h> requires a few standard headers to be explicitly included before itself or it will throw compilation errors. Having to always include these headers in the right order in every test is cumbersome. Instead, this patch encapsulates the problem in a new <tests/test.h> header that all tests should include (instead of <cmocka.h> directly). Also fix --gc-sections in the test framework which needs to be passed for linking, not for compiling. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I4284d74c8673708e21a5266eb42f7b9ae19a1b12 Reviewed-on: https://review.coreboot.org/c/coreboot/+/41045 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jan Dabros Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'tests/device')
-rw-r--r--tests/device/i2c-test.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/device/i2c-test.c b/tests/device/i2c-test.c
index 930345626152..acf7b0741dfe 100644
--- a/tests/device/i2c-test.c
+++ b/tests/device/i2c-test.c
@@ -1,12 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <limits.h>
-#include <cmocka.h>
-
#include <device/i2c_simple.h>
+#include <limits.h>
+#include <tests/test.h>
/* Simulate two i2c devices, both on bus 0, each with three uint8_t regs
implemented. */