From: Alexei Starovoitov 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 --- .../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