summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2025-01-22 16:33:11 -0500
committerPeter Jones <pjones@redhat.com>2025-02-03 19:00:39 -0500
commite42c31963a5a1ed2edf8a40df81ccfe697c32981 (patch)
tree1173e7838a3cb5da801a915bfeca761577072d85
parent98173f05b67e9de1e4ea4291b26d982b62fe56aa (diff)
downloadefi-boot-shim-e42c31963a5a1ed2edf8a40df81ccfe697c32981.tar.gz
efi-boot-shim-e42c31963a5a1ed2edf8a40df81ccfe697c32981.zip
test.mk: don't use a temporary random.bin
Sometimes using a temp file to make test-random.h breaks builds because clean and test get made in parallel. Since debugging parallel make is anything but easy, it's better to just not use the intermediate file. This patch makes it use a pipe instead. Because we live in the worst possible world, we have to support RHEL 9, in which xxd does not support "-n prefix", and so we have to build the header variable definition lines in shell. Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--include/test.mk11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/test.mk b/include/test.mk
index e6d46594..ee2d2fde 100644
--- a/include/test.mk
+++ b/include/test.mk
@@ -76,8 +76,12 @@ libefi-test.a :
clean
test-random.h:
- dd if=/dev/urandom bs=512 count=17 of=random.bin
- xxd -i random.bin test-random.h
+ dd if=/dev/urandom bs=512 count=17 status=none | ( \
+ echo "unsigned char random_bin[] = {" ; \
+ xxd -i - ; \
+ echo "};" ; \
+ echo "unsigned int random_bin_len = 8704;" ; \
+ ) > test-random.h
$(wildcard test-*.c) :: %.c : test-random.h
$(patsubst %.c,%,$(wildcard test-*.c)) :: | test-random.h
@@ -119,7 +123,7 @@ test-coverage : CFLAGS_GCOV+=--coverage
test-coverage : $(tests)
test-clean :
- @rm -vf test-random.h random.bin libefi-test.a
+ @rm -vf test-random.h libefi-test.a
@rm -vf *.gcda *.gcno *.gcov vgcore.*
clean : test-clean
@@ -127,6 +131,5 @@ clean : test-clean
all : test-clean test
.PHONY: $(tests) all test clean
-.SECONDARY: random.bin
# vim:ft=make