selftests: wireguard: avoid extglob in netns CPU count
Subsystems (4)
PATCH 1/1 selftests: wireguard: avoid extglob in netns CPU count
netns.sh enables extglob before using cpu+([0-9]) to count CPUs, but bash -n parses the whole script without executing that shopt command. This makes syntax checks fail even though the script is intended for bash.
Use the ordinary cpu[0-9]* glob instead. It matches the same CPU directory names without requiring extglob, and lets bash validate the script syntax.
Signed-off-by Yousef Alhouseen <[email protected]>
--- tools/testing/selftests/wireguard/netns.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/wireguard/netns.sh +1 -2
@@ -22,12 +22,11 @@ # interfaces in $ns1 and $ns2. See https://www.wireguard.com/netns/ for further # details on how this is accomplished. set -e -shopt -s extglob exec 3>&1 export LANG=C export WG_HIDE_KEYS=never -NPROC=( /sys/devices/system/cpu/cpu+([0-9]) ); NPROC=${#NPROC[@]} +NPROC=( /sys/devices/system/cpu/cpu[0-9]* ); NPROC=${#NPROC[@]} netns0="wg-test-$$-0" netns1="wg-test-$$-1" netns2="wg-test-$$-2"
Signature · 1 line
2.54.0