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>
This commit is contained in:
Martin Roth 2022-09-27 18:30:55 -06:00 committed by Felix Held
parent 2494e9361d
commit 96edc100c0
1 changed files with 8 additions and 1 deletions

View File

@ -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'