Skip to content

xtask: the sdbpf boot test runs the systemd unit tests for cgroup BPF programs - #705

Merged
tamnd merged 1 commit into
mainfrom
bpf-cgroup-tests
Nov 12, 2026
Merged

tamnd merged 1 commit into
mainfrom
bpf-cgroup-tests

Conversation

@tamnd

@tamnd tamnd commented Nov 12, 2026

Copy link
Copy Markdown
Owner

This PR adds the sdbpf boot test for the cgroup programs item of #537.

The test boots the systemd tree and runs three unit tests of systemd from /usr/lib/systemd/tests/unit-tests:

  • test-bpf-devices attaches BPF_PROG_TYPE_CGROUP_DEVICE programs to cgroups.
  • test-bpf-firewall attaches BPF_PROG_TYPE_CGROUP_SKB programs with BPF_PROG_ATTACH and BPF_LINK_CREATE, and pings the loopback interface through them.
  • test-bpf-foreign-programs attaches programs from pinned files to the cgroups of units.

These tests use BPF_PROG_ATTACH, BPF_PROG_DETACH, BPF_PROG_QUERY and BPF_LINK_CREATE, and the effective arrays of the cgroup tree. The kernel needs no change for them. The pass is the line rk-sdbpf: pass and QEMU exit 1 (the power off).

RK_SYSTEMD_PACKAGES of tools/systemd/build.sh adds packages to the systemd tree. The sdbpf test needs RK_SYSTEMD_PACKAGES="systemd-tests iputils-ping". Without these packages, the test fails with a message that names the variable. Like the other systemd tests, it is skipped when no systemd tree is built.

Test results

Test Where Result Load average
rustfmt of xtask/src/main.rs server2 pass 24.4
cargo xtask boot-test -- only sdbpf, x86_64 server1 test-bpf-devices, test-bpf-firewall and test-bpf-foreign-programs exit 0, rk-sdbpf: pass, QEMU exit 1 2.1 to 3.4
x86_64 init -- only bpf (from #701) server1 exit 33, 94 ok 0.03 to 0.11
arm64 init -- only bpf (from #701) server2 pass, 94 ok 5.4 to 5.7

xtask has no systemd tests on arm64, so the arm64 cgroup programs are covered only by the init test.

systemd logs "Failed to get cgroup ID of cgroup ..., ignoring: Operation not supported" two times. This is probably name_to_handle_at on cgroupfs. systemd ignores it, and it is not part of #537.

The full gate did not run.

… programs

The sdbpf test runs test-bpf-devices, test-bpf-firewall and test-bpf-foreign-programs of systemd in the systemd tree. RK_SYSTEMD_PACKAGES of tools/systemd/build.sh adds the packages that the test needs (#537).
@tamnd tamnd added kind/feature New behavior or a new part. area/bpf BPF: the verifier, the JIT, maps and BTF. labels Nov 12, 2026
@tamnd
tamnd merged commit 725c098 into main Nov 12, 2026
6 of 7 checks passed
@tamnd
tamnd deleted the bpf-cgroup-tests branch November 12, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/bpf BPF: the verifier, the JIT, maps and BTF. kind/feature New behavior or a new part.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant