[PATCH net-next internal] selftests: forwarding: Allow running specific tests

Ido Schimmel idosch at mellanox.com
Tue Apr 24 20:47:20 AEST 2018


On Tue, Apr 24, 2018 at 01:03:17PM +0300, Petr Machata wrote:
> Petr Machata <petrm at mellanox.com> writes:
> 
> > Ido Schimmel <idosch at mellanox.com> writes:
> >
> >>  	tcflags="skip_sw"
> >> -	gact_drop_and_ok_test
> >> -	mirred_egress_test "redirect"
> >> -	mirred_egress_test "mirror"
> >>  	gact_trap_test
> >> +	tests_run
> >
> > I guess it's reasonable to assume that any ACL-capable ASIC will
> > actually be able to trap packets.
> 
> But wait, the test also assumes that redirect is supported. Maybe do
> this, and just add the test to ALL_TESTS?
> 
> diff --git a/tools/testing/selftests/net/forwarding/tc_actions.sh b/tools/testing/selftests/net/forwarding/tc_actions.sh
> index 3a6385e..7abd6e3 100755
> --- a/tools/testing/selftests/net/forwarding/tc_actions.sh
> +++ b/tools/testing/selftests/net/forwarding/tc_actions.sh
> @@ -111,6 +111,10 @@ gact_trap_test()
>  {
>  	RET=0
>  
> +	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
> +		return 0;
> +	fi
> +
>  	tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
>  		skip_hw dst_ip 192.0.2.2 action drop
>  	tc filter add dev $swp1 ingress protocol ip pref 3 handle 103 flower \

How about the below?

diff --git a/tools/testing/selftests/net/forwarding/tc_actions.sh b/tools/testing/selftests/net/forwarding/tc_actions.sh
index 9b4acaf35cfe..813d02d1939d 100755
--- a/tools/testing/selftests/net/forwarding/tc_actions.sh
+++ b/tools/testing/selftests/net/forwarding/tc_actions.sh
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 ALL_TESTS="gact_drop_and_ok_test mirred_egress_redirect_test \
-	mirred_egress_mirror_test"
+	mirred_egress_mirror_test gact_trap_test"
 NUM_NETIFS=4
 source tc_common.sh
 source lib.sh
@@ -113,6 +113,10 @@ gact_trap_test()
 {
 	RET=0
 
+	if [[ "$tcflags" != "skip_sw" ]]; then
+		return 0;
+	fi
+
 	tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
 		skip_hw dst_ip 192.0.2.2 action drop
 	tc filter add dev $swp1 ingress protocol ip pref 3 handle 103 flower \
@@ -203,7 +207,6 @@ if [[ $? -ne 0 ]]; then
 	log_info "Could not test offloaded functionality"
 else
 	tcflags="skip_sw"
-	gact_trap_test
 	tests_run
 fi


More information about the Linux-mlxsw mailing list