From 1e14de8bda93fda4c0ace8b6421d67e8605758bb Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 10 Jun 2020 15:35:08 -0700 Subject: tests: Add some basic warnings and fix resulting issues The current test framework builds the test code without any warnings at all, which isn't great -- we have already slipped in some cases of non-void functions not returning a defined value, for example. It would likely be overkill to try to use all the same warnings we use for normal coreboot code (e.g. some stuff like -Wmissing-prototypes makes cmocka's __wrap_xxx() mock functions unnecessarily cumbersome to work with, and other things like -Wvla may be appropriate for firmware but is probably too aggressive for some simple test code). Therefore, let's just add some of the stuff that points out the most obvious errors. Signed-off-by: Julius Werner Change-Id: I4d9801f52a8551f55f419f4141dc21ccb835d676 Reviewed-on: https://review.coreboot.org/c/coreboot/+/42259 Tested-by: build bot (Jenkins) Reviewed-by: Jan Dabros Reviewed-by: Paul Fagerburg --- tests/Makefile.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/Makefile.inc') diff --git a/tests/Makefile.inc b/tests/Makefile.inc index bfd18060ab..53c0edf2a5 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -25,7 +25,14 @@ TEST_CFLAGS = -include $(src)/include/kconfig.h \ TEST_CFLAGS += -I$(testsrc)/include/mocks -I$(testsrc)/include TEST_CFLAGS += -I$(src)/include -I$(src)/commonlib/include \ - -I$(src)/commonlib/bsd/include -I$(src)/arch/x86/include \ + -I$(src)/commonlib/bsd/include -I$(src)/arch/x86/include + +# Note: This is intentionally just a subset of the warnings in the toplevel +# Makefile.inc. We don't need to be as strict with test code, and things like +# -Wmissing-prototypes just make working with the test framework cumbersome. +# Only put conservative warnings here that really detect code that's obviously +# unintentional. +TEST_CFLAGS += -Wall -Werror -Wundef -Wstrict-prototypes # Path for Kconfig autoheader TEST_CFLAGS += -I$(dir $(TEST_KCONFIG_AUTOHEADER)) -- cgit v1.2.3