]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Tolerate missing files during install
authorRicardo B. Marlière <rbm@suse.com>
Tue, 2 Jun 2026 13:03:00 +0000 (10:03 -0300)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 5 Jun 2026 21:20:58 +0000 (14:20 -0700)
With partial builds, some TEST_GEN_FILES entries can be absent at install
time. rsync treats missing source arguments as fatal and aborts kselftest
installation.

Override INSTALL_SINGLE_RULE in selftests/bpf to use --ignore-missing-args,
while keeping the existing bpf-specific INSTALL_RULE extension logic. Also
add --ignore-missing-args to the TEST_INST_SUBDIRS rsync loop so that
subdirectories with no .bpf.o files (e.g. when a test runner flavor was
skipped) do not abort installation.

Note that the INSTALL_SINGLE_RULE override applies globally to all file
categories including static source files (TEST_PROGS, TEST_FILES). These
are version-controlled and should always be present, so the practical risk
is negligible.

Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Link: https://lore.kernel.org/r/20260602-selftests-bpf_misconfig-v12-11-27f898b3ba26@suse.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile

index 4eebc15670e310acb51072a3d7f68409c270a139..42d9cf848b25540d1a944b13c2712f227fdbcda9 100644 (file)
@@ -1029,12 +1029,23 @@ EXTRA_CLEAN := $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)                       \
 # Delete partially updated (corrupted) files on error
 .DELETE_ON_ERROR:
 
+# When permissive, tell rsync to ignore missing source arguments so that
+# partial builds do not abort installation.
+ifneq ($(PERMISSIVE),)
+override define INSTALL_SINGLE_RULE
+       $(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
+       $(if $(INSTALL_LIST),rsync -a --copy-unsafe-links --ignore-missing-args $(INSTALL_LIST) $(INSTALL_PATH)/)
+endef
+endif
+
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 override define INSTALL_RULE
        $(DEFAULT_INSTALL_RULE)
-       @for DIR in $(TEST_INST_SUBDIRS); do              \
-               mkdir -p $(INSTALL_PATH)/$$DIR;   \
-               rsync -a $(OUTPUT)/$$DIR/*.bpf.o $(INSTALL_PATH)/$$DIR;\
+       @for DIR in $(TEST_INST_SUBDIRS); do                              \
+               mkdir -p $(INSTALL_PATH)/$$DIR;                           \
+               rsync -a $(if $(PERMISSIVE),--ignore-missing-args)        \
+                       $(OUTPUT)/$$DIR/*.bpf.o                           \
+                       $(INSTALL_PATH)/$$DIR;                            \
        done
 endef