Re: [PATCH bpf-next v5 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels

bot+bpf-ci
2026-04-15T21:43:26Z

[-- Attachment #1: Type: text/plain, Size: 2082 bytes --]

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index c8ba8ccc2c6d..5c4cdf1dafc8 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -296,7 +296,7 @@ $(addprefix test_kmods/,$(subst .ko,%ko,$(TEST_KMODS))): $(VMLINUX_BTF) $(RESOLV
>
> $(TEST_KMOD_TARGETS): $(addprefix test_kmods/,$(TEST_KMODS))
> $(call msg,MOD,,$@)
> - $(Q)cp test_kmods/$(@F) $@
> + $(Q)$(if $(PERMISSIVE),if [ -f test_kmods/$(@F) ]; then )cp test_kmods/$(@F) $@$(if $(PERMISSIVE),; fi)

When permissive mode skips this cp because the .ko file was not built,
the target file under $(OUTPUT) is never created. However,
TEST_KMOD_TARGETS is included in TRUNNER_EXTRA_FILES:

TRUNNER_EXTRA_FILES := ...
$(TEST_KMOD_TARGETS)
...

and the test_progs-extras rule passes those paths straight to rsync:

$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT)
ifneq ($2:$(OUTPUT),:$(shell pwd))
$(Q)rsync -aq $$^ $(TRUNNER_OUTPUT)/
endif

For out-of-tree builds (the exact scenario described in the cover
letter -- make -C tools/testing/selftests TARGETS=bpf
O=/lib/modules/$(uname -r)/build BPF_STRICT_BUILD=0), doesn't rsync
fail with "No such file or directory" on the missing .ko paths and
abort the build?

The later commit 671e16611575 ("selftests/bpf: Tolerate missing files
during install") adds --ignore-missing-args to the install rsync
rules, but does not patch this extras target.

Would adding --ignore-missing-args here as well (or filtering the
prerequisite list through $(wildcard)) be needed to make the
permissive out-of-tree path work end to end?

> diff --git a/tools/testing/selftests/bpf/test_kmods/Makefile b/tools/testing/selftests/bpf/test_kmods/Makefile

[ ... ]

---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24478691588