* Re: [PATCH bpf-next v2 2/2] selftests/bpf: Test insns processed breakdown
[not found] ` <20260429023623.73482C2BCB7@smtp.kernel.org>
@ 2026-04-29 9:30 ` Alexei Starovoitov
0 siblings, 0 replies; only message in thread
From: Alexei Starovoitov @ 2026-04-29 9:30 UTC (permalink / raw)
To: sashiko, Paul Chaignon; +Cc: bpf
On Tue Apr 28, 2026 at 7:36 PM PDT, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Medium] Asserting exact verifier instruction counts in C-based BPF selftests causes test flakiness.
> - [Low] Unused test configuration from blindly elevating log levels to 6 without corresponding assertions.
> --
>
> commit c4e03a953efa7cd8cf2e1a288a0c55c4f73cace2
> Author: Paul Chaignon <paul.chaignon@gmail.com>
>
> selftests/bpf: Test insns processed breakdown
>
> This patch updates global subprog selftests to verify the new verifier
> log breakdown of instructions processed by global subprogs. It does this
> by increasing log levels and adding new message assertions.
>
>> diff --git a/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c b/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
>> index 1e08aff7532e..7092a046c018 100644
>> --- a/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
>> +++ b/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
>
> [ ... ]
>
>> @@ -186,21 +187,24 @@ __weak int raw_tp_u64_array(u64 *ctx __arg_ctx)
>> }
>>
>> SEC("?raw_tp")
>> -__success __log_level(2)
>> +__success __log_level(6)
>> +__msg("insns processed 12+5+2+2")
>> int arg_tag_ctx_raw_tp(void *ctx)
>
> Will hardcoding exact instruction counts cause the tests to become flaky across
> different LLVM/Clang versions or optimization levels?
>
> Since test_loader.c natively supports regex matching within __msg using the
> {{...}} syntax, would it be more reliable to use a pattern to validate the
> log format?
>
> For example, __msg("insns processed {{[0-9]+(\+[0-9]+)*}}") might prevent
> failures when the compiler generates slightly different assembly.
I have to agree with sashk here.
It's way too many tests with hard coded insn counts.
Just one test with above regex is plenty.
pw-bot: cr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-29 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <24f2a5b5f8e3041d03d78305ca0e2277f684d588.1777398528.git.paul.chaignon@gmail.com>
[not found] ` <20260429023623.73482C2BCB7@smtp.kernel.org>
2026-04-29 9:30 ` [PATCH bpf-next v2 2/2] selftests/bpf: Test insns processed breakdown Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox