Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752064AbcCGB7K (ORCPT ); Sun, 6 Mar 2016 20:59:10 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:38469 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823AbcCGB6l (ORCPT ); Sun, 6 Mar 2016 20:58:41 -0500 From: Alexei Starovoitov To: "David S . Miller" CC: Daniel Borkmann , Daniel Wagner , Tom Zanussi , Wang Nan , He Kuang , Martin KaFai Lau , Brendan Gregg , , , Subject: [PATCH net-next 7/9] samples/bpf: test both pre-alloc and normal maps Date: Sun, 6 Mar 2016 17:58:35 -0800 Message-ID: <1457315917-1970307-8-git-send-email-ast@fb.com> X-Mailer: git-send-email 2.6.5 In-Reply-To: <1457315917-1970307-1-git-send-email-ast@fb.com> References: <1457315917-1970307-1-git-send-email-ast@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-07_01:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 903 Lines: 37 extend test coveraged to include pre-allocated and run-time alloc maps Signed-off-by: Alexei Starovoitov --- samples/bpf/test_maps.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/bpf/test_maps.c b/samples/bpf/test_maps.c index af02f7518c0a..d1e63f48e39c 100644 --- a/samples/bpf/test_maps.c +++ b/samples/bpf/test_maps.c @@ -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; } -- 2.6.5