selftests: fib_rule_tests: Clarify test results
authorIdo Schimmel <idosch@nvidia.com>
Wed, 14 Aug 2024 11:10:02 +0000 (14:10 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 16 Aug 2024 18:04:51 +0000 (11:04 -0700)
Clarify the test results by grouping the output of test cases belonging
to the same test under a common title. This is consistent with the
output of fib_tests.sh.

Before:

 # ./fib_rule_tests.sh

     TEST: rule6 check: oif redirect to table                            [ OK ]

     TEST: rule6 del by pref: oif redirect to table                      [ OK ]
 [...]
     TEST: rule4 check: oif redirect to table                            [ OK ]

     TEST: rule4 del by pref: oif redirect to table                      [ OK ]
 [...]

 Tests passed: 116
 Tests failed:   0

After:

 # ./fib_rule_tests.sh

 IPv6 FIB rule tests
     TEST: rule6 check: oif redirect to table                            [ OK ]
     TEST: rule6 del by pref: oif redirect to table                      [ OK ]
 [...]

 IPv4 FIB rule tests
     TEST: rule4 check: oif redirect to table                            [ OK ]
     TEST: rule4 del by pref: oif redirect to table                      [ OK ]
 [...]

 Tests passed: 116
 Tests failed:   0

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20240814111005.955359-3-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/fib_rule_tests.sh

index c821d91..9100dd4 100755 (executable)
@@ -35,18 +35,13 @@ log_test()
        local expected=$2
        local msg="$3"
 
-       $IP rule show | grep -q l3mdev
-       if [ $? -eq 0 ]; then
-               msg="$msg (VRF)"
-       fi
-
        if [ ${rc} -eq ${expected} ]; then
                nsuccess=$((nsuccess+1))
-               printf "\n    TEST: %-60s  [ OK ]\n" "${msg}"
+               printf "    TEST: %-60s  [ OK ]\n" "${msg}"
        else
                ret=1
                nfail=$((nfail+1))
-               printf "\n    TEST: %-60s  [FAIL]\n" "${msg}"
+               printf "    TEST: %-60s  [FAIL]\n" "${msg}"
                if [ "${PAUSE_ON_FAIL}" = "yes" ]; then
                        echo
                        echo "hit enter to continue, 'q' to quit"
@@ -205,10 +200,14 @@ fib_rule6_test_reject()
 
 fib_rule6_test()
 {
+       local ext_name=$1; shift
        local getmatch
        local match
        local cnt
 
+       echo
+       echo "IPv6 FIB rule tests $ext_name"
+
        # setup the fib rule redirect route
        $IP -6 route add table $RTABLE default via $GW_IP6 dev $DEV onlink
 
@@ -267,7 +266,7 @@ fib_rule6_test()
 fib_rule6_vrf_test()
 {
        setup_vrf
-       fib_rule6_test
+       fib_rule6_test "- with VRF"
        cleanup_vrf
 }
 
@@ -277,6 +276,9 @@ fib_rule6_connect_test()
 {
        local dsfield
 
+       echo
+       echo "IPv6 FIB rule connect tests"
+
        if ! check_nettest; then
                echo "SKIP: Could not run test without nettest tool"
                return
@@ -344,10 +346,14 @@ fib_rule4_test_reject()
 
 fib_rule4_test()
 {
+       local ext_name=$1; shift
        local getmatch
        local match
        local cnt
 
+       echo
+       echo "IPv4 FIB rule tests $ext_name"
+
        # setup the fib rule redirect route
        $IP route add table $RTABLE default via $GW_IP4 dev $DEV onlink
 
@@ -411,7 +417,7 @@ fib_rule4_test()
 fib_rule4_vrf_test()
 {
        setup_vrf
-       fib_rule4_test
+       fib_rule4_test "- with VRF"
        cleanup_vrf
 }
 
@@ -421,6 +427,9 @@ fib_rule4_connect_test()
 {
        local dsfield
 
+       echo
+       echo "IPv4 FIB rule connect tests"
+
        if ! check_nettest; then
                echo "SKIP: Could not run test without nettest tool"
                return