samples/bpf: test both pre-alloc and normal maps
authorAlexei Starovoitov <ast@fb.com>
Tue, 8 Mar 2016 05:57:21 +0000 (21:57 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Mar 2016 20:28:32 +0000 (15:28 -0500)
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>
samples/bpf/test_maps.c

index 7bd9edd02d9b1e7c19339a6a98b9e513f8edd81d..47bf0858f9e47d1b85a908ab94518c46b11ffecd 100644 (file)
@@ -468,7 +468,7 @@ static void test_map_parallel(void)
        assert(bpf_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
 }
 
-int main(void)
+static void run_all_tests(void)
 {
        test_hashmap_sanity(0, NULL);
        test_percpu_hashmap_sanity(0, NULL);
@@ -479,6 +479,14 @@ int main(void)
        test_map_large();
        test_map_parallel();
        test_map_stress();
+}
+
+int main(void)
+{
+       map_flags = 0;
+       run_all_tests();
+       map_flags = BPF_F_NO_PREALLOC;
+       run_all_tests();
        printf("test_maps: OK\n");
        return 0;
 }