[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <f215ba8356288b442e18f01050e0599886dad3e5.1544153769.git.sdf@google.com>
Date: Thu, 6 Dec 2018 19:39:06 -0800
From: Stanislav Fomichev <sdf@...gle.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, ast@...nel.org, daniel@...earbox.net,
john.fastabend@...il.com, Stanislav Fomichev <sdf@...gle.com>
Subject: [PATCH bpf] selftests/bpf: skip sockmap tests on kernels without support
Include "autoconf.h" header in the test_maps.c and selectively
disable test_sockmap if CONFIG_BPF_STREAM_PARSER is not specified
in the kernel config.
When building out of tree/without autoconf.h, fall back to 'enabled'.
Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
---
tools/testing/selftests/bpf/test_maps.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 4db2116e52be..3548de8a78ac 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -32,6 +32,13 @@
#define ENOTSUPP 524
#endif
+#ifdef HAVE_GENHDR
+# include "autoconf.h"
+#else
+/* fallback to all features enabled */
+# define CONFIG_BPF_STREAM_PARSER 1
+#endif
+
static int map_flags;
#define CHECK(condition, tag, format...) ({ \
@@ -588,6 +595,7 @@ static void test_stackmap(int task, void *data)
close(fd);
}
+#ifdef CONFIG_BPF_STREAM_PARSER
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
@@ -1079,6 +1087,7 @@ static void test_sockmap(int tasks, void *data)
close(fd);
exit(1);
}
+#endif
#define MAP_SIZE (32 * 1024)
@@ -1541,7 +1550,9 @@ static void run_all_tests(void)
test_arraymap_percpu_many_keys();
test_devmap(0, NULL);
+#ifdef CONFIG_BPF_STREAM_PARSER
test_sockmap(0, NULL);
+#endif
test_map_large();
test_map_parallel();
--
2.20.0.rc2.403.gdbc3b29805-goog
Powered by blists - more mailing lists