Re: [PATCH bpf-next v5 07/11] selftests/bpf: Allow test_progs to link with a partial object set

From: bot+bpf-ci

Date: Wed Apr 15 2026 - 17:55:07 EST


> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index ee7bbfcd661b..128ea61fd986 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -754,14 +754,14 @@ endif
> # some X.test.o files have runtime dependencies on Y.bpf.o files
> $(OUTPUT)/$(TRUNNER_BINARY): | $(TRUNNER_BPF_OBJS)
>
> -$(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \
> - $(TRUNNER_EXTRA_OBJS) $$(BPFOBJ) \
> +$(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_EXTRA_OBJS) $$(BPFOBJ) \
> $(TRUNNER_LIB_OBJS) \
> $(TRUNNER_BPFTOOL) \
> $(OUTPUT)/veristat \
> - | $(TRUNNER_BINARY)-extras
> + | $(TRUNNER_BINARY)-extras \
> + $(TRUNNER_TEST_OBJS)

Does moving TRUNNER_TEST_OBJS to the order-only prerequisite list
break incremental builds in the default (BPF_STRICT_BUILD=1) case?

Order-only prerequisites ensure build ordering but do not cause the
target to be rebuilt when they are updated. If a developer edits a
test source file, the corresponding .test.o is correctly recompiled
via the pattern rule and .d dependencies, but because
TRUNNER_TEST_OBJS is no longer a normal prerequisite of
$(OUTPUT)/$(TRUNNER_BINARY), the binary will not be relinked to
pick up the new object. The developer would need to run make clean
or touch a normal prerequisite to get the updated test code linked
into the binary.

> $$(call msg,BINARY,,$$@)
> - $(Q)$$(CC) $$(CFLAGS) $$(filter %.a %.o,$$^) $$(LDLIBS) $$(LLVM_LDLIBS) $$(LDFLAGS) $$(LLVM_LDFLAGS) -o $$@
> + $(Q)$$(CC) $$(CFLAGS) $$(filter %.a %.o,$(if $(PERMISSIVE),$$(wildcard $(TRUNNER_TEST_OBJS)),$(TRUNNER_TEST_OBJS)) $$^) $$(LDLIBS) $$(LLVM_LDLIBS) $$(LDFLAGS) $$(LLVM_LDFLAGS) -o $$@

When PERMISSIVE is set and some .test.o files are absent, the
resulting binary still contains entries in the prog_test_defs[]
array for the missing tests (via tests.h and __weak symbols), but
both run_test and run_serial_test resolve to NULL. The existing
validation in test_progs.c main():

if ((test->run_test == NULL && test->run_serial_test == NULL) ||
(test->run_test != NULL && test->run_serial_test != NULL)) {
...
exit(EXIT_ERR_SETUP_INFRA);
}

will abort the entire test run. This is addressed later in the
series by commit ec7dae68360b ("selftests/bpf: Skip tests whose
objects were not built"), which replaces the abort with a skip
marker.


---
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