diff options
| author | Peter Jones <pjones@redhat.com> | 2021-07-15 10:07:14 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-07-20 09:44:25 -0400 |
| commit | f1ef8dffd374048fbf8dd584923c42e5a784bbf2 (patch) | |
| tree | 35ee16b58ae76044c44ec0aed27b000d5174ff52 /include | |
| parent | b092c85fc3e9caec83728b244a34ed8325a02c6d (diff) | |
| download | efi-boot-shim-f1ef8dffd374048fbf8dd584923c42e5a784bbf2.tar.gz efi-boot-shim-f1ef8dffd374048fbf8dd584923c42e5a784bbf2.zip | |
Make test cases link against libefi.a
This allows us to use library functions from libefi.a in our test
programs.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/test.mk | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/test.mk b/include/test.mk index 62cf983a..c66b46de 100644 --- a/include/test.mk +++ b/include/test.mk @@ -5,6 +5,8 @@ .SUFFIXES: +include Make.defaults + CC = gcc VALGRIND ?= DEBUG_PRINTS ?= 0 @@ -28,6 +30,15 @@ CFLAGS = -O2 -ggdb -std=gnu11 \ -DSHIM_UNIT_TEST \ "-DDEFAULT_DEBUG_PRINT_STATE=$(DEBUG_PRINTS)" +libefi-test.a : + $(MAKE) -C gnu-efi ARCH=$(ARCH_GNUEFI) TOPDIR=$(TOPDIR)/gnu-efi \ + -f $(TOPDIR)/gnu-efi/Makefile \ + clean lib + mv gnu-efi/$(ARCH)/lib/libefi.a $@ + $(MAKE) -C gnu-efi ARCH=$(ARCH_GNUEFI) TOPDIR=$(TOPDIR)/gnu-efi \ + -f $(TOPDIR)/gnu-efi/Makefile \ + clean + $(wildcard test-*.c) :: %.c : test-random.h $(patsubst %.c,%,$(wildcard test-*.c)) :: | test-random.h $(patsubst %.c,%.o,$(wildcard test-*.c)) : | test-random.h @@ -36,19 +47,22 @@ test-random.h: dd if=/dev/urandom bs=512 count=17 of=random.bin xxd -i random.bin test-random.h -test-sbat_FILES = csv.c +test-sbat_FILES = csv.c lib/variables.c lib/guid.c +test-sbat :: CFLAGS+=-DHAVE_GET_VARIABLE -DHAVE_GET_VARIABLE_ATTR -DHAVE_SHIM_LOCK_GUID + test-str_FILES = lib/string.c tests := $(patsubst %.c,%,$(wildcard test-*.c)) +$(tests) :: test-% : | libefi-test.a $(tests) :: test-% : test.c test-%.c $(test-%_FILES) - $(CC) $(CFLAGS) -o $@ $^ $(wildcard $*.c) $(test-$*_FILES) + $(CC) $(CFLAGS) -o $@ $^ $(wildcard $*.c) $(test-$*_FILES) libefi-test.a $(VALGRIND) ./$@ test : $(tests) clean : - @rm -vf test-random.h random.bin + @rm -vf test-random.h random.bin libefi-test.a all : clean test |
