From 9e4248fbbf31e45b33f490800f3e1da5049f9347 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 25 May 2026 16:54:48 +0100 Subject: [PATCH] test: also check if networkd built with BTF support before BPF test SUSE does not provide a vmlinux.h so the package is not built with CO-RE support, hence the test fails. This was previously masked by the fact that python3-packaging was never installed, so the test always skipped everywhere as it could not detect the kernel version. Follow-up for c310106c15ea83913e2765dcb0d7c81d83f08a0e --- test/test-network/systemd-networkd-tests.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index cc55679351..c07fb7a478 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -245,6 +245,22 @@ def compare_kernel_version(min_kernel_version): return version.parse(kver) >= version.parse(min_kernel_version) +def networkd_has_sysctl_monitor_bpf(): + """Check whether systemd-networkd was built with ENABLE_SYSCTL_BPF support.""" + if not networkd_bin: + return False + try: + output = subprocess.run( + [networkd_bin, '--version'], + capture_output=True, + text=True, + check=False, + ).stdout + except (OSError, subprocess.SubprocessError): + return False + return '+BTF' in output.split() + + def copy_network_unit(*units, copy_dropins=True): """ Copy networkd unit files into the testbed. @@ -11053,6 +11069,10 @@ class NetworkdSysctlTest(unittest.TestCase, Utilities): compare_kernel_version('6.12'), reason='On kernels <= 6.12, bpf_current_task_under_cgroup() is not available for program types BPF_PROG_TYPE_CGROUP_SYSCTL', ) + @unittest.skipUnless( + networkd_has_sysctl_monitor_bpf(), + reason='systemd-networkd was built without ENABLE_SYSCTL_BPF support (HAVE_VMLINUX_H=0)', + ) def test_sysctl_monitor(self): copy_network_unit('12-dummy.network', '12-dummy.netdev', '12-dummy.link') start_networkd()