Re: [PATCH bpf-next v11 09/11] selftests/bpf: Tolerate benchmark build failures

Ricardo B. Marlière <[email protected]>
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.bpf
Message-ID <[email protected]>
On Thu Apr 30, 2026 at 1:38 PM -03, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Skipping the 'bench' binary compilation will cause 'make install' to abort.
> --
>
> commit 17b45ab67f584992f6ac2a400e83d514968d8c98
> Author: Ricardo B. Marlière <[email protected]>
>
> selftests/bpf: Tolerate benchmark build failures
>
> This commit allows benchmark object compilation and final bench linking to
> be non-fatal when PERMISSIVE is set. It emits a skip message and removes
> the failed outputs so stale binaries are not reused by incremental builds.
>
>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>> index 04634e6e0661e..a460f2ad3cffa 100644
>> --- a/tools/testing/selftests/bpf/Makefile
>> +++ b/tools/testing/selftests/bpf/Makefile
>
> [ ... ]
>
>> @@ -988,7 +989,8 @@ $(OUTPUT)/bench: $(OUTPUT)/bench.o \
>>  		 $(OUTPUT)/usdt_2.o \
>>  		 #
>>  	$(call msg,BINARY,,$@)
>> -	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o,$^) $(LDLIBS) -o $@
>> +	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o,$^) $(LDLIBS) -o $@ $(if $(PERMISSIVE),|| \
>> +		($(RM) $@; printf '  %-12s %s\n' 'SKIP-LINK' '$(notdir $@) (some benchmarks may have been skipped)' 1>&2))
>
> Will removing the target via $(RM) $@ here cause make install to abort?

This is a non issue for the default BPF_STRICT_BUILD=1 case.

>
> The bench binary is registered in the TEST_GEN_PROGS_EXTENDED variable in the
> BPF Makefile. The selftests framework (via tools/testing/selftests/lib.mk)
> unconditionally attempts to install all files in this list using rsync.
>
> Because lib.mk does not use the --ignore-missing-args flag for this target,
> rsync will fail to find the bench binary if it was skipped (and thus
> removed) during a permissive build. This non-zero exit status from rsync
> would break the make install step.
>
> I note this is addressed later in the series by commit 99f5f021f0516
> (selftests/bpf: Tolerate missing files during install).

Yes.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.