All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] selftests/bpf: Tolerate partial builds across kernel configs
@ 2026-04-03 14:58 Ricardo B. Marlière
  2026-04-03 14:58 ` [PATCH v2 01/10] selftests/bpf: Fall back to distro build directory for test_kmods Ricardo B. Marlière
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Ricardo B. Marlière @ 2026-04-03 14:58 UTC (permalink / raw)
  To: Andrii Nakryiko, Eduard Zingerman, Alexei Starovoitov,
	Daniel Borkmann, Martin KaFai Lau, Kumar Kartikeya Dwivedi,
	Song Liu, Yonghong Song, Jiri Olsa, Shuah Khan, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: bpf, linux-kselftest, linux-kernel, llvm,
	Ricardo B. Marlière

Currently the BPF selftests can only be built by using the minimum kernel
configuration defined in tools/testing/selftests/bpf/config*. This poses a
problem in distribution kernels that may have some of the flags disabled or
set as module. For example, we have been running the tests regularly in
openSUSE Tumbleweed [1] [2] but to work around this fact we created a
special package [3] that build the tests against an auxiliary vmlinux with
the BPF Kconfig. We keep a list of known issues that may happen due to,
amongst other things, configuration mismatches [4] [5].

The maintenance of this package is far from ideal, especially for
enterprise kernels. The goal of this series is to enable the common usecase
of running the following in any system:

```sh
make -C tools/testing/selftests install \
        SKIP_TARGETS= \
        TARGETS=bpf \
        O=/lib/modules/$(uname -r)/build
```

As an example, the following script targeting a minimal config can be used
for testing:

```sh
make defconfig
scripts/config --file .config \
               --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
               --enable DEBUG_INFO_BTF \
               --enable BPF_SYSCALL \
               --enable BPF_JIT
make olddefconfig
make -j$(nproc)
make -j$(nproc) -C tools/testing/selftests SKIP_TARGETS= TARGETS=bpf install
```

This produces a test_progs binary with 579 subtests, against the total of
708. Many of them will still fail or be skipped at runtime due to lack of
symbols, but at least there will be a clear way of building the tests.

[1]: https://openqa.opensuse.org/tests/5811715
[2]: https://openqa.opensuse.org/tests/5811730
[3]: https://src.opensuse.org/rmarliere/kselftests
[4]: https://github.com/openSUSE/kernel-qe/blob/main/kselftests_known_issues.yaml
[5]: https://openqa.opensuse.org/tests/5811730/logfile?filename=run_kselftests-config_mismatches.txt

Assisted-by: {codex,claude}
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
---
Changes in v2:
- Skip test_kmods build/clean when KDIR directory does not exist
- Use `Module.symvers` instead of `.config` for in-tree detection
- Fix skeleton order-only prereqs commit message
- Guard BTFIDS step when .test.o is absent
- Add `__weak stack_mprotect()` stubs in `bpf_cookie.c` and `iters.c`
- Link to v1: https://patch.msgid.link/20260401-selftests-bpf_misconfig-v1-0-3ae42c0af76f@suse.com

---
Ricardo B. Marlière (10):
      selftests/bpf: Fall back to distro build directory for test_kmods
      selftests/bpf: Tolerate BPF and skeleton generation failures
      selftests/bpf: Avoid rebuilds when running emit_tests
      selftests/bpf: Make skeleton headers order-only prerequisites of .test.d
      selftests/bpf: Tolerate test file compilation failures
      selftests/bpf: Allow test_progs to link with a partial object set
      selftests/bpf: Tolerate benchmark build failures
      selftests/bpf: Provide weak definitions for cross-test functions
      selftests/bpf: Skip tests whose objects were not built
      selftests/bpf: Tolerate missing files during install

 tools/testing/selftests/bpf/Makefile               | 111 ++++++++++++++-------
 .../testing/selftests/bpf/prog_tests/bpf_cookie.c  |  20 +++-
 tools/testing/selftests/bpf/prog_tests/iters.c     |  10 +-
 tools/testing/selftests/bpf/test_kmods/Makefile    |   8 +-
 tools/testing/selftests/bpf/test_progs.c           |   7 +-
 5 files changed, 110 insertions(+), 46 deletions(-)
---
base-commit: 6f6c794d0ff05dab1fa4677f39043de8a6a80da3
change-id: 20260401-selftests-bpf_misconfig-4c33ef5c56da

Best regards,
--  
Ricardo B. Marlière <rbm@suse.com>


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-08-13 23:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 14:58 [PATCH v2 00/10] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 01/10] selftests/bpf: Fall back to distro build directory for test_kmods Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 02/10] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 03/10] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 04/10] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 05/10] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-03 15:31   ` bot+bpf-ci
2026-04-03 14:58 ` [PATCH v2 06/10] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-03 15:31   ` bot+bpf-ci
2026-04-03 14:59 ` [PATCH v2 07/10] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-08-13 23:50   ` sashiko-bot
2026-04-03 14:59 ` [PATCH v2 08/10] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-03 14:59 ` [PATCH v2 09/10] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-03 14:59 ` [PATCH v2 10/10] selftests/bpf: Tolerate missing files during install Ricardo B. Marlière

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.