prog_tests/resolve_btfids.c looks for "resolve_btfids.test.o.BTF" relative
to the running test_progs binary. resolve_btfids always writes
<obj.path>.BTF next to the object it processes, so building
resolve_btfids.test.o also produces resolve_btfids.test.o.BTF in the build
output directory as a side effect.

INSTALL_RULE never carries it over: it is not part of TEST_FILES,
TEST_GEN_FILES or TRUNNER_EXTRA_FILES, and it is not copied by the *.bpf.o
rsync used for TEST_INST_SUBDIRS. After "make install", every flavor of
test_progs, including the default one, fails with "Failed to load BTF from
resolve_btfids.test.o.BTF", even though the file built fine and BTF ID
resolution itself works correctly.

Install it next to the rest of the per-flavor build output, using an
explicit rsync in INSTALL_RULE like the one already used for bpftool.

Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary 
output")
Signed-off-by: Ricardo B. Marlière <[email protected]>
---
 tools/testing/selftests/bpf/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/Makefile 
b/tools/testing/selftests/bpf/Makefile
index 47911c9b4977..7260d672acf7 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1057,10 +1057,11 @@ override define INSTALL_RULE
        $(DEFAULT_INSTALL_RULE)
        @mkdir -p $(INSTALL_PATH)/tools/sbin
        @rsync -a $(if $(PERMISSIVE),--ignore-missing-args) $(TRUNNER_BPFTOOL) 
$(INSTALL_PATH)/tools/sbin/
+       @rsync -a $(if $(PERMISSIVE),--ignore-missing-args) 
$(OUTPUT)/resolve_btfids.test.o.BTF $(INSTALL_PATH)/
        @for DIR in $(TEST_INST_SUBDIRS); do                              \
                mkdir -p $(INSTALL_PATH)/$$DIR;                           \
                rsync -a $(if $(PERMISSIVE),--ignore-missing-args)        \
-                       $(OUTPUT)/$$DIR/*.bpf.o                           \
+                       $(OUTPUT)/$$DIR/*.bpf.o 
$(OUTPUT)/$$DIR/resolve_btfids.test.o.BTF \
                        $(INSTALL_PATH)/$$DIR;                            \
        done
 endef

-- 
2.54.0


Reply via email to