Re: [PATCH 1/3] selftests/bpf: Route generated test headers to OUTPUT

From: Ihor Solodrai

Date: Thu Aug 06 2026 - 16:33:47 EST


On 7/28/26 5:06 PM, Ricardo B. Marlière (SUSE) wrote:
> [...]
>
> @@ -923,14 +923,14 @@ $(eval $(call DEFINE_TEST_RUNNER,test_maps))
> # It is much simpler than test_maps/test_progs and sufficiently different from
> # them (e.g., test.h is using completely pattern), that it's worth just
> # explicitly defining all the rules explicitly.
> -verifier/tests.h: verifier/*.c
> - $(shell ( cd verifier/; \
> +$(OUTPUT)/verifier/tests.h: verifier/*.c | $(OUTPUT)
> + $(shell mkdir -p $(OUTPUT)/verifier && ( \
> echo '/* Generated header, do not edit */'; \
> echo '#ifdef FILL_ARRAY'; \
> - ls *.c 2> /dev/null | sed -e 's@\(.*\)@#include \"\1\"@'; \
> + ls verifier/*.c 2> /dev/null | sed -e 's@\(.*\)@#include "$(CURDIR)/\1"@'; \

This can break if $(CURDIR) contains '@'.

In such case sed fails, but make returns success and generates
verifier/tests.h with zero #include lines. And this would silently
skip all the tests.

Also at line 1046:

EXTRA_CLEAN := $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \
prog_tests/tests.h map_tests/tests.h verifier/tests.h \

These are the old source-tree locations. Should be updated?

> echo '#endif' \
> - ) > verifier/tests.h)
> -$(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT)
> + ) > $(OUTPUT)/verifier/tests.h)
> +$(OUTPUT)/test_verifier: test_verifier.c $(OUTPUT)/verifier/tests.h $(BPFOBJ) | $(OUTPUT)
> $(call msg,BINARY,,$@)
> $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
>
>