summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--include/test.mk21
2 files changed, 20 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 07936e52..3b59fc69 100644
--- a/Makefile
+++ b/Makefile
@@ -287,7 +287,7 @@ else
$(PESIGN) -n certdb -i $< -c "shim" -s -o $@ -f
endif
-test test-clean :
+test test-clean test-coverage test-lto :
@make -f $(TOPDIR)/include/test.mk \
COMPILER="$(COMPILER)" \
CROSS_COMPILE="$(CROSS_COMPILE)" \
diff --git a/include/test.mk b/include/test.mk
index 60a7e6fa..86f1a9d8 100644
--- a/include/test.mk
+++ b/include/test.mk
@@ -11,6 +11,8 @@ CC = gcc
VALGRIND ?=
DEBUG_PRINTS ?= 0
OPTIMIZATIONS=-O2 -ggdb
+CFLAGS_LTO =
+CFLAGS_GCOV =
CFLAGS = $(OPTIMIZATIONS) -std=gnu11 \
-isystem $(TOPDIR)/include/system \
$(EFI_INCLUDES) \
@@ -18,8 +20,9 @@ CFLAGS = $(OPTIMIZATIONS) -std=gnu11 \
-isystem /usr/include \
-isystem $(shell $(CC) $(ARCH_CFLAGS) -print-file-name=include) \
$(ARCH_CFLAGS) \
+ $(CFLAGS_LTO) \
+ $(CFLAGS_GCOV) \
-fshort-wchar \
- -flto \
-fno-builtin \
-rdynamic \
-fno-inline \
@@ -43,12 +46,16 @@ CFLAGS = $(OPTIMIZATIONS) -std=gnu11 \
-DSHIM_UNIT_TEST \
"-DDEFAULT_DEBUG_PRINT_STATE=$(DEBUG_PRINTS)"
+export CFLAGS_LTO CFLAGS_GCOV
+
libefi-test.a :
$(MAKE) -C gnu-efi \
COMPILER="$(COMPILER)" \
CC="$(CC)" \
ARCH=$(ARCH_GNUEFI) \
TOPDIR=$(TOPDIR)/gnu-efi \
+ CFLAGS_LTO="$(CFLAGS_LTO)" \
+ CFLAGS_GCOV="$(CFLAGS_GCOV)" \
-f $(TOPDIR)/gnu-efi/Makefile \
clean lib
mv gnu-efi/$(ARCH)/lib/libefi.a $@
@@ -56,6 +63,8 @@ libefi-test.a :
COMPILER="$(COMPILER)" \
ARCH=$(ARCH_GNUEFI) \
TOPDIR=$(TOPDIR)/gnu-efi \
+ CFLAGS_LTO="$(CFLAGS_LTO)" \
+ CFLAGS_GCOV="$(CFLAGS_GCOV)" \
-f $(TOPDIR)/gnu-efi/Makefile \
clean
@@ -86,8 +95,16 @@ $(tests) :: test-% : test.c test-%.c $(test-%_FILES)
test : $(tests)
$(MAKE) -f include/test.mk test-clean
+test-lto : CFLAGS_LTO+=-flto
+test-lto : $(tests)
+ $(MAKE) -f include/test.mk test-clean
+
+test-coverage : CFLAGS_GCOV+=--coverage
+test-coverage : $(tests)
+
test-clean :
- @rm -vf test-random.h random.bin libefi-test.a vgcore.*
+ @rm -vf test-random.h random.bin libefi-test.a
+ @rm -vf *.gcda *.gcno *.gcov vgcore.*
clean : test-clean