From f2196f6f173cf893236c951f193909081a9f1d26 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 22 Jan 2025 16:33:11 -0500 Subject: [PATCH] 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 --- include/test.mk | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/test.mk b/include/test.mk index e6d46594e..ee2d2fded 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