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

selftests/net: Find nettest in current directory

The `nettest` binary, built from `selftests/net/nettest.c`,
was expected to be found in the path during test execution of
`fcnal-test.sh` and `pmtu.sh`, leading to tests getting
skipped when the binary is not installed in the system, as can
be seen in these logs found in the wild [1]:

# TEST: vti4: PMTU exceptions [SKIP]
[ 350.600250] IPv6: ADDRCONF(NETDEV_CHANGE): veth_b: link becomes ready
[ 350.607421] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready
# 'nettest' command not found; skipping tests
# xfrm6udp not supported
# TEST: vti6: PMTU exceptions (ESP-in-UDP) [SKIP]
[ 351.605102] IPv6: ADDRCONF(NETDEV_CHANGE): veth_b: link becomes ready
[ 351.612243] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready
# 'nettest' command not found; skipping tests
# xfrm4udp not supported

The `unicast_extensions.sh` tests also rely on `nettest`, but
it runs fine there because it looks for the binary in the
current working directory [2]:

The same mechanism that works for the Unicast extensions tests
is here copied over to the PMTU and functional tests.

[1] https://lkft.validation.linaro.org/scheduler/job/5839508#L6221
[2] https://lkft.validation.linaro.org/scheduler/job/5839508#L7958

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Daniel Díaz and committed by
David S. Miller
bd5e1e42 2158cfb0

+13 -8
+7 -4
tools/testing/selftests/net/fcnal-test.sh
··· 4196 4196 TESTS="$TESTS_IPV6" 4197 4197 fi 4198 4198 4199 - which nettest >/dev/null 4200 - if [ $? -ne 0 ]; then 4201 - echo "'nettest' command not found; skipping tests" 4202 - exit $ksft_skip 4199 + # nettest can be run from PATH or from same directory as this selftest 4200 + if ! which nettest >/dev/null; then 4201 + PATH=$PWD:$PATH 4202 + if ! which nettest >/dev/null; then 4203 + echo "'nettest' command not found; skipping tests" 4204 + exit $ksft_skip 4205 + fi 4203 4206 fi 4204 4207 4205 4208 declare -i nfail=0
+6 -4
tools/testing/selftests/net/pmtu.sh
··· 686 686 } 687 687 688 688 setup_nettest_xfrm() { 689 - which nettest >/dev/null 690 - if [ $? -ne 0 ]; then 691 - echo "'nettest' command not found; skipping tests" 692 - return 1 689 + if ! which nettest >/dev/null; then 690 + PATH=$PWD:$PATH 691 + if ! which nettest >/dev/null; then 692 + echo "'nettest' command not found; skipping tests" 693 + return 1 694 + fi 693 695 fi 694 696 695 697 [ ${1} -eq 6 ] && proto="-6" || proto=""