From 615e701d53383a67131e9082d1c7329b69aa9f5d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 23 Feb 2021 15:01:38 -0500 Subject: Add test cases for our CSV parser. This does a couple of straightforward tests on our CSV parser, and then for good measure it does two with random data - one that's just random data, one that's had all the zeros changed to nonzero values. Note that building and running this test does not quite work yet /on this branch/. In order to do that, we need some cleanups and reorganizing that I don't want to push just yet, which can be found on https://github.com/rhboot/shim/tree/test-reorg Signed-off-by: Peter Jones --- include/test.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/test.mk') diff --git a/include/test.mk b/include/test.mk index f70fdaa9..8cdcc332 100644 --- a/include/test.mk +++ b/include/test.mk @@ -28,6 +28,12 @@ CFLAGS = -O2 -ggdb -std=gnu11 \ -DSHIM_UNIT_TEST \ "-DDEFAULT_DEBUG_PRINT_STATE=$(DEBUG_PRINTS)" +$(wildcard test-*.c) :: %.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 + tests := $(patsubst %.c,%,$(wildcard test-*.c)) $(tests) :: test-% : test.c test-%.c $(test-%_FILES) @@ -36,10 +42,12 @@ $(tests) :: test-% : test.c test-%.c $(test-%_FILES) test : $(tests) -all : test - clean : + @rm -vf test-random.h random.bin + +all : clean test .PHONY: $(tests) all test clean +.SECONDARY: random.bin # vim:ft=make -- cgit v1.2.3