After "make install", test_progs fails because two files end up in the
wrong place:

- bpftool: TEST_GEN_PROGS_EXTENDED flattens it into $(INSTALL_PATH), losing
  the tools/sbin/ prefix that detect_bpftool_path() expects. Remove it from
  TEST_GEN_PROGS_EXTENDED and install it explicitly under tools/sbin/
  instead.

- *.BTF: resolve_btfids writes resolve_btfids.test.o.BTF as a side-effect
  of the build but INSTALL_RULE never copies it over. Install all *.BTF
  files alongside the rest of the per-flavor output.

Fixes: f21fae577446 ("selftests/bpf: Add a few helpers for bpftool testing")
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 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile 
b/tools/testing/selftests/bpf/Makefile
index b642ee489ea6..55d394438705 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -324,8 +324,6 @@ TRUNNER_BPFTOOL := $(DEFAULT_BPFTOOL)
 USE_BOOTSTRAP := "bootstrap/"
 endif
 
-TEST_GEN_PROGS_EXTENDED += $(TRUNNER_BPFTOOL)
-
 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
 
 TESTING_HELPERS        := $(OUTPUT)/testing_helpers.o
@@ -1055,10 +1053,13 @@ endif
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 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)/*.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/*.BTF \
                        $(INSTALL_PATH)/$$DIR;                            \
        done
 endef

-- 
2.55.0


Reply via email to