diff options
| author | Alexei Starovoitov <ast@fb.com> | 2016-03-08 00:57:21 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-03-08 15:28:32 -0500 |
| commit | c3f85cffc50d2f259903555979581a632b945ec2 (patch) | |
| tree | ff802293cd7a0020211818c8039cd9f117f30a35 /samples/bpf | |
| parent | 89b976070190eb9dd14943c0d6ca4b7209f61405 (diff) | |
samples/bpf: test both pre-alloc and normal maps
extend test coveraged to include pre-allocated and run-time alloc maps
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf')
| -rw-r--r-- | samples/bpf/test_maps.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/samples/bpf/test_maps.c b/samples/bpf/test_maps.c index 7bd9edd02d9b..47bf0858f9e4 100644 --- a/samples/bpf/test_maps.c +++ b/samples/bpf/test_maps.c | |||
| @@ -468,7 +468,7 @@ static void test_map_parallel(void) | |||
| 468 | assert(bpf_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT); | 468 | assert(bpf_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT); |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | int main(void) | 471 | static void run_all_tests(void) |
| 472 | { | 472 | { |
| 473 | test_hashmap_sanity(0, NULL); | 473 | test_hashmap_sanity(0, NULL); |
| 474 | test_percpu_hashmap_sanity(0, NULL); | 474 | test_percpu_hashmap_sanity(0, NULL); |
| @@ -479,6 +479,14 @@ int main(void) | |||
| 479 | test_map_large(); | 479 | test_map_large(); |
| 480 | test_map_parallel(); | 480 | test_map_parallel(); |
| 481 | test_map_stress(); | 481 | test_map_stress(); |
| 482 | } | ||
| 483 | |||
| 484 | int main(void) | ||
| 485 | { | ||
| 486 | map_flags = 0; | ||
| 487 | run_all_tests(); | ||
| 488 | map_flags = BPF_F_NO_PREALLOC; | ||
| 489 | run_all_tests(); | ||
| 482 | printf("test_maps: OK\n"); | 490 | printf("test_maps: OK\n"); |
| 483 | return 0; | 491 | return 0; |
| 484 | } | 492 | } |
