From: sashiko-bot@kernel.org
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v8 06/11] selftests/bpf: Tolerate test file compilation failures
Date: Wed, 29 Apr 2026 04:38:46 +0000 [thread overview]
Message-ID: <20260429043846.B9012C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260428-selftests-bpf_misconfig-v8-6-bf02cf97dbcb@suse.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The error-handling branch (`||`) executes in an unpredictable directory context depending on which command failed, potentially leaving stale object files or deleting unintended files.
- [Low] The patch breaks the verbose output mode (`V=1`) by unconditionally executing the pretty-printed 'BTFIDS' message.
--
commit 2bc133e2e13cac20b234b4431b2122c75b488855
Author: Ricardo B. Marlière <rbm@suse.com>
selftests/bpf: Tolerate test file compilation failures
This commit modifies the BPF selftest build to make per-test compilation
non-fatal in permissive mode. It removes the output object on failure and
skips the BTFIDS post-processing step if the object file is missing. The
msg macro is also replaced with a plain printf inside the BTFIDS shell block.
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 608e6dff0392..f0545ee6b32a 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -717,11 +717,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))
If cd $$(@D) fails, the && short-circuits and the || branch executes in the
original directory. Will this cause $(RM) $$(@F) to delete the wrong file
and leave a stale object file in $$(@D)?
If a stale object file is left behind, the subsequent [ -f $$@ ] check
would pass, and RESOLVE_BTFIDS might incorrectly operate on the stale
object.
Could the directory change be isolated? For example:
(cd $$(@D) && $$(CC) ... -o $$(@F)) || ($(RM) $$@; ...)
> $$(if $$(TEST_NEEDS_BTFIDS), \
> - $$(call msg,BTFIDS,$(TRUNNER_BINARY),$$@) \
> + $(Q)if [ -f $$@ ]; then \
> + printf ' %-8s%s %s\n' "BTFIDS" " [$(TRUNNER_BINARY)]" "$$(notdir $$@)"; \
This isn't a bug, but does this break the verbose output mode (V=1)?
The msg macro used previously evaluated to an empty string when V=1, which
suppressed the pretty-printed message so only the raw shell commands were
shown.
Because this replaces the msg macro with an unconditional printf inside the
shell script block, it appears Make will echo the raw shell script block
and the shell will execute the printf, resulting in redundant and
misaligned output.
> $(RESOLVE_BTFIDS) --btf $(TRUNNER_OUTPUT)/btf_data.bpf.o $$@; \
> - $(RESOLVE_BTFIDS) --patch_btfids $$@.BTF_ids $$@)
> + $(RESOLVE_BTFIDS) --patch_btfids $$@.BTF_ids $$@; \
> + fi)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260428-selftests-bpf_misconfig-v8-0-bf02cf97dbcb@suse.com?part=6
next prev parent reply other threads:[~2026-04-29 4:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 23:45 [PATCH bpf-next v8 00/11] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 01/11] selftests/bpf: Add BPF_STRICT_BUILD toggle Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels Ricardo B. Marlière
2026-04-29 3:53 ` sashiko-bot
2026-04-28 23:45 ` [PATCH bpf-next v8 03/11] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 04/11] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 05/11] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-29 4:24 ` sashiko-bot
2026-04-28 23:45 ` [PATCH bpf-next v8 06/11] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-29 4:38 ` sashiko-bot [this message]
2026-04-28 23:45 ` [PATCH bpf-next v8 07/11] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 08/11] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-29 5:07 ` sashiko-bot
2026-04-28 23:45 ` [PATCH bpf-next v8 09/11] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 10/11] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-28 23:45 ` [PATCH bpf-next v8 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=20260429043846.B9012C19425@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