Commit fa61e9ae authored by Petr Machata's avatar Petr Machata Committed by Jakub Kicinski

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: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarBenjamin Poirier <bpoirier@nvidia.com>
Link: https://lore.kernel.org/r/1890ddc58420c2c0d5ba3154c87ecc6d9faf6947.1711464583.git.petrm@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5e47fbe5
...@@ -5,30 +5,30 @@ ...@@ -5,30 +5,30 @@
# Defines # Defines
# Can be overridden by the configuration file. # Can be overridden by the configuration file.
PING=${PING:=ping} : "${PING:=ping}"
PING6=${PING6:=ping6} : "${PING6:=ping6}"
MZ=${MZ:=mausezahn} : "${MZ:=mausezahn}"
MZ_DELAY=${MZ_DELAY:=0} : "${MZ_DELAY:=0}"
ARPING=${ARPING:=arping} : "${ARPING:=arping}"
TEAMD=${TEAMD:=teamd} : "${TEAMD:=teamd}"
WAIT_TIME=${WAIT_TIME:=5} : "${WAIT_TIME:=5}"
PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no} : "${PAUSE_ON_FAIL:=no}"
PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no} : "${PAUSE_ON_CLEANUP:=no}"
NETIF_TYPE=${NETIF_TYPE:=veth} : "${NETIF_TYPE:=veth}"
NETIF_CREATE=${NETIF_CREATE:=yes} : "${NETIF_CREATE:=yes}"
MCD=${MCD:=smcrouted} : "${MCD:=smcrouted}"
MC_CLI=${MC_CLI:=smcroutectl} : "${MC_CLI:=smcroutectl}"
PING_COUNT=${PING_COUNT:=10} : "${PING_COUNT:=10}"
PING_TIMEOUT=${PING_TIMEOUT:=5} : "${PING_TIMEOUT:=5}"
WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} : "${WAIT_TIMEOUT:=20}"
INTERFACE_TIMEOUT=${INTERFACE_TIMEOUT:=600} : "${INTERFACE_TIMEOUT:=600}"
LOW_AGEING_TIME=${LOW_AGEING_TIME:=1000} : "${LOW_AGEING_TIME:=1000}"
REQUIRE_JQ=${REQUIRE_JQ:=yes} : "${REQUIRE_JQ:=yes}"
REQUIRE_MZ=${REQUIRE_MZ:=yes} : "${REQUIRE_MZ:=yes}"
REQUIRE_MTOOLS=${REQUIRE_MTOOLS:=no} : "${REQUIRE_MTOOLS:=no}"
STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no} : "${STABLE_MAC_ADDRS:=no}"
TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=} : "${TCPDUMP_EXTRA_FLAGS:=}"
TROUTE6=${TROUTE6:=traceroute6} : "${TROUTE6:=traceroute6}"
net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
CHECK_TC="yes" CHECK_TC="yes"
# Can be overridden by the configuration file. See lib.sh # Can be overridden by the configuration file. See lib.sh
TC_HIT_TIMEOUT=${TC_HIT_TIMEOUT:=1000} # ms : "${TC_HIT_TIMEOUT:=1000}" # ms
tc_check_packets() tc_check_packets()
{ {
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
############################################################################## ##############################################################################
# Defines # Defines
WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} : "${WAIT_TIMEOUT:=20}"
BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms
# Kselftest framework requirement - SKIP code is 4. # Kselftest framework requirement - SKIP code is 4.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment