summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-07-02 14:36:58 -0400
committerPeter Jones <pjones@redhat.com>2021-07-20 09:44:25 -0400
commit3ea1f37c70c571537c92e2be0d78a1ad4629af8f (patch)
tree63255639942722e08420c1209d65828ffabd39e5 /include
parent9e4f38abe61b600826360c14729cc54ea3ec7c3c (diff)
downloadefi-boot-shim-3ea1f37c70c571537c92e2be0d78a1ad4629af8f.tar.gz
efi-boot-shim-3ea1f37c70c571537c92e2be0d78a1ad4629af8f.zip
Add a tester for parse_load_options()
This adds tests for all the cases we've documented in the set_second_stage() comments. Each test checks that all of second_stage, loader_str, and loader_str_size are set correctly. Note that this adds a dependency on libefivar to build device paths to test against. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/test.mk16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/test.mk b/include/test.mk
index 23bf805c..68230b20 100644
--- a/include/test.mk
+++ b/include/test.mk
@@ -10,7 +10,8 @@ include Make.defaults
CC = gcc
VALGRIND ?=
DEBUG_PRINTS ?= 0
-CFLAGS = -O2 -ggdb -std=gnu11 \
+OPTIMIZATIONS=-O2 -ggdb
+CFLAGS = $(OPTIMIZATIONS) -std=gnu11 \
-isystem $(TOPDIR)/include/system \
$(EFI_INCLUDES) \
-Iinclude -iquote . \
@@ -50,13 +51,19 @@ libefi-test.a :
-f $(TOPDIR)/gnu-efi/Makefile \
clean
+test-random.h:
+ dd if=/dev/urandom bs=512 count=17 of=random.bin
+ xxd -i random.bin test-random.h
+
$(wildcard test-*.c) :: %.c : test-random.h
$(patsubst %.c,%,$(wildcard test-*.c)) :: | test-random.h
$(patsubst %.c,%.o,$(wildcard test-*.c)) : | test-random.h
-test-random.h:
- dd if=/dev/urandom bs=512 count=17 of=random.bin
- xxd -i random.bin test-random.h
+test-load-options_FILES = lib/guid.c \
+ libefi-test.a \
+ -lefivar
+test-load-options :: libefi-test.a
+test-load-options : CFLAGS+=-DHAVE_SHIM_LOCK_GUID
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
@@ -66,6 +73,7 @@ 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) libefi-test.a
$(VALGRIND) ./$@