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

Petr Machata petrm at mellanox.com
Tue Apr 24 20:03:17 AEST 2018


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 \

One could also simply do this, but then listing the test in TESTS would
lead to it being executed even in SW-only scenarios.

	tcflags="skip_sw"
        ALL_TESTS="$ALL_TESTS gact_trap_test"
	tests_run

Petr


More information about the Linux-mlxsw mailing list