linux-yocto/tools/testing/selftests/net/run_afpackettests
Po-Hsu Lin 7844ec21a9 selftests/net: Use kselftest skip code for skipped tests
There are several test cases in the net directory are still using
exit 0 or exit 1 when they need to be skipped. Use kselftest
framework skip code instead so it can help us to distinguish the
return status.

Criterion to filter out what should be fixed in net directory:
  grep -r "exit [01]" -B1 | grep -i skip

This change might cause some false-positives if people are running
these test scripts directly and only checking their return codes,
which will change from 0 to 4. However I think the impact should be
small as most of our scripts here are already using this skip code.
And there will be no such issue if running them with the kselftest
framework.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20210823085854.40216-1-po-hsu.lin@canonical.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-08-24 16:49:09 -07:00

866 B
Executable File

#!/bin/sh

SPDX-License-Identifier: GPL-2.0

Kselftest framework requirement - SKIP code is 4.

ksft_skip=4

if [ $(id -u) != 0 ]; then echo $msg must be run as root >&2 exit $ksft_skip fi

ret=0 echo "--------------------" echo "running psock_fanout test" echo "--------------------" ./in_netns.sh ./psock_fanout if [ $? -ne 0 ]; then echo "[FAIL]" ret=1 else echo "[PASS]" fi

echo "--------------------" echo "running psock_tpacket test" echo "--------------------" if [ -f /proc/kallsyms ]; then ./in_netns.sh ./psock_tpacket if [ $? -ne 0 ]; then echo "[FAIL]" ret=1 else echo "[PASS]" fi else echo "[SKIP] CONFIG_KALLSYMS not enabled" fi

echo "--------------------" echo "running txring_overwrite test" echo "--------------------" ./in_netns.sh ./txring_overwrite if [ $? -ne 0 ]; then echo "[FAIL]" ret=1 else echo "[PASS]" fi exit $ret