summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_xdp_meta.sh
diff options
context:
space:
mode:
authorPo-Hsu Lin <po-hsu.lin@canonical.com>2021-09-29 13:12:50 +0800
committerDaniel Borkmann <daniel@iogearbox.net>2021-09-30 23:09:17 +0200
commitd4b6f87e8d3929d3d1594fca0256299113301fd7 (patch)
tree51f13bd5cd3d8568c5445d5e85f41c7345cd836e /tools/testing/selftests/bpf/test_xdp_meta.sh
parente68ac0082787f4e8ee6ae5b19076ec7709ce715b (diff)
downloadlinux-d4b6f87e8d3929d3d1594fca0256299113301fd7.tar.bz2
selftests/bpf: Use kselftest skip code for skipped tests
There are several test cases in the bpf directory are still using exit 0 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 bpf directory: grep -r "exit 0" -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> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20210929051250.13831-1-po-hsu.lin@canonical.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_xdp_meta.sh')
-rwxr-xr-xtools/testing/selftests/bpf/test_xdp_meta.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_xdp_meta.sh b/tools/testing/selftests/bpf/test_xdp_meta.sh
index 637fcf4fe4e3..d10cefd6eb09 100755
--- a/tools/testing/selftests/bpf/test_xdp_meta.sh
+++ b/tools/testing/selftests/bpf/test_xdp_meta.sh
@@ -1,5 +1,8 @@
#!/bin/sh
+# Kselftest framework requirement - SKIP code is 4.
+readonly KSFT_SKIP=4
+
cleanup()
{
if [ "$?" = "0" ]; then
@@ -17,7 +20,7 @@ cleanup()
ip link set dev lo xdp off 2>/dev/null > /dev/null
if [ $? -ne 0 ];then
echo "selftests: [SKIP] Could not run test without the ip xdp support"
- exit 0
+ exit $KSFT_SKIP
fi
set -e