Skip to content

Commit 3e18f5f

Browse files
Hou TaoAlexei Starovoitov
authored andcommitted
selftests/bpf: Move test_lpm_map.c to map_tests
Move test_lpm_map.c to map_tests/ to include LPM trie test cases in regular test_maps run. Most code remains unchanged, including the use of assert(). Only reduce n_lookups from 64K to 512, which decreases test_lpm_map runtime from 37s to 0.7s. Signed-off-by: Hou Tao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 6a5c63d commit 3e18f5f

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

tools/testing/selftests/bpf/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ bpf-syscall*
55
test_verifier
66
test_maps
77
test_lru_map
8-
test_lpm_map
98
test_tag
109
FEATURE-DUMP.libbpf
1110
FEATURE-DUMP.selftests

tools/testing/selftests/bpf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CLANG_CPUV4 := 1
8383
endif
8484

8585
# Order correspond to 'make run_tests' order
86-
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
86+
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_progs \
8787
test_sockmap \
8888
test_tcpnotify_user test_sysctl \
8989
test_progs-no_alu32

tools/testing/selftests/bpf/test_lpm_map.c renamed to tools/testing/selftests/bpf/map_tests/lpm_trie_map_basic_ops.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static void test_lpm_map(int keysize)
223223
n_matches = 0;
224224
n_matches_after_delete = 0;
225225
n_nodes = 1 << 8;
226-
n_lookups = 1 << 16;
226+
n_lookups = 1 << 9;
227227

228228
data = alloca(keysize);
229229
memset(data, 0, keysize);
@@ -770,16 +770,13 @@ static void test_lpm_multi_thread(void)
770770
close(map_fd);
771771
}
772772

773-
int main(void)
773+
void test_lpm_trie_map_basic_ops(void)
774774
{
775775
int i;
776776

777777
/* we want predictable, pseudo random tests */
778778
srand(0xf00ba1);
779779

780-
/* Use libbpf 1.0 API mode */
781-
libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
782-
783780
test_lpm_basic();
784781
test_lpm_order();
785782

@@ -792,6 +789,5 @@ int main(void)
792789
test_lpm_get_next_key();
793790
test_lpm_multi_thread();
794791

795-
printf("test_lpm: OK\n");
796-
return 0;
792+
printf("%s: PASS\n", __func__);
797793
}

0 commit comments

Comments
 (0)