Skip to contentSkip to conversation

selftests/bpf: Check whether to run selftest

PATCH Applied Daniel Müller 2 participants 2 messages May 25, 2023 – May 26, 2023

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

PATCH 1/1 selftests/bpf: Check whether to run selftest

The sockopt test invokes test__start_subtest and then unconditionally asserts the success. That means that even if deny-listed, any test will still run and potentially fail.
Evaluate the return value of test__start_subtest() to achieve the desired behavior, as other tests do.

---
 tools/testing/selftests/bpf/prog_tests/sockopt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/sockopt.c +3 -1
index 33dd45..9e6a5e 100644
@@ -1060,7 +1060,9 @@ void test_sockopt(void)
 		return;
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
-		test__start_subtest(tests[i].descr);
+		if (!test__start_subtest(tests[i].descr))
+			continue;
+
 		ASSERT_OK(run_test(cgroup_fd, &tests[i]), tests[i].descr);
 	}
 
Signature · 1 line
2.34.1
#1 lore raw
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 9 lines · On Thu, 25 May 2023 23:22:48 +0000 you wrote:

The sockopt test invokes test__start_subtest and then unconditionally asserts the success. That means that even if deny-listed, any test will still run and potentially fail.
Evaluate the return value of test__start_subtest() to achieve the desired behavior, as other tests do.

[...]

Here is the summary with links:
- [bpf-next] selftests/bpf: Check whether to run selftest

    https://git.kernel.org/bpf/bpf-next/c/321a64b32815

You are awesome, thank you!

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