selftests/bpf: restructure the Makefile as a layered build - #13046
selftests/bpf: restructure the Makefile as a layered build#13046kernel-patches-daemon-bpf[bot] wants to merge 3 commits into
Conversation
|
Upstream branch: 2659f94 |
64657ea to
e5a6c05
Compare
|
Upstream branch: 863f3dd |
6cfc214 to
89c7fd9
Compare
e5a6c05 to
7d50b4c
Compare
|
Upstream branch: f0e80de |
89c7fd9 to
efee5e3
Compare
8722dea to
76c9e44
Compare
|
Upstream branch: f0e80de |
efee5e3 to
82e0845
Compare
68fd498 to
a5a131e
Compare
|
Upstream branch: f0e80de |
82e0845 to
da1e88e
Compare
0ea3224 to
d60d0b1
Compare
|
Upstream branch: f0e80de |
da1e88e to
2e199c8
Compare
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 5147922708 via email |
d60d0b1 to
60b5e07
Compare
|
Upstream branch: 682b1c1 |
2e199c8 to
e203858
Compare
60b5e07 to
656ccb8
Compare
|
Upstream branch: 28e911d |
e203858 to
6a496ed
Compare
656ccb8 to
c1d1749
Compare
|
Upstream branch: 8f876c7 |
6a496ed to
5d6fde4
Compare
c1d1749 to
9fef447
Compare
|
Upstream branch: 0b10b94 |
5d6fde4 to
2a68850
Compare
9fef447 to
2efc18d
Compare
|
Upstream branch: 6078126 |
2a68850 to
7dace48
Compare
2efc18d to
8474c52
Compare
|
Upstream branch: 457d4ec |
7dace48 to
612f357
Compare
8474c52 to
d30e6bf
Compare
The four skeleton generation recipes (regular, light, signed light and linked) are near-identical five-step pipelines - link via "bpftool gen object" three times, compare the second and third results as a regression test for bpftool's determinism, generate the skeleton (and possibly subskeleton), remove intermediates - duplicated with small variations inside DEFINE_TEST_RUNNER_RULES, where every line pays the double-expansion escaping tax. Move the pipeline into gen_bpf_skel.sh; the differences between the four variants become the --lskel, --sign and --subskel flags. Signing takes the key and certificate from $PRIVATE_KEY and $VERIFICATION_CERT in the environment, like the bpftool binary comes from $BPFTOOL. The distinct linked/llinked intermediate infixes are kept but derived inside the script: tests listed in LSKELS_EXTRA generate both a .skel.h and a .lskel.h from the same .bpf.o, and distinct intermediate names are what keeps parallel builds from racing. Build-log messages stay in the recipes with the usual $(call msg,...) helpers; behavior is unchanged. Generated skeletons are byte-identical to the previous recipes' output. The script is a prerequisite of every skeleton rule, so editing it regenerates the headers. Suggested-by: Eduard Zingerman <eddyz87@gmail.com> Assisted-by: Claude:claude-fable-5 shellcheck Signed-off-by: Mykola Lysenko <nickolay.lysenko@gmail.com>
Move the toolchain, path, flag, probe and knob definitions that are not rules into Makefile.buildvars: output-tree layout, libbpf/bpftool binary locations, BPF_CFLAGS/COMMON_CFLAGS assembly, libelf/libpcap probes, endianness and clang feature detection, the vmlinux BTF search list, signing key paths, permissive-mode knob and the libarena skeleton names. This is preparation for building each test runner instance in its own sub-make: the definitions become includable by more than one makefile. No rules or recipes are changed. One deliberate nuance: the include sits after ../lib.mk, so CFLAGS is now assembled by *prepending* COMMON_CFLAGS (keeping the include-search order identical to before, where the definitions preceded lib.mk's additions). Build artifacts are byte-identical before and after this change. Definitions keep the order they had in the Makefile; the only exception is called out in a comment (CFLAGS is prepended rather than appended, as this file is included after lib.mk). Knobs the runner never reads (SKIP_*, submake_extras, VMLINUX_BTF, TEST_KMOD_TARGETS) stay in the main Makefile. BPF_GCC, TEST_KMODS and the VMLINUX_BTF block stay in the Makefile at their current positions - the first two are needed before lib.mk is included, where Makefile.buildvars cannot yet be, and none of them is shared with the coming runner sub-makes except through the environment (a later patch exports what the runners need). Suggested-by: Eduard Zingerman <eddyz87@gmail.com> Assisted-by: Claude:claude-fable-5 shellcheck Signed-off-by: Mykola Lysenko <nickolay.lysenko@gmail.com>
|
Upstream branch: 7f333f8 |
Replace the DEFINE_TEST_RUNNER/DEFINE_TEST_RUNNER_RULES double-expansion machinery with Makefile.runner: one sub-make invocation per test runner instance (test_progs, test_progs-no_alu32, test_progs-cpuv4, test_progs-bpf_gcc, test_maps), each in its own single-flavor namespace written in plain make - no $$-escaping, no per-flavor eval guards, no accumulating vpath directives. The main Makefile keeps everything that exists once - tool sub-builds, vmlinux.h, signing keys, tests.h generation, shared helper objects, standalone binaries and the kselftest lib.mk contract - and delegates to the runner through explicit per-instance rules. Light-skeleton demand lists are derived from the tests' own '#include "*.lskel.h"' lines; the bench object list is derived from $(wildcard benchs/bench_*.c). The ~20 inline $(if $(PERMISSIVE),...) fragments collapse into one skip_on_fail helper in Makefile.buildvars. This also fixes a latent parallel-build race (objects including libbpf internal headers now order against the bpftool sub-build that installs them) and makes the signing key generation rule properly grouped (the two-target form ran genkey twice concurrently under -j). Validation is as for the whole series: BPF objects, skeleton headers, userspace objects and 21/22 binaries byte-identical with the previous Makefile (bench differs only in object link order); emit_tests and the installed tree identical; BPF CI green on x86_64 gcc/llvm, aarch64 and s390x including GCC-BPF, ASAN and veristat jobs; all 76 benchmarks produce identical outcomes. The shared helper objects the main Makefile pre-builds depend on a superset of the prerequisites the runner's uniform object rule uses, so the unflavored test_progs and test_maps sub-makes always see them as up to date and never race to recompile them in the shared output directory. In permissive mode the runner link rule keeps the current Makefile's semantics: test objects existing at parse time are normal prerequisites (editing a test source relinks the runner), the full set stays order-only to drive the build attempts, and the recipe links the wildcard survivors. BPF_GCC and TEST_KMODS are exported next to the LLVM probe results: the runner sub-makes read both from the environment. The BPF compiler differences between flavors (clang vs bpf-gcc, -mcpu level, extra defines and system includes) are plain parameters on the sub-make invocation, so the runner has a single BPF compilation rule with no conditionals. Four stale target-specific lines are dropped on the way: '$(OUTPUT)/test_l4lb_noinline.o: BPF_CFLAGS += -fno-inline' (and the test_xdp_noinline sibling) attach to names nothing builds - the BPF objects have been %.bpf.o for years - and the $(OUTPUT)/flow_dissector_load.o / $(OUTPUT)/cgroup_getset_retval_hooks.o header dependencies likewise name objects no rule produces. Suggested-by: Eduard Zingerman <eddyz87@gmail.com> Assisted-by: Claude:claude-fable-5 shellcheck Signed-off-by: Mykola Lysenko <nickolay.lysenko@gmail.com>
612f357 to
18702fe
Compare
Pull request for series with
subject: selftests/bpf: restructure the Makefile as a layered build
version: 4
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1133647