]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Add BPF_STRICT_BUILD toggle
authorRicardo B. Marlière <rbm@suse.com>
Tue, 2 Jun 2026 13:02:50 +0000 (10:02 -0300)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 5 Jun 2026 21:20:57 +0000 (14:20 -0700)
Distro kernels often lack BTF types or kernel features required by some BPF
selftests, causing the build to abort on the first failure and preventing
the remaining tests from running.

Add BPF_STRICT_BUILD (default 1) to control build failure tolerance. When
set to 0, the PERMISSIVE make variable is assigned a non-empty value that
subsequent Makefile rules use to make individual build steps non-fatal.
When set to 1 (the default), the build fails on any error, preserving the
existing behavior for CI and direct builds.

Users can opt in to permissive mode on the command line:

  make -C tools/testing/selftests \
       TARGETS=bpf SKIP_TARGETS= BPF_STRICT_BUILD=0

Suggested-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Link: https://lore.kernel.org/r/20260602-selftests-bpf_misconfig-v12-1-27f898b3ba26@suse.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile

index bc049620c7745ce35976f5e0922eb680e38def13..75036c1b5c4fb5eb481e89c272c267b5bb99a505 100644 (file)
@@ -44,6 +44,12 @@ SKIP_LLVM    ?=
 SKIP_LIBBFD    ?=
 SKIP_CRYPTO    ?=
 
+# When BPF_STRICT_BUILD is 1, any BPF object, skeleton, test object, or
+# benchmark compilation failure is fatal. Set to 0 to tolerate failures
+# and continue building the remaining tests.
+BPF_STRICT_BUILD ?= 1
+PERMISSIVE := $(filter 0,$(BPF_STRICT_BUILD))
+
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))