]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: forwarding: lib: Split setup_wait()
authorPetr Machata <petrm@nvidia.com>
Wed, 25 Jun 2025 10:41:23 +0000 (12:41 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Jun 2025 00:53:07 +0000 (17:53 -0700)
setup_wait() takes an optional argument and then is called from the top
level of the test script. That confuses shellcheck, which thinks that maybe
the intention is to pass $1 of the script to the function, which is never
the case. To avoid having to annotate every single new test with a SC
disable, split the function in two: one that takes a mandatory argument,
and one that takes no argument at all.

Convert the two existing users of that optional argument, both in Spectrum
resource selftest, to use the new form. Clean up vxlan_bridge_1q_mc_ul.sh
to not pass a now-unused argument.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/8e13123236fe3912ae29bc04a1528bdd8551da1f.1750847794.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/mlxsw/spectrum-2/resource_scale.sh
tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh

index 899b6892603fd0ea17ad2d18f50c902b4d9249b4..d7505b933aef43a7473ef96f10631381c35f1a76 100755 (executable)
@@ -51,7 +51,7 @@ for current_test in ${TESTS:-$ALL_TESTS}; do
                fi
 
                ${current_test}_setup_prepare
-               setup_wait $num_netifs
+               setup_wait_n $num_netifs
                # Update target in case occupancy of a certain resource changed
                # following the test setup.
                target=$(${current_test}_get_target "$should_fail")
index 482ebb744ebad8a75635eb103a5123c11fdb7b17..7b98cdd0580d0636bba7093b442df67d62eae6b7 100755 (executable)
@@ -55,7 +55,7 @@ for current_test in ${TESTS:-$ALL_TESTS}; do
                                continue
                        fi
                        ${current_test}_setup_prepare
-                       setup_wait $num_netifs
+                       setup_wait_n $num_netifs
                        # Update target in case occupancy of a certain resource
                        # changed following the test setup.
                        target=$(${current_test}_get_target "$should_fail")
index 83ee6a07e07206f64803feb5e94a558d46582a9d..9308b2f77fedd781a92fb52bf4b6a6dec5fb6134 100644 (file)
@@ -526,9 +526,9 @@ setup_wait_dev_with_timeout()
        return 1
 }
 
-setup_wait()
+setup_wait_n()
 {
-       local num_netifs=${1:-$NUM_NETIFS}
+       local num_netifs=$1; shift
        local i
 
        for ((i = 1; i <= num_netifs; ++i)); do
@@ -539,6 +539,11 @@ setup_wait()
        sleep $WAIT_TIME
 }
 
+setup_wait()
+{
+       setup_wait_n "$NUM_NETIFS"
+}
+
 wait_for_dev()
 {
         local dev=$1; shift
index 7ec58b6b1128becb24414cda758012967930d8d6..462db0b603e786f011727a8e6b46e30bc18cc306 100755 (executable)
@@ -765,7 +765,7 @@ ipv6_mcroute_fdb_sep_rx()
 trap cleanup EXIT
 
 setup_prepare
-setup_wait "$NUM_NETIFS"
+setup_wait
 tests_run
 
 exit "$EXIT_STATUS"