Skip to content

Commit 0fd158b

Browse files
Andrea Righidavem330
authored andcommitted
selftests: net: veth: make test compatible with dash
veth.sh is a shell script that uses /bin/sh; some distro (Ubuntu for example) use dash as /bin/sh and in this case the test reports the following error: # ./veth.sh: 21: local: -r: bad variable name # ./veth.sh: 21: local: -r: bad variable name This happens because dash doesn't support the option "-r" with local. Moreover, in case of missing bpf object, the script is exiting -1, that is an illegal number for dash: exit: Illegal number: -1 Change the script to be compatible both with bash and dash and prevent the errors above. Signed-off-by: Andrea Righi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1d2ac20 commit 0fd158b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/testing/selftests/net/veth.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ ret=0
1818

1919
cleanup() {
2020
local ns
21-
local -r jobs="$(jobs -p)"
21+
local jobs
22+
readonly jobs="$(jobs -p)"
2223
[ -n "${jobs}" ] && kill -1 ${jobs} 2>/dev/null
2324
rm -f $STATS
2425

@@ -108,7 +109,7 @@ chk_gro() {
108109

109110
if [ ! -f ../bpf/xdp_dummy.o ]; then
110111
echo "Missing xdp_dummy helper. Build bpf selftest first"
111-
exit -1
112+
exit 1
112113
fi
113114

114115
create_ns

0 commit comments

Comments
 (0)