Some net kselftests use fixed ports which overlap with process-exporter
service already running on the host. When such a conflict happens,
the test fail with:

  failed to bind receive socket: Address already in use

Instead of changing port numbers, run the affected tests in isolated
network namespace to avoid conflicts with running daemons.

This approach is consistent with upstream solution used in
fc49b804967e5b1cc1665efd4de112945e1ab4c6 and follows the pattern
already used by reuseport_addr_any.sh test.

https://virtuozzo.atlassian.net/browse/VSTOR-120995

Signed-off-by: Konstantin Khorenko <[email protected]>
---
 tools/testing/selftests/net/Makefile               | 5 +++--
 tools/testing/selftests/net/reuseport_bpf.sh       | 4 ++++
 tools/testing/selftests/net/reuseport_bpf_cpu.sh   | 4 ++++
 tools/testing/selftests/net/reuseport_bpf_numa.sh  | 4 ++++
 tools/testing/selftests/net/reuseport_dualstack.sh | 4 ++++
 5 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100755 tools/testing/selftests/net/reuseport_bpf.sh
 create mode 100755 tools/testing/selftests/net/reuseport_bpf_cpu.sh
 create mode 100755 tools/testing/selftests/net/reuseport_bpf_numa.sh
 create mode 100755 tools/testing/selftests/net/reuseport_dualstack.sh

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index 744c8827650c3..3ecd2c34b3d1f 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -11,6 +11,7 @@ TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh 
netdevice.sh \
 TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh
 TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh
 TEST_PROGS += udpgro_bench.sh udpgro.sh test_vxlan_under_vrf.sh 
reuseport_addr_any.sh
+TEST_PROGS += reuseport_bpf.sh reuseport_bpf_cpu.sh reuseport_bpf_numa.sh 
reuseport_dualstack.sh
 TEST_PROGS += test_vxlan_fdb_changelink.sh so_txtime.sh ipv6_flowlabel.sh
 TEST_PROGS += tcp_fastopen_backup_key.sh fcnal-test.sh l2tp.sh traceroute.sh
 TEST_PROGS += fin_ack_lat.sh fib_nexthop_multiprefix.sh fib_nexthops.sh 
fib_nexthop_nongw.sh
@@ -69,8 +70,8 @@ TEST_GEN_FILES += hwtstamp_config rxtimestamp timestamping 
txtimestamp
 TEST_GEN_FILES += ipsec
 TEST_GEN_FILES += ioam6_parser
 TEST_GEN_FILES += gro
-TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
-TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls tun tap 
epoll_busy_poll
+TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa 
reuseport_dualstack
+TEST_GEN_PROGS = reuseaddr_conflict tls tun tap epoll_busy_poll
 TEST_GEN_FILES += toeplitz
 TEST_GEN_FILES += cmsg_sender
 TEST_GEN_FILES += stress_reuseport_listen
diff --git a/tools/testing/selftests/net/reuseport_bpf.sh 
b/tools/testing/selftests/net/reuseport_bpf.sh
new file mode 100755
index 0000000000000..75014a5462a15
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_bpf.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_bpf
diff --git a/tools/testing/selftests/net/reuseport_bpf_cpu.sh 
b/tools/testing/selftests/net/reuseport_bpf_cpu.sh
new file mode 100755
index 0000000000000..243dc5bee0142
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_bpf_cpu.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_bpf_cpu
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.sh 
b/tools/testing/selftests/net/reuseport_bpf_numa.sh
new file mode 100755
index 0000000000000..eccab95a32029
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_bpf_numa
diff --git a/tools/testing/selftests/net/reuseport_dualstack.sh 
b/tools/testing/selftests/net/reuseport_dualstack.sh
new file mode 100755
index 0000000000000..82cc8e345a835
--- /dev/null
+++ b/tools/testing/selftests/net/reuseport_dualstack.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+./in_netns.sh ./reuseport_dualstack
-- 
2.43.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to