Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0eb8053c authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller
Browse files

selftests: forwarding: Allow running specific tests



Similar to commit a511858c ("selftests: fib_tests: Allow user to run
a specific test"), allow user to run only a subset of the tests using
the TESTS environment variable.

This is useful when not all the tests can pass on a given system.

Example:
# export TESTS="ping_ipv4 ping_ipv6"
# ./bridge_vlan_aware.sh
TEST: ping					[PASS]
TEST: ping6					[PASS]

Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 94132487
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding"
NUM_NETIFS=4
CHECK_TC="yes"
source lib.sh
@@ -75,14 +76,31 @@ cleanup()
	vrf_cleanup
}

ping_ipv4()
{
	ping_test $h1 192.0.2.2
}

ping_ipv6()
{
	ping6_test $h1 2001:db8:1::2
}

learning()
{
	learning_test "br0" $swp1 $h1 $h2
}

flooding()
{
	flood_test $swp2 $h1 $h2
}

trap cleanup EXIT

setup_prepare
setup_wait

ping_test $h1 192.0.2.2
ping6_test $h1 2001:db8:1::2
learning_test "br0" $swp1 $h1 $h2
flood_test $swp2 $h1 $h2
tests_run

exit $EXIT_STATUS
+22 −4
Original line number Diff line number Diff line
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding"
NUM_NETIFS=4
source lib.sh

@@ -73,14 +74,31 @@ cleanup()
	vrf_cleanup
}

ping_ipv4()
{
	ping_test $h1 192.0.2.2
}

ping_ipv6()
{
	ping6_test $h1 2001:db8:1::2
}

learning()
{
	learning_test "br0" $swp1 $h1 $h2
}

flooding()
{
	flood_test $swp2 $h1 $h2
}

trap cleanup EXIT

setup_prepare
setup_wait

ping_test $h1 192.0.2.2
ping6_test $h1 2001:db8:1::2
learning_test "br0" $swp1 $h1 $h2
flood_test $swp2 $h1 $h2
tests_run

exit $EXIT_STATUS
+9 −0
Original line number Diff line number Diff line
@@ -477,6 +477,15 @@ matchall_sink_create()
	   action drop
}

tests_run()
{
	local current_test

	for current_test in ${TESTS:-$ALL_TESTS}; do
		$current_test
	done
}

##############################################################################
# Tests

+29 −7
Original line number Diff line number Diff line
@@ -10,6 +10,14 @@
# traffic. Test that the payload is what is expected (ICMP ping request or
# reply, depending on test).

ALL_TESTS="
	test_gretap
	test_ip6gretap
	test_gretap_mac
	test_ip6gretap_mac
	test_two_spans
"

NUM_NETIFS=6
source lib.sh
source mirror_lib.sh
@@ -100,22 +108,36 @@ test_two_spans()
	log_test "two simultaneously configured mirrors ($tcflags)"
}

test_all()
test_gretap()
{
	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
	full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
	full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
}

test_ip6gretap()
{
	full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
	full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
}

test_gretap_mac()
{
	test_span_gre_mac gt4 ingress ip "mirror to gretap"
	test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
	test_span_gre_mac gt4 egress ip "mirror to gretap"
}

test_ip6gretap_mac()
{
	test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
	test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap"
}

	test_two_spans
test_all()
{
	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	tests_run

	slow_path_trap_uninstall $swp1 egress
	slow_path_trap_uninstall $swp1 ingress
+18 −5
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@
# underlay manner, i.e. with a bound dummy device that marks underlay VRF where
# the encapsulated packed should be routed.

ALL_TESTS="
	test_gretap
	test_ip6gretap
"

NUM_NETIFS=6
source lib.sh
source mirror_lib.sh
@@ -178,6 +183,18 @@ cleanup()
	vrf_cleanup
}

test_gretap()
{
	full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap w/ UL"
	full_test_span_gre_dir gt4 egress  0 8 "mirror to gretap w/ UL"
}

test_ip6gretap()
{
	full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap w/ UL"
	full_test_span_gre_dir gt6 egress  0 8 "mirror to ip6gretap w/ UL"
}

test_all()
{
	RET=0
@@ -185,11 +202,7 @@ test_all()
	slow_path_trap_install $swp1 ingress
	slow_path_trap_install $swp1 egress

	full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap w/ UL"
	full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap w/ UL"

	full_test_span_gre_dir gt4 egress  0 8 "mirror to gretap w/ UL"
	full_test_span_gre_dir gt6 egress  0 8 "mirror to ip6gretap w/ UL"
	tests_run

	slow_path_trap_uninstall $swp1 egress
	slow_path_trap_uninstall $swp1 ingress
Loading