aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_lpm_map.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-02-26 22:34:32 +0100
committerAlexei Starovoitov <ast@kernel.org>2018-02-26 20:11:23 -0800
commitfe8d662aef26394388bfcd3b96ce123b6d33044b (patch)
treec236669015f5b2b435d0283f3d6f62f30cdc552c /tools/testing/selftests/bpf/test_lpm_map.c
parentMerge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue (diff)
downloadlinux-dev-fe8d662aef26394388bfcd3b96ce123b6d33044b.tar.xz
linux-dev-fe8d662aef26394388bfcd3b96ce123b6d33044b.zip
bpf: unify rlimit handling in selftests
Unify memlock handling into bpf_rlimit.h and replace all occurences in BPF kselftests with it. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/test_lpm_map.c')
-rw-r--r--tools/testing/selftests/bpf/test_lpm_map.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/tools/testing/selftests/bpf/test_lpm_map.c b/tools/testing/selftests/bpf/test_lpm_map.c
index 2be87e9ee28d..147e34cfceb7 100644
--- a/tools/testing/selftests/bpf/test_lpm_map.c
+++ b/tools/testing/selftests/bpf/test_lpm_map.c
@@ -22,10 +22,11 @@
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/time.h>
-#include <sys/resource.h>
#include <bpf/bpf.h>
+
#include "bpf_util.h"
+#include "bpf_rlimit.h"
struct tlpm_node {
struct tlpm_node *next;
@@ -736,17 +737,11 @@ static void test_lpm_multi_thread(void)
int main(void)
{
- struct rlimit limit = { RLIM_INFINITY, RLIM_INFINITY };
- int i, ret;
+ int i;
/* we want predictable, pseudo random tests */
srand(0xf00ba1);
- /* allow unlimited locked memory */
- ret = setrlimit(RLIMIT_MEMLOCK, &limit);
- if (ret < 0)
- perror("Unable to lift memlock rlimit");
-
test_lpm_basic();
test_lpm_order();
@@ -755,11 +750,8 @@ int main(void)
test_lpm_map(i);
test_lpm_ipaddr();
-
test_lpm_delete();
-
test_lpm_get_next_key();
-
test_lpm_multi_thread();
printf("test_lpm: OK\n");