]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: net: add helper for checking if nettest is available
authorJakub Kicinski <kuba@kernel.org>
Wed, 21 Aug 2024 01:22:27 +0000 (18:22 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 22 Aug 2024 10:55:47 +0000 (12:55 +0200)
commitbcc3773c49af2426093645473fe02a5a8e765587
tree9881aa18945e11ee7ea8af8d6320a81c7e43c529
parent001b98c9897352e914c71d8ffbfa9b79a6e12c3c
selftests: net: add helper for checking if nettest is available

A few tests check if nettest exists in the $PATH before adding
$PWD to $PATH and re-checking. They don't discard stderr on
the first check (and nettest is built as part of selftests,
so it's pretty normal for it to not be available in system $PATH).
This leads to output noise:

  which: no nettest in (/home/virtme/tools/fs/bin:/home/virtme/tools/fs/sbin:/home/virtme/tools/fs/usr/bin:/home/virtme/tools/fs/usr/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin)

Add a common helper for the check which does silence stderr.

There is another small functional change hiding here, because pmtu.sh
and fib_rule_tests.sh used to return from the test case rather than
completely exit. Building nettest is not hard, there should be no need
to maintain the ability to selectively skip cases in its absence.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20240821012227.1398769-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/fcnal-test.sh
tools/testing/selftests/net/fib_rule_tests.sh
tools/testing/selftests/net/lib.sh
tools/testing/selftests/net/pmtu.sh
tools/testing/selftests/net/unicast_extensions.sh
tools/testing/selftests/net/vrf_route_leaking.sh