Skip to contentSkip to conversation

selftests/bpf: skip module_fentry_shadow test when bpf_testmod is not available

PATCH Applied Artem Savkov 3 participants 3 messages Sep 14, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: skip module_fentry_shadow test when bpf_testmod is not available

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")
---
 .../testing/selftests/bpf/prog_tests/module_fentry_shadow.c  | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c +5 -0
index c7636e18b1ebd..cdd55e5340dec 100644
@@ -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,
 	);
Signature · 1 line
2.41.0
#1 lore raw
Quoted 14 lines · Artem Savkov

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")
---
 .../testing/selftests/bpf/prog_tests/module_fentry_shadow.c  | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c +0 -0
index c7636e18b1ebd..cdd55e5340dec 100644

tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c void test_module_fentry_shadow(void) · line 68

Quoted 8 lines
tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c +5 -0
@@ -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;
+        }
+

you used spaces for indentation, please don't do that. It was also obvious if you looked at patchworks status ([0]). I fixed it up while applying, but keep this in mind for the future. Thanks.

[0] https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Quoted 6 lines
tools/testing/selftests/bpf/prog_tests/module_fentry_shadow.c +0 -1
        LIBBPF_OPTS(bpf_prog_load_opts, load_opts,
                .expected_attach_type = BPF_TRACE_FENTRY,
        );
--

2.41.0

#2 lore raw
In reply to Artem Savkov
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Quoted 7 lines · On Thu, 14 Sep 2023 14:49:28 +0200 you wrote:

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")
---
 .../testing/selftests/bpf/prog_tests/module_fentry_shadow.c  | 5 +++++
 1 file changed, 5 insertions(+)

Here is the summary with links:
- [bpf-next] selftests/bpf: skip module_fentry_shadow test when bpf_testmod is not available

    https://git.kernel.org/bpf/bpf-next/c/971f7c32147f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html