mbox series

[net-next,00/38] Conver all net selftests to run in unique namespace

Message ID 20231124092736.3673263-1-liuhangbin@gmail.com (mailing list archive)
Headers show
Series Conver all net selftests to run in unique namespace | expand

Message

Hangbin Liu Nov. 24, 2023, 9:26 a.m. UTC
As Guillaume pointed, many selftests create namespaces with very common
names (like "client" or "server") or even (partially) run directly in init_net.
This makes these tests prone to failure if another namespace with the same
name already exists. It also makes it impossible to run several instances
of these tests in parallel.

This patch set conver all the net selftests to run in unique namespace,
so we can update the selftest freamwork to run all tests in it's own namespace
in parallel. After update, we only need to wait for the test which need
longest time.

]# per_test_logging=1 time ./run_kselftest.sh -n -c net
TAP version 13
# selftests: net: reuseport_bpf_numa
not ok 3 selftests: net: reuseport_bpf_numa # exit=1
# selftests: net: reuseport_bpf_cpu
not ok 2 selftests: net: reuseport_bpf_cpu # exit=1
# selftests: net: reuseport_dualstack
not ok 4 selftests: net: reuseport_dualstack # exit=1
# selftests: net: reuseaddr_conflict
ok 5 selftests: net: reuseaddr_conflict

...

# selftests: net: test_vxlan_mdb.sh
ok 90 selftests: net: test_vxlan_mdb.sh
# selftests: net: fib_nexthops.sh
not ok 41 selftests: net: fib_nexthops.sh # exit=1
# selftests: net: fcnal-test.sh
not ok 36 selftests: net: fcnal-test.sh # exit=1

real    55m1.238s
user    12m10.350s
sys     22m17.432s


Hangbin Liu (38):
  selftests/net: add lib.sh
  selftests/net: arp_ndisc_evict_nocarrier.sh convert to run test in
    unique namespace
  selftest: arp_ndisc_untracked_subnets.sh convert to run test in unique
    namespace
  selftests/net: convert cmsg tests to make them run in unique namespace
  selftests/net: convert drop_monitor_tests.sh to run it in unique
    namespace
  selftests/net: convert fcnal-test.sh to run it in unique namespace
  selftests/net: convert fib_nexthop_multiprefix to run it in unique
    namespace
  selftests/net: convert fib_nexthop_nongw.sh to run it in unique
    namespace
  selftests/net: convert fib_nexthops.sh to run it in unique namespace
  selftests/net: convert fib-onlink-tests.sh to run it in unique
    namespace
  selftests/net: convert fib_rule_tests.sh to run it in unique namespace
  selftests/net: convert fib_tests.sh to run it in unique namespace
  selftests/net: convert gre_gso.sh to run it in unique namespace
  selftests/net: convert icmp_redirect.sh to run it in unique namespace
  sleftests/net: convert icmp.sh to run it in unique namespace
  selftests/net: convert ioam6.sh to run it in unique namespace
  selftests/net: convert l2tp.sh to run it in unique namespace
  selftests/net: convert ndisc_unsolicited_na_test.sh to run it in
    unique namespace
  selftests/net: convert netns-name.sh to run it in unique namespace
  selftests/net: convert fdb_flush.sh to run it in unique namespace
  selftests/net: convert rtnetlink.sh to run it in unique namespace
  selftests/net: convert sctp_vrf.sh to run it in unique namespace
  selftests/net: use unique netns name for setup_loopback.sh
    setup_veth.sh
  selftests/net: convert stress_reuseport_listen.sh to run it in unique
    namespace
  selftests/net: convert test_bridge_backup_port.sh to run it in unique
    namespace
  selftests/net: convert test_bridge_neigh_suppress.sh to run it in
    unique namespace
  selftests/net: convert test_vxlan_mdb.sh to run it in unique namespace
  selftests/net: convert test_vxlan_nolocalbypass.sh to run it in unique
    namespace
  selftests/net: convert test_vxlan_under_vrf.sh to run it in unique
    namespace
  selftests/net: convert test_vxlan_vnifiltering.sh to run it in unique
    namespace
  selftests/net: convert toeplitz.sh to run it in unique namespace
  selftests/net: convert unicast_extensions.sh to run it in unique
    namespace
  selftests/net: convert vrf_route_leaking.sh to run it in unique
    namespace
  selftests/net: convert vrf_strict_mode_test.sh to run it in unique
    namespace
  selftests/net: convert vrf-xfrm-tests.sh to run it in unique namespace
  selftests/net: convert traceroute.sh to run it in unique namespace
  selftests/net: convert xfrm_policy.sh to run it in unique namespace
  kselftest/runner.sh: add netns support

 tools/testing/selftests/kselftest/runner.sh   |  26 +-
 tools/testing/selftests/net/Makefile          |   2 +-
 .../net/arp_ndisc_evict_nocarrier.sh          |  46 +--
 .../net/arp_ndisc_untracked_subnets.sh        |  18 +-
 tools/testing/selftests/net/cmsg_ipv6.sh      |  10 +-
 tools/testing/selftests/net/cmsg_so_mark.sh   |   7 +-
 tools/testing/selftests/net/cmsg_time.sh      |   7 +-
 .../selftests/net/drop_monitor_tests.sh       |  21 +-
 tools/testing/selftests/net/fcnal-test.sh     |  30 +-
 tools/testing/selftests/net/fdb_flush.sh      |  11 +-
 .../testing/selftests/net/fib-onlink-tests.sh |   7 +-
 .../selftests/net/fib_nexthop_multiprefix.sh  | 104 +++--
 .../selftests/net/fib_nexthop_nongw.sh        |  34 +-
 tools/testing/selftests/net/fib_nexthops.sh   | 142 ++++---
 tools/testing/selftests/net/fib_rule_tests.sh |  36 +-
 tools/testing/selftests/net/fib_tests.sh      | 184 +++++----
 tools/testing/selftests/net/gre_gso.sh        |  18 +-
 tools/testing/selftests/net/icmp.sh           |  10 +-
 tools/testing/selftests/net/icmp_redirect.sh  | 182 +++++----
 tools/testing/selftests/net/ioam6.sh          | 247 ++++++------
 tools/testing/selftests/net/l2tp.sh           | 130 +++----
 tools/testing/selftests/net/lib.sh            |  98 +++++
 .../net/ndisc_unsolicited_na_test.sh          |  19 +-
 tools/testing/selftests/net/netns-name.sh     |  44 +--
 tools/testing/selftests/net/rtnetlink.sh      |  21 +-
 tools/testing/selftests/net/sctp_vrf.sh       |  12 +-
 tools/testing/selftests/net/settings          |   2 +-
 tools/testing/selftests/net/setup_loopback.sh |   8 +-
 tools/testing/selftests/net/setup_veth.sh     |   9 +-
 .../selftests/net/stress_reuseport_listen.sh  |   6 +-
 .../selftests/net/test_bridge_backup_port.sh  | 368 +++++++++---------
 .../net/test_bridge_neigh_suppress.sh         | 333 ++++++++--------
 tools/testing/selftests/net/test_vxlan_mdb.sh | 202 +++++-----
 .../selftests/net/test_vxlan_nolocalbypass.sh |  48 ++-
 .../selftests/net/test_vxlan_under_vrf.sh     |  70 ++--
 .../selftests/net/test_vxlan_vnifiltering.sh  | 154 +++++---
 tools/testing/selftests/net/toeplitz.sh       |  16 +-
 tools/testing/selftests/net/traceroute.sh     |  82 ++--
 .../selftests/net/unicast_extensions.sh       |  99 +++--
 tools/testing/selftests/net/vrf-xfrm-tests.sh |  77 ++--
 .../selftests/net/vrf_route_leaking.sh        | 201 +++++-----
 .../selftests/net/vrf_strict_mode_test.sh     |  47 ++-
 tools/testing/selftests/net/xfrm_policy.sh    | 138 +++----
 tools/testing/selftests/run_kselftest.sh      |   4 +
 44 files changed, 1676 insertions(+), 1654 deletions(-)
 create mode 100644 tools/testing/selftests/net/lib.sh

