From 21744811bb7638830a7ca495694d295acbadc150 Mon Sep 17 00:00:00 2001
From: Julius Werner <jwerner@chromium.org>
Date: Mon, 4 May 2020 17:44:04 -0700
Subject: 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>
---
 tests/lib/string-test.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

(limited to 'tests/lib/string-test.c')

diff --git a/tests/lib/string-test.c b/tests/lib/string-test.c
index 513b395283..08f4177ef6 100644
--- a/tests/lib/string-test.c
+++ b/tests/lib/string-test.c
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
 #include <string.h>
+#include <tests/test.h>
 
 /*
  * Important note: In every particular test, don't use any string-related
-- 
cgit v1.2.3