Skip to content

Commit

Permalink
selftests/bpf: Switch test_maps to test_progs' test.h format
Browse files Browse the repository at this point in the history
Make test_maps use tests.h header format consistent with the one used by
test_progs, to facilitate unification.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191016060051.2024182-4-andriin@fb.com
  • Loading branch information
Andrii Nakryiko authored and Alexei Starovoitov committed Oct 17, 2019
1 parent d25c5e2 commit ee6c52e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 1 addition & 7 deletions tools/testing/selftests/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,8 @@ $(OUTPUT)/test_maps: test_maps.c $(MAP_TESTS_FILES) | $(MAP_TESTS_H)
$(MAP_TESTS_H): $(MAP_TESTS_FILES) | $(MAP_TESTS_DIR)
$(shell ( cd map_tests/; \
echo '/* Generated header, do not edit */'; \
echo '#ifdef DECLARE'; \
ls *.c 2> /dev/null | \
sed -e 's@\([^\.]*\)\.c@extern void test_\1(void);@'; \
echo '#endif'; \
echo '#ifdef CALL'; \
ls *.c 2> /dev/null | \
sed -e 's@\([^\.]*\)\.c@test_\1();@'; \
echo '#endif' \
sed -e 's@\([^\.]*\)\.c@DEFINE_TEST(\1)@'; \
) > $(MAP_TESTS_H))

VERIFIER_TESTS_DIR = $(OUTPUT)/verifier
Expand Down
8 changes: 4 additions & 4 deletions tools/testing/selftests/bpf/test_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1717,9 +1717,9 @@ static void run_all_tests(void)
test_map_in_map();
}

#define DECLARE
#define DEFINE_TEST(name) extern void test_##name(void);
#include <map_tests/tests.h>
#undef DECLARE
#undef DEFINE_TEST

int main(void)
{
Expand All @@ -1731,9 +1731,9 @@ int main(void)
map_flags = BPF_F_NO_PREALLOC;
run_all_tests();

#define CALL
#define DEFINE_TEST(name) test_##name();
#include <map_tests/tests.h>
#undef CALL
#undef DEFINE_TEST

printf("test_maps: OK, %d SKIPPED\n", skips);
return 0;
Expand Down

0 comments on commit ee6c52e

Please sign in to comment.