Comments

David Ahern Nov. 27, 2023, 2:42 a.m. UTC | #1
On 11/24/23 2:26 AM, Hangbin Liu wrote:
> As Guillaume pointed, many selftests create namespaces with very common
> names (like "client" or "server") or even (partially) run directly in init_net.
> This makes these tests prone to failure if another namespace with the same
> name already exists. It also makes it impossible to run several instances
> of these tests in parallel.
> 
> This patch set conver all the net selftests to run in unique namespace,
> so we can update the selftest freamwork to run all tests in it's own namespace
> in parallel. After update, we only need to wait for the test which need
> longest time.
> 
> ]# per_test_logging=1 time ./run_kselftest.sh -n -c net
> TAP version 13
> # selftests: net: reuseport_bpf_numa
> not ok 3 selftests: net: reuseport_bpf_numa # exit=1
> # selftests: net: reuseport_bpf_cpu
> not ok 2 selftests: net: reuseport_bpf_cpu # exit=1
> # selftests: net: reuseport_dualstack
> not ok 4 selftests: net: reuseport_dualstack # exit=1
> # selftests: net: reuseaddr_conflict
> ok 5 selftests: net: reuseaddr_conflict
> 
> ...
> 
> # selftests: net: test_vxlan_mdb.sh
> ok 90 selftests: net: test_vxlan_mdb.sh
> # selftests: net: fib_nexthops.sh
> not ok 41 selftests: net: fib_nexthops.sh # exit=1
> # selftests: net: fcnal-test.sh
> not ok 36 selftests: net: fcnal-test.sh # exit=1
> 
> real    55m1.238s
> user    12m10.350s
> sys     22m17.432s
> 
> 

I have not looked at the details of each script change, but as long as
not test is broken by the change I am fine with the intent.

Acked-by: David Ahern <dsahern@kernel.org>