]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
selftests: mlxsw: Return correct error code in resource scale tests
authorDanielle Ratson <danieller@nvidia.com>
Fri, 23 Apr 2021 12:19:46 +0000 (14:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Apr 2021 21:01:28 +0000 (14:01 -0700)
Currently, the resource scale test checks a few cases, when the error code
resets between the cases. So for example, if one case fails and the
consecutive case passes, the error code eventually will fit the last test
and will be 0.

Save a new return code that will hold the 'or' return codes of all the
cases, so the final return code will consider all the cases.

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/mlxsw/spectrum-2/resource_scale.sh
tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh

index 4a1c9328555ffc65b41033a6d339955b101855b1..50654f8a8c3739f4be0e54c2c3323d05f540bc0d 100755 (executable)
@@ -30,6 +30,7 @@ trap cleanup EXIT
 
 ALL_TESTS="router tc_flower mirror_gre tc_police port"
 for current_test in ${TESTS:-$ALL_TESTS}; do
+       RET_FIN=0
        source ${current_test}_scale.sh
 
        num_netifs_var=${current_test^^}_NUM_NETIFS
@@ -48,8 +49,9 @@ for current_test in ${TESTS:-$ALL_TESTS}; do
                else
                        log_test "'$current_test' overflow $target"
                fi
+               RET_FIN=$(( RET_FIN || RET ))
        done
 done
 current_test=""
 
-exit "$RET"
+exit "$RET_FIN"
index 087a884f66cdf1a10c007bd790076e4316834d24..685dfb3478b3ed9662d24f9558a535b283e2c6ed 100755 (executable)
@@ -24,6 +24,7 @@ trap cleanup EXIT
 
 ALL_TESTS="router tc_flower mirror_gre tc_police port"
 for current_test in ${TESTS:-$ALL_TESTS}; do
+       RET_FIN=0
        source ${current_test}_scale.sh
 
        num_netifs_var=${current_test^^}_NUM_NETIFS
@@ -50,8 +51,9 @@ for current_test in ${TESTS:-$ALL_TESTS}; do
                                log_test "'$current_test' [$profile] overflow $target"
                        fi
                done
+               RET_FIN=$(( RET_FIN || RET ))
        done
 done
 current_test=""
 
-exit "$RET"
+exit "$RET_FIN"