Commit 6972dc3b authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

selftests/bpf: Normalize selftest entry points

Ensure that all test entry points are global void functions with no
input arguments. Mark few subtest entry points as static.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211022223228.99920-2-andrii@kernel.org
parent c825f5fe
...@@ -133,7 +133,7 @@ static char *dump_buf; ...@@ -133,7 +133,7 @@ static char *dump_buf;
static size_t dump_buf_sz; static size_t dump_buf_sz;
static FILE *dump_buf_file; static FILE *dump_buf_file;
void test_btf_dump_incremental(void) static void test_btf_dump_incremental(void)
{ {
struct btf *btf = NULL; struct btf *btf = NULL;
struct btf_dump *d = NULL; struct btf_dump *d = NULL;
......
...@@ -117,14 +117,14 @@ static int resolve_symbols(void) ...@@ -117,14 +117,14 @@ static int resolve_symbols(void)
return 0; return 0;
} }
int test_resolve_btfids(void) void test_resolve_btfids(void)
{ {
__u32 *test_list, *test_lists[] = { test_list_local, test_list_global }; __u32 *test_list, *test_lists[] = { test_list_local, test_list_global };
unsigned int i, j; unsigned int i, j;
int ret = 0; int ret = 0;
if (resolve_symbols()) if (resolve_symbols())
return -1; return;
/* Check BTF_ID_LIST(test_list_local) and /* Check BTF_ID_LIST(test_list_local) and
* BTF_ID_LIST_GLOBAL(test_list_global) IDs * BTF_ID_LIST_GLOBAL(test_list_global) IDs
...@@ -138,7 +138,7 @@ int test_resolve_btfids(void) ...@@ -138,7 +138,7 @@ int test_resolve_btfids(void)
test_symbols[i].name, test_symbols[i].name,
test_list[i], test_symbols[i].id); test_list[i], test_symbols[i].id);
if (ret) if (ret)
return ret; return;
} }
} }
...@@ -161,9 +161,7 @@ int test_resolve_btfids(void) ...@@ -161,9 +161,7 @@ int test_resolve_btfids(void)
if (i > 0) { if (i > 0) {
if (!ASSERT_LE(test_set.ids[i - 1], test_set.ids[i], "sort_check")) if (!ASSERT_LE(test_set.ids[i - 1], test_set.ids[i], "sort_check"))
return -1; return;
} }
} }
return ret;
} }
...@@ -42,7 +42,7 @@ static void test_signal_pending_by_type(enum bpf_prog_type prog_type) ...@@ -42,7 +42,7 @@ static void test_signal_pending_by_type(enum bpf_prog_type prog_type)
signal(SIGALRM, SIG_DFL); signal(SIGALRM, SIG_DFL);
} }
void test_signal_pending(enum bpf_prog_type prog_type) void test_signal_pending(void)
{ {
test_signal_pending_by_type(BPF_PROG_TYPE_SOCKET_FILTER); test_signal_pending_by_type(BPF_PROG_TYPE_SOCKET_FILTER);
test_signal_pending_by_type(BPF_PROG_TYPE_FLOW_DISSECTOR); test_signal_pending_by_type(BPF_PROG_TYPE_FLOW_DISSECTOR);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define EXP_NO_BUF_RET 29 #define EXP_NO_BUF_RET 29
void test_snprintf_positive(void) static void test_snprintf_positive(void)
{ {
char exp_addr_out[] = EXP_ADDR_OUT; char exp_addr_out[] = EXP_ADDR_OUT;
char exp_sym_out[] = EXP_SYM_OUT; char exp_sym_out[] = EXP_SYM_OUT;
...@@ -103,7 +103,7 @@ static int load_single_snprintf(char *fmt) ...@@ -103,7 +103,7 @@ static int load_single_snprintf(char *fmt)
return ret; return ret;
} }
void test_snprintf_negative(void) static void test_snprintf_negative(void)
{ {
ASSERT_OK(load_single_snprintf("valid %d"), "valid usage"); ASSERT_OK(load_single_snprintf("valid %d"), "valid usage");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include <test_progs.h> #include <test_progs.h>
#include <network_helpers.h> #include <network_helpers.h>
void test_xdp_adjust_tail_shrink(void) static void test_xdp_adjust_tail_shrink(void)
{ {
const char *file = "./test_xdp_adjust_tail_shrink.o"; const char *file = "./test_xdp_adjust_tail_shrink.o";
__u32 duration, retval, size, expect_sz; __u32 duration, retval, size, expect_sz;
...@@ -30,7 +30,7 @@ void test_xdp_adjust_tail_shrink(void) ...@@ -30,7 +30,7 @@ void test_xdp_adjust_tail_shrink(void)
bpf_object__close(obj); bpf_object__close(obj);
} }
void test_xdp_adjust_tail_grow(void) static void test_xdp_adjust_tail_grow(void)
{ {
const char *file = "./test_xdp_adjust_tail_grow.o"; const char *file = "./test_xdp_adjust_tail_grow.o";
struct bpf_object *obj; struct bpf_object *obj;
...@@ -58,7 +58,7 @@ void test_xdp_adjust_tail_grow(void) ...@@ -58,7 +58,7 @@ void test_xdp_adjust_tail_grow(void)
bpf_object__close(obj); bpf_object__close(obj);
} }
void test_xdp_adjust_tail_grow2(void) static void test_xdp_adjust_tail_grow2(void)
{ {
const char *file = "./test_xdp_adjust_tail_grow.o"; const char *file = "./test_xdp_adjust_tail_grow.o";
char buf[4096]; /* avoid segfault: large buf to hold grow results */ char buf[4096]; /* avoid segfault: large buf to hold grow results */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#define IFINDEX_LO 1 #define IFINDEX_LO 1
void test_xdp_with_devmap_helpers(void) static void test_xdp_with_devmap_helpers(void)
{ {
struct test_xdp_with_devmap_helpers *skel; struct test_xdp_with_devmap_helpers *skel;
struct bpf_prog_info info = {}; struct bpf_prog_info info = {};
...@@ -60,7 +60,7 @@ void test_xdp_with_devmap_helpers(void) ...@@ -60,7 +60,7 @@ void test_xdp_with_devmap_helpers(void)
test_xdp_with_devmap_helpers__destroy(skel); test_xdp_with_devmap_helpers__destroy(skel);
} }
void test_neg_xdp_devmap_helpers(void) static void test_neg_xdp_devmap_helpers(void)
{ {
struct test_xdp_devmap_helpers *skel; struct test_xdp_devmap_helpers *skel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment