Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: libs: Change variable fallback syntax

The current syntax of X=${X:=X} first evaluates the ${X:=Y} expression,
which either uses the existing value of $X if there is one, or uses the
value of "Y" as a fallback, and assigns it to X. The expression is then
replaced with the now-current value of $X. Assigning that value to X once
more is meaningless.

So avoid the outer X=... bit, and instead express the same idea though the
do-nothing ":" built-in as : "${X:=Y}". This also cleans up the block
nicely and makes it more readable.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Benjamin Poirier <bpoirier@nvidia.com>
Link: https://lore.kernel.org/r/1890ddc58420c2c0d5ba3154c87ecc6d9faf6947.1711464583.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Petr Machata and committed by
Jakub Kicinski
fa61e9ae 5e47fbe5

+27 -26
+24 -24
tools/testing/selftests/net/forwarding/lib.sh
··· 5 5 # Defines 6 6 7 7 # Can be overridden by the configuration file. 8 - PING=${PING:=ping} 9 - PING6=${PING6:=ping6} 10 - MZ=${MZ:=mausezahn} 11 - MZ_DELAY=${MZ_DELAY:=0} 12 - ARPING=${ARPING:=arping} 13 - TEAMD=${TEAMD:=teamd} 14 - WAIT_TIME=${WAIT_TIME:=5} 15 - PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no} 16 - PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no} 17 - NETIF_TYPE=${NETIF_TYPE:=veth} 18 - NETIF_CREATE=${NETIF_CREATE:=yes} 19 - MCD=${MCD:=smcrouted} 20 - MC_CLI=${MC_CLI:=smcroutectl} 21 - PING_COUNT=${PING_COUNT:=10} 22 - PING_TIMEOUT=${PING_TIMEOUT:=5} 23 - WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} 24 - INTERFACE_TIMEOUT=${INTERFACE_TIMEOUT:=600} 25 - LOW_AGEING_TIME=${LOW_AGEING_TIME:=1000} 26 - REQUIRE_JQ=${REQUIRE_JQ:=yes} 27 - REQUIRE_MZ=${REQUIRE_MZ:=yes} 28 - REQUIRE_MTOOLS=${REQUIRE_MTOOLS:=no} 29 - STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no} 30 - TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=} 31 - TROUTE6=${TROUTE6:=traceroute6} 8 + : "${PING:=ping}" 9 + : "${PING6:=ping6}" 10 + : "${MZ:=mausezahn}" 11 + : "${MZ_DELAY:=0}" 12 + : "${ARPING:=arping}" 13 + : "${TEAMD:=teamd}" 14 + : "${WAIT_TIME:=5}" 15 + : "${PAUSE_ON_FAIL:=no}" 16 + : "${PAUSE_ON_CLEANUP:=no}" 17 + : "${NETIF_TYPE:=veth}" 18 + : "${NETIF_CREATE:=yes}" 19 + : "${MCD:=smcrouted}" 20 + : "${MC_CLI:=smcroutectl}" 21 + : "${PING_COUNT:=10}" 22 + : "${PING_TIMEOUT:=5}" 23 + : "${WAIT_TIMEOUT:=20}" 24 + : "${INTERFACE_TIMEOUT:=600}" 25 + : "${LOW_AGEING_TIME:=1000}" 26 + : "${REQUIRE_JQ:=yes}" 27 + : "${REQUIRE_MZ:=yes}" 28 + : "${REQUIRE_MTOOLS:=no}" 29 + : "${STABLE_MAC_ADDRS:=no}" 30 + : "${TCPDUMP_EXTRA_FLAGS:=}" 31 + : "${TROUTE6:=traceroute6}" 32 32 33 33 net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") 34 34
+1 -1
tools/testing/selftests/net/forwarding/tc_common.sh
··· 4 4 CHECK_TC="yes" 5 5 6 6 # Can be overridden by the configuration file. See lib.sh 7 - TC_HIT_TIMEOUT=${TC_HIT_TIMEOUT:=1000} # ms 7 + : "${TC_HIT_TIMEOUT:=1000}" # ms 8 8 9 9 tc_check_packets() 10 10 {
+2 -1
tools/testing/selftests/net/lib.sh
··· 4 4 ############################################################################## 5 5 # Defines 6 6 7 - WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} 7 + : "${WAIT_TIMEOUT:=20}" 8 + 8 9 BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms 9 10 10 11 # Kselftest framework requirement - SKIP code is 4.