Re: [bpf-next 2/4] selftests/bpf: add --no-error-summary to skip end-of-run error log dump

Vineet Gupta <[email protected]> Mon, 3 Aug 2026 12:48:13 -0700
Newsgroups org.kernel.vger.bpf,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/3/26 11:15 AM, [email protected] wrote:
>> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
>> index aa06bab309665..8ee46745e2e85 100644
>> --- a/tools/testing/selftests/bpf/test_progs.c
>> +++ b/tools/testing/selftests/bpf/test_progs.c
> [ ... ]
>
>> @@ -1686,9 +1696,12 @@ static void calculate_summary_and_print_errors(struct test_env *env)
>>   	 * We only print error logs summary when there are failed tests and
>>   	 * verbose mode is not enabled. Otherwise, results may be inconsistent.
>>   	 *
>> +	 * --no-error-summary only elides the human readable dump: the walk
>> +	 * still happens so the JSON report keeps its per-test results.
>>   	 */
>> -	if (!verbose() && fail_cnt) {
>> -		printf("\nAll error logs:\n");
>> +	if (!verbose() && fail_cnt && (env->error_summary || w)) {
>> +		if (env->error_summary)
>> +			printf("\nAll error logs:\n");
> Does the comment match what the code does?  The comment says "the walk
> still happens", but the guard now requires either env->error_summary or w
> to be non-NULL.
>
> When --no-error-summary is passed without --json-summary, both
> env->error_summary and w are false/NULL, so the entire for loop at the
> bottom of this function gets skipped, not just the human readable output.
>
> The walk does happen with --no-error-summary --json-summary FILE (where
> w != NULL), but not in the no-JSON case. Could the comment be more
> specific, maybe "the walk still happens when a JSON report was requested,
> so the JSON report keeps its per-test results"?

Good catch indeed the comment overstate it. Will reword in v2.

Thx,
-Vineet

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