]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: net: veth: make test compatible with dash
authorAndrea Righi <andrea.righi@canonical.com>
Wed, 16 Jun 2021 14:03:21 +0000 (16:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Jun 2021 19:50:24 +0000 (12:50 -0700)
commit6641d327a01b8a7f34d7f44cdb1fe3ca305adc51
tree5b4e98dda4d59fbf1afb36d8f48928d6b6c2d759
parent5681c18e8854570ea8cb1f6e983732a83ae0ba2d
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 <andrea.righi@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/veth.sh