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 v5 10/11] selftests/bpf: Skip tests whose objects were not built
Date: Wed, 15 Apr 2026 21:11:00 +0000	[thread overview]
Message-ID: <20260415211101.12C02C19424@smtp.kernel.org> (raw)
In-Reply-To: <20260415-selftests-bpf_misconfig-v5-10-03d0a52a898a@suse.com>

Sashiko AI review found 1 potential issue(s):
- [Medium] Unbuilt tests bypass test filters (e.g., `-t`, `-n`) and are always printed and counted as skipped, breaking test isolation and contradicting the commit message.
--

commit 6ad669628925e7e8627a5068e116b6bbdf0f87d0
Author: Ricardo B. Marlière <rbm@suse.com>

selftests/bpf: Skip tests whose objects were not built

When tests are not compiled, this commit marks them as not built instead
of fatally aborting. It surfaces these unbuilt tests as skipped in the
output so they remain visible in CI results.

> Tests filtered out by -t/-n remain invisible as before; only genuinely
> unbuilt tests are surfaced.

Does the implementation actually keep filtered tests invisible? Looking at
how the flags are set during initialization, it appears unbuilt tests
might bypass the test selector:

> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -2049,12 +2070,16 @@ int main(int argc, char **argv)
>  		test->should_run = should_run(&env.test_selector,
>  					      test->test_num, test->test_name);
>  
>  		if (test->run_test && test->run_serial_test) {
>  			fprintf(stderr, "Test %d:%s must have either test_%s() or serial_test_%sl() defined.\n",
>  				test->test_num, test->test_name, test->test_name, test->test_name);
>  			exit(EXIT_ERR_SETUP_INFRA);
>  		}
> +		if (!test->run_test && !test->run_serial_test) {
> +			test->not_built = true;
> +			test->should_run = false;
> +			continue;
> +		}

Since test->not_built is set to true regardless of what should_run() returned
for env.test_selector, won't every unbuilt test be flagged as not_built even
if the user filtered it out?

[ ... ]

> @@ -1772,6 +1780,19 @@ static void server_main(void)
>  		run_one_test(i);
>  	}
>  
> +	/* mark not-built tests as skipped */
> +	for (int i = 0; i < prog_test_cnt; i++) {
> +		struct prog_test_def *test = &prog_test_defs[i];
> +		struct test_state *state = &test_states[i];
> +
> +		if (test->not_built) {
> +			state->tested = true;
> +			state->skip_cnt = 1;
> +			env.not_built_cnt++;
> +			print_test_result(test, state);
> +		}
> +	}

Will this unconditionally print every unbuilt test in the test suite when
running in parallel mode, directly contradicting the commit message?

[ ... ]

> @@ -2106,9 +2131,18 @@ int main(int argc, char **argv)
>  
>  	for (i = 0; i < prog_test_cnt; i++) {
>  		struct prog_test_def *test = &prog_test_defs[i];
> +		struct test_state *state = &test_states[i];
>  
> -		if (!test->should_run)
> +		if (!test->should_run) {
> +			if (test->not_built && !env.get_test_cnt &&
> +			    !env.list_test_names) {
> +				state->tested = true;
> +				state->skip_cnt = 1;
> +				env.not_built_cnt++;
> +				print_test_result(test, state);
> +			}
>  			continue;
> +		}

Could a similar issue occur here in sequential mode? If a user runs
"./test_progs -t my_test", wouldn't this logic still print "SKIP (not built)"
for all the other unbuilt tests that were supposed to be ignored?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260415-selftests-bpf_misconfig-v5-0-03d0a52a898a@suse.com?part=10

  reply	other threads:[~2026-04-15 21:11 UTC|newest]

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