bpftool_helpers.c looks for bpftool at "tools/sbin/bpftool" or
"../tools/sbin/bpftool" relative to the running test_progs binary, matching
the build directory layout where bpftool sits at
$(OUTPUT)/tools/sbin/bpftool.
INSTALL_RULE installs bpftool through the generic TEST_GEN_PROGS_EXTENDED
mechanism, which flattens it straight into $(INSTALL_PATH) and loses the
tools/sbin/ prefix. After "make install", every flavor of test_progs,
including the default one, fails to locate bpftool, and bpftool_maps_access
and bpftool_metadata error out with "Failed to detect bpftool path", even
though bpftool itself built and installed fine.
Explicitly install bpftool under tools/sbin/ in the installed tree
so its relative location matches what detect_bpftool_path() already
expects, restoring the pre-install layout instead of introducing a
new one.
Fixes: f21fae577446 ("selftests/bpf: Add a few helpers for bpftool testing")
Signed-off-by: Ricardo B. Marlière <[email protected]>
---
tools/testing/selftests/bpf/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/Makefile
b/tools/testing/selftests/bpf/Makefile
index b642ee489ea6..47911c9b4977 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1055,6 +1055,8 @@ 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/
@for DIR in $(TEST_INST_SUBDIRS); do \
mkdir -p $(INSTALL_PATH)/$$DIR; \
rsync -a $(if $(PERMISSIVE),--ignore-missing-args) \
--
2.54.0