All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Run callx prog_tests once
@ 2026-09-24 18:25 Alexei Starovoitov
  2026-09-24 21:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alexei Starovoitov @ 2026-09-24 18:25 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, eddyz87, memxor

From: Alexei Starovoitov <ast@kernel.org>

prog_tests/tests.h is generated from 'void test_*(void)' definitions.
callx_func_ptr_map.c and callx_rodata_lskel.c define the test twice,
under #if and under #else, so both tests are registered and run twice:

  DEFINE_TEST(callx_func_ptr_map)
  DEFINE_TEST(callx_func_ptr_map)
  DEFINE_TEST(callx_rodata_lskel)
  DEFINE_TEST(callx_rodata_lskel)

Make both definitions static and call them from a single test function.

Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 .../selftests/bpf/prog_tests/callx_func_ptr_map.c        | 9 +++++++--
 .../selftests/bpf/prog_tests/callx_rodata_lskel.c        | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c b/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c
index b58ebee9b1ef..42b33d5876b1 100644
--- a/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c
+++ b/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c
@@ -100,7 +100,7 @@ static void run(int prog_fd, int expected, const char *name)
 		ASSERT_EQ(topts.retval, expected, name);
 }
 
-void test_callx_func_ptr_map(void)
+static void __test_callx_func_ptr_map(void)
 {
 	int int_id, proto_id, map_fd = -1, prog_fd = -1, reader_fd = -1, fd, zero = 0;
 	int main_id, add1_id;
@@ -194,9 +194,14 @@ void test_callx_func_ptr_map(void)
 
 #else
 
-void test_callx_func_ptr_map(void)
+static void __test_callx_func_ptr_map(void)
 {
 	test__skip();
 }
 
 #endif
+
+void test_callx_func_ptr_map(void)
+{
+	__test_callx_func_ptr_map();
+}
diff --git a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
index 6a43b880d730..fc5181c5b5ba 100644
--- a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
+++ b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
@@ -21,7 +21,7 @@ static void run(int prog_fd, int expected, const char *name)
  * of its functions. The copies have what user space puts into .rodata before
  * the load. The program that doesn't have callx uses .rodata.
  */
-void test_callx_rodata_lskel(void)
+static void __test_callx_rodata_lskel(void)
 {
 	struct callx_rodata_lskel *skel;
 
@@ -61,9 +61,14 @@ void test_callx_rodata_lskel(void)
 
 #else
 
-void test_callx_rodata_lskel(void)
+static void __test_callx_rodata_lskel(void)
 {
 	test__skip();
 }
 
 #endif
+
+void test_callx_rodata_lskel(void)
+{
+	__test_callx_rodata_lskel();
+}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: Run callx prog_tests once
  2026-09-24 18:25 [PATCH bpf-next] selftests/bpf: Run callx prog_tests once Alexei Starovoitov
@ 2026-09-24 21:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-24 21:30 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: bpf, daniel, andrii, eddyz87, memxor

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 24 Sep 2026 18:25:33 +0000 you wrote:
> From: Alexei Starovoitov <ast@kernel.org>
> 
> prog_tests/tests.h is generated from 'void test_*(void)' definitions.
> callx_func_ptr_map.c and callx_rodata_lskel.c define the test twice,
> under #if and under #else, so both tests are registered and run twice:
> 
>   DEFINE_TEST(callx_func_ptr_map)
>   DEFINE_TEST(callx_func_ptr_map)
>   DEFINE_TEST(callx_rodata_lskel)
>   DEFINE_TEST(callx_rodata_lskel)
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: Run callx prog_tests once
    https://git.kernel.org/bpf/bpf-next/c/31575dcba0ec

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-24 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 18:25 [PATCH bpf-next] selftests/bpf: Run callx prog_tests once Alexei Starovoitov
2026-09-24 21:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.