]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: bpf_cookie: Skip kprobe_multi tests without bpf_testmod
authorSun Jian <sun.jian.kdev@gmail.com>
Sat, 28 Feb 2026 07:45:54 +0000 (15:45 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 5 Mar 2026 23:07:40 +0000 (15:07 -0800)
The kprobe_multi subtests rely on bpf_testmod fentry ksyms.

When bpf_testmod isn't available, libbpf fails to resolve
bpf_testmod_fentry_test* and skeleton load fails with -ESRCH, causing
false failures.

Skip these subtests when env.has_testmod is false.

Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20260228074555.122950-2-sun.jian.kdev@gmail.com
tools/testing/selftests/bpf/prog_tests/bpf_cookie.c

index 75f4dff7d04220f589b71ca04850ef28d622830c..b7643a5bf7ad45ab2e166bb24038cb457fc252ee 100644 (file)
@@ -105,6 +105,11 @@ static void kprobe_multi_link_api_subtest(void)
        unsigned long long addrs[8];
        __u64 cookies[8];
 
+       if (!env.has_testmod) {
+               test__skip();
+               return;
+       }
+
        if (!ASSERT_OK(load_kallsyms(), "load_kallsyms"))
                goto cleanup;
 
@@ -192,6 +197,11 @@ static void kprobe_multi_attach_api_subtest(void)
        };
        __u64 cookies[8];
 
+       if (!env.has_testmod) {
+               test__skip();
+               return;
+       }
+
        skel = kprobe_multi__open_and_load();
        if (!ASSERT_OK_PTR(skel, "fentry_raw_skel_load"))
                goto cleanup;