summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2022-09-27 18:30:55 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-11-03 12:55:29 +0000
commit96edc100c047e76c5baba816ffa26f3698c330e2 (patch)
treea17ae6f38dd05198c82571cbda8fefe87c1ea957
parent2494e9361da0280ee1fac18b4e8ec540e1607b70 (diff)
tests: Add option for debug symbols & no optimization
To make it easier to build the tests with debug symbols, add a check for the "GDB_DEBUG" environment variable. If set, build with -g and -Og to enable the symbols and disable optimization. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I3a644dcccb7e15473413b775da8f70617afaefce Reviewed-on: https://review.coreboot.org/c/coreboot/+/67918 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
-rw-r--r--tests/Makefile.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/Makefile.inc b/tests/Makefile.inc
index 2c1a30bb8d..90f01d159a 100644
--- a/tests/Makefile.inc
+++ b/tests/Makefile.inc
@@ -10,7 +10,13 @@ endif
include $(top)/tests/Makefile.common
-# Enable code coverage if COV=1
+# Enable GDB debug build if requested
+GDB_DEBUG ?= 0
+ifneq ($(GDB_DEBUG),0)
+TEST_CFLAGS += -g -Og
+endif
+
+# Enable code coverage if requested
ifeq ($(COV),1)
TEST_CFLAGS += --coverage
TEST_LDFLAGS += --coverage
@@ -175,6 +181,7 @@ list-unit-tests:
help-unit-tests help::
@echo '*** coreboot unit-tests targets ***'
@echo ' Use "COV=1 make [target]" to enable code coverage for unit tests'
+ @echo ' Use "GDB_DEBUG=1 make [target]" to build with debug symbols'
@echo ' unit-tests - Run all unit-tests from tests/'
@echo ' clean-unit-tests - Remove unit-tests build artifacts'
@echo ' list-unit-tests - List all unit-tests'