public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v7 06/11] selftests/bpf: Tolerate test file compilation failures
Date: Thu, 16 Apr 2026 19:55:54 +0000	[thread overview]
Message-ID: <20260416195555.7FFD1C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260416-selftests-bpf_misconfig-v7-6-a078e18012e4@suse.com>

Sashiko AI review found 2 potential issue(s):
- [High] Tolerating test compilation failures breaks the build at the linker step.
- [High] Omitting test objects causes the test suite runner to abort at startup.
--

commit 3b7eac5b82169326acf885f820b425d42e131d71
Author: Ricardo B. Marlière <rbm@suse.com>

selftests/bpf: Tolerate test file compilation failures

This commit modifies the selftests build system to make per-test compilation
failures non-fatal when permitted. It removes the output object on failure
and skips the post-processing step for missing objects.

> Make the per-test compilation non-fatal: remove the output object on
> failure and print a SKIP-TEST marker to stderr. Guard the BTFIDS
> post-processing step so it is skipped when the object file is absent. The
> linker step will later ignore absent objects, allowing the remaining tests
> to build and run.

Is this description accurate regarding the linker step?

During linking, the Makefile rules pass the literal list of prerequisites to
the compiler. When a compilation fails and the object file is deleted, that
missing file is still passed to the linker.

This causes a fatal "No such file or directory" error that halts the build.

I notice this is addressed later in the series by the patch "selftests/bpf:
Allow test_progs to link with a partial object set", but it causes a build
regression in this specific commit.

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index b3eaa4a93707c..5ad50d3ff2f8c 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -708,11 +708,14 @@ $(TRUNNER_TEST_OBJS): $(TRUNNER_OUTPUT)/%.test.o:			\
>  		      $(TRUNNER_TESTS_DIR)/%.c				\
>  		      | $(TRUNNER_OUTPUT)/%.test.d
>  	$$(call msg,TEST-OBJ,$(TRUNNER_BINARY),$$@)
> -	$(Q)cd $$(@D) && $$(CC) -I. $$(CFLAGS) -MMD -MT $$@ -c $(CURDIR)/$$< $$(LDLIBS) -o $$(@F)
> +	$(Q)cd $$(@D) && $$(CC) -I. $$(CFLAGS) -MMD -MT $$@ -c $(CURDIR)/$$< $$(LDLIBS) -o $$(@F) $(if $(PERMISSIVE),|| \
> +		($(RM) $$(@F); printf '  %-12s %s\n' 'SKIP-TEST' '$$(notdir $$@)' 1>&2))

How does the test suite handle the missing objects at runtime?

The test framework generates the test header by scanning the source files
directly, so a test definition is emitted even if its object file was
skipped.

Because the compiled object is missing, the weak function pointers for that
test resolve to a null pointer during linking. When the test runner validates
these pointers at startup, it prints an error and aborts the entire test
framework setup.

This prevents the remaining tests from running.

I see this is resolved later in the series by the patch "selftests/bpf: Skip
tests whose objects were not built", but it introduces a runtime regression
here.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260416-selftests-bpf_misconfig-v7-0-a078e18012e4@suse.com?part=6

  reply	other threads:[~2026-04-16 19:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 19:30 [PATCH bpf-next v7 00/11] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 01/11] selftests/bpf: Add BPF_STRICT_BUILD toggle Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels Ricardo B. Marlière
2026-04-16 19:52   ` sashiko-bot
2026-04-16 19:30 ` [PATCH bpf-next v7 03/11] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 04/11] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 05/11] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 06/11] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-16 19:55   ` sashiko-bot [this message]
2026-04-16 19:30 ` [PATCH bpf-next v7 07/11] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 08/11] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-16 20:05   ` sashiko-bot
2026-04-16 19:30 ` [PATCH bpf-next v7 09/11] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-04-16 19:30 ` [PATCH bpf-next v7 10/11] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-16 19:31 ` [PATCH bpf-next v7 11/11] selftests/bpf: Tolerate missing files during install Ricardo B. Marlière

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416195555.7FFD1C2BCAF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=rbm@suse.com \
    --cc=sashiko@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox