selftests/bpf: move netcnt test under test_progs
Subsystems (5)
PATCH v3 1/1 selftests/bpf: move netcnt test under test_progs
Rewrite to skel and ASSERT macros as well while we are at it.
v3:
- replace -f with -A to make it work with busybox ping. -A is available on both busybox and iputils, from the man page:
On networks with low RTT this mode is essentially equivalent to flood mode.
v2:
- don't check result of bpf_map__fd (Yonghong Song)
- remove from .gitignore (Andrii Nakryiko)
- move ping_command into network_helpers (Andrii Nakryiko)
- remove assert() (Andrii Nakryiko)
--- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 3 +- tools/testing/selftests/bpf/network_helpers.c | 12 ++ tools/testing/selftests/bpf/network_helpers.h | 1 + .../testing/selftests/bpf/prog_tests/netcnt.c | 82 ++++++++++ .../selftests/bpf/prog_tests/tc_redirect.c | 12 -- tools/testing/selftests/bpf/test_netcnt.c | 148 ------------------ 7 files changed, 96 insertions(+), 163 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/netcnt.c delete mode 100644 tools/testing/selftests/bpf/test_netcnt.c
tools/testing/selftests/bpf/.gitignore +0 -1
@@ -23,7 +23,6 @@ test_skb_cgroup_id_user test_cgroup_storage test_flow_dissector flow_dissector_load -test_netcnt test_tcpnotify_user test_libbpf test_tcp_check_syncookie_user
tools/testing/selftests/bpf/Makefile +1 -2
@@ -38,7 +38,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test test_verifier_log test_dev_cgroup \ test_sock test_sockmap get_cgroup_id_user \ test_cgroup_storage \ - test_netcnt test_tcpnotify_user test_sysctl \ + test_tcpnotify_user test_sysctl \ test_progs-no_alu32 # Also test bpf-gcc, if present
@@ -197,7 +197,6 @@ $(OUTPUT)/test_sockmap: cgroup_helpers.c $(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c $(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c $(OUTPUT)/test_cgroup_storage: cgroup_helpers.c -$(OUTPUT)/test_netcnt: cgroup_helpers.c $(OUTPUT)/test_sock_fields: cgroup_helpers.c $(OUTPUT)/test_sysctl: cgroup_helpers.c
tools/testing/selftests/bpf/network_helpers.c +12 -0
@@ -310,3 +310,15 @@ int make_sockaddr(int family, const char *addr_str, __u16 port, }return -1 ; } + +char *ping_command (int family) +{ +if (family ==AF_INET6 ) { +/* On some systems 'ping' doesn't support IPv6, so use ping6 if it is present. */ +if (!system ("which ping6 >/dev/null 2>&1" )) +return "ping6" ; +else +return "ping -6" ; + } +return "ping" ; +}
tools/testing/selftests/bpf/network_helpers.h +1 -0
@@ -46,5 +46,6 @@ int fastopen_connect(int server_fd, const char *data, unsigned int data_len, int timeout_ms);int make_sockaddr (int family,const char *addr_str,__u16 port,struct sockaddr_storage *addr,socklen_t *len); +char *ping_command (int family);#endif
tools/testing/selftests/bpf/prog_tests/netcnt.c new file +82 -0
82 lines not on this page · raw message
tools/testing/selftests/bpf/prog_tests/tc_redirect.c +0 -12
@@ -390,18 +390,6 @@ static void test_tcp(int family, const char *addr, __u16 port)close (client_fd); } -static char *ping_command (int family) -{ -if (family ==AF_INET6 ) { -/* On some systems 'ping' doesn't support IPv6, so use ping6 if it is present. */ -if (!system ("which ping6 >/dev/null 2>&1" )) -return "ping6" ; -else -return "ping -6" ; - } -return "ping" ; -} -static int test_ping (int family,const char *addr) {SYS ("ip netns exec " NS_SRC " %s " PING_ARGS " %s > /dev/null" ,ping_command (family), addr);
tools/testing/selftests/bpf/test_netcnt.c deleted +0 -148
148 lines not on this page · raw message
Signature · 1 line
2.32.0.554.ge1b32706d8-goog
This patch was applied to bpf/bpf-next.git (refs/heads/master):
Hello:
This patch was applied to bpf/bpf-next.git (refs/heads/master):
Quoted 9 lines · On Wed, 4 Aug 2021 13:55:24 -0700 you wrote:
Rewrite to skel and ASSERT macros as well while we are at it.
v3:
- replace -f with -A to make it work with busybox ping. -A is available on both busybox and iputils, from the man page:
On networks with low RTT this mode is essentially equivalent to flood mode.[...]
Here is the summary with links:
- [bpf-next,v3] selftests/bpf: move netcnt test under test_progs
https://git.kernel.org/bpf/bpf-next/c/372642ea83ff
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html