selftests/bpf: Skip module_fentry_shadow test when bpf_testmod is not available
authorArtem Savkov <asavkov@redhat.com>
Thu, 14 Sep 2023 12:49:28 +0000 (14:49 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 14 Sep 2023 18:16:13 +0000 (11:16 -0700)
This test relies on bpf_testmod, so skip it if the module is not available.

Fixes: aa3d65de4b900 ("bpf/selftests: Test fentry attachment to shadowed functions")
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230914124928.340701-1-asavkov@redhat.com
tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c

index c7636e18b1ebda07c0e67fd70142954199c0a068..aa9f67eb1c95b3c6ab6116b638db79b7986a68fb 100644 (file)
@@ -61,6 +61,11 @@ void test_module_fentry_shadow(void)
        int link_fd[2] = {};
        __s32 btf_id[2] = {};
 
+       if (!env.has_testmod) {
+               test__skip();
+               return;
+       }
+
        LIBBPF_OPTS(bpf_prog_load_opts, load_opts,
                .expected_attach_type = BPF_TRACE_FENTRY,
        );