Skip to content

selftests: Use kselftest skip code for skipped tests #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
sudo: required
language: bash
dist: focal
services:
- docker
git:
depth: 3

env:
global:
- PROJECT_NAME='libbpf'
- AUTHOR_EMAIL="$(git log -1 --pretty=\"%aE\")"
- REPO_ROOT="$TRAVIS_BUILD_DIR"
- CI_ROOT="$REPO_ROOT/travis-ci"
- VMTEST_ROOT="$CI_ROOT/vmtest"

addons:
apt:
packages:
- qemu-kvm
- zstd
- binutils-dev
- elfutils
- libcap-dev
- libelf-dev
- libdw-dev
- python3-docutils

jobs:
include:
- stage: Builds & Tests
name: Kernel LATEST + selftests
language: bash
env: KERNEL=LATEST
script: $CI_ROOT/vmtest/run_vmtest.sh || travis_terminate 1
18 changes: 0 additions & 18 deletions README
Original file line number Diff line number Diff line change
@@ -1,18 +0,0 @@
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``. The formatted documentation can also be read online at:

https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
5 changes: 4 additions & 1 deletion tools/testing/selftests/bpf/test_bpftool_build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

case $1 in
-h|--help)
echo -e "$0 [-j <n>]"
Expand All @@ -22,7 +25,7 @@ KDIR_ROOT_DIR=$(realpath $PWD/$SCRIPT_REL_DIR/../../../../)
cd $KDIR_ROOT_DIR
if [ ! -e tools/bpf/bpftool/Makefile ]; then
echo -e "skip: bpftool files not found!\n"
exit 0
exit $ksft_skip
fi

ERROR=0
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/bpf/test_xdp_meta.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

cleanup()
{
if [ "$?" = "0" ]; then
Expand All @@ -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

Expand Down
7 changes: 5 additions & 2 deletions tools/testing/selftests/bpf/test_xdp_vlan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# SPDX-License-Identifier: GPL-2.0
# Author: Jesper Dangaard Brouer <[email protected]>

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

# Allow wrapper scripts to name test
if [ -z "$TESTNAME" ]; then
TESTNAME=xdp_vlan
Expand Down Expand Up @@ -94,7 +97,7 @@ while true; do
-h | --help )
usage;
echo "selftests: $TESTNAME [SKIP] usage help info requested"
exit 0
exit $ksft_skip
;;
* )
shift
Expand All @@ -117,7 +120,7 @@ fi
ip link set dev lo xdpgeneric off 2>/dev/null > /dev/null
if [ $? -ne 0 ]; then
echo "selftests: $TESTNAME [SKIP] need ip xdp support"
exit 0
exit $ksft_skip
fi

# Interactive mode likely require us to cleanup netns
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/net/fcnal-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#
# server / client nomenclature relative to ns-A

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

VERBOSE=0

NSA_DEV=eth1
Expand Down Expand Up @@ -3946,7 +3949,7 @@ fi
which nettest >/dev/null
if [ $? -ne 0 ]; then
echo "'nettest' command not found; skipping tests"
exit 0
exit $ksft_skip
fi

declare -i nfail=0
Expand Down
7 changes: 5 additions & 2 deletions tools/testing/selftests/net/fib_rule_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# This test is for checking IPv4 and IPv6 FIB rules API

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

ret=0

PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
Expand Down Expand Up @@ -238,12 +241,12 @@ run_fibrule_tests()

if [ "$(id -u)" -ne 0 ];then
echo "SKIP: Need root privileges"
exit 0
exit $ksft_skip
fi

if [ ! -x "$(command -v ip)" ]; then
echo "SKIP: Could not run test without ip tool"
exit 0
exit $ksft_skip
fi

# start clean
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
##############################################################################
# Defines

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

# Can be overridden by the configuration file.
PING=${PING:=ping}
PING6=${PING6:=ping6}
Expand Down Expand Up @@ -121,7 +124,7 @@ check_ethtool_lanes_support()

if [[ "$(id -u)" -ne 0 ]]; then
echo "SKIP: need root privileges"
exit 0
exit $ksft_skip
fi

if [[ "$CHECK_TC" = "yes" ]]; then
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/net/forwarding/router_mpath_nh.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

ALL_TESTS="
ping_ipv4
ping_ipv6
Expand Down Expand Up @@ -411,7 +414,7 @@ ping_ipv6()
ip nexthop ls >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Nexthop objects not supported; skipping tests"
exit 0
exit $ksft_skip
fi

trap cleanup EXIT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

ALL_TESTS="
ping_ipv4
ping_ipv6
Expand Down Expand Up @@ -386,7 +389,7 @@ ping_ipv6()
ip nexthop ls >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Nexthop objects not supported; skipping tests"
exit 0
exit $ksft_skip
fi

trap cleanup EXIT
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/net/run_afpackettests
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/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 0
exit $ksft_skip
fi

ret=0
Expand Down
9 changes: 6 additions & 3 deletions tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@
# +---------------------------------------------------+
#

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

readonly LOCALSID_TABLE_ID=90
readonly IPv6_RT_NETWORK=fd00
readonly IPv4_HS_NETWORK=10.0.0
Expand Down Expand Up @@ -464,18 +467,18 @@ host_vpn_isolation_tests()

if [ "$(id -u)" -ne 0 ];then
echo "SKIP: Need root privileges"
exit 0
exit $ksft_skip
fi

if [ ! -x "$(command -v ip)" ]; then
echo "SKIP: Could not run test without ip tool"
exit 0
exit $ksft_skip
fi

modprobe vrf &>/dev/null
if [ ! -e /proc/sys/net/vrf/strict_mode ]; then
echo "SKIP: vrf sysctl does not exist"
exit 0
exit $ksft_skip
fi

cleanup &>/dev/null
Expand Down
9 changes: 6 additions & 3 deletions tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@
# +---------------------------------------------------+
#

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

readonly LOCALSID_TABLE_ID=90
readonly IPv6_RT_NETWORK=fd00
readonly IPv6_HS_NETWORK=cafe
Expand Down Expand Up @@ -472,18 +475,18 @@ host_vpn_isolation_tests()

if [ "$(id -u)" -ne 0 ];then
echo "SKIP: Need root privileges"
exit 0
exit $ksft_skip
fi

if [ ! -x "$(command -v ip)" ]; then
echo "SKIP: Could not run test without ip tool"
exit 0
exit $ksft_skip
fi

modprobe vrf &>/dev/null
if [ ! -e /proc/sys/net/vrf/strict_mode ]; then
echo "SKIP: vrf sysctl does not exist"
exit 0
exit $ksft_skip
fi

cleanup &>/dev/null
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/net/unicast_extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
# These tests provide an easy way to flip the expected result of any
# of these behaviors for testing kernel patches that change them.

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

# nettest can be run from PATH or from same directory as this selftest
if ! which nettest >/dev/null; then
PATH=$PWD:$PATH
if ! which nettest >/dev/null; then
echo "'nettest' command not found; skipping tests"
exit 0
exit $ksft_skip
fi
fi

Expand Down
9 changes: 6 additions & 3 deletions tools/testing/selftests/net/vrf_strict_mode_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# This test is designed for testing the new VRF strict_mode functionality.

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

ret=0

# identifies the "init" network namespace which is often called root network
Expand Down Expand Up @@ -371,18 +374,18 @@ vrf_strict_mode_check_support()

if [ "$(id -u)" -ne 0 ];then
echo "SKIP: Need root privileges"
exit 0
exit $ksft_skip
fi

if [ ! -x "$(command -v ip)" ]; then
echo "SKIP: Could not run test without ip tool"
exit 0
exit $ksft_skip
fi

modprobe vrf &>/dev/null
if [ ! -e /proc/sys/net/vrf/strict_mode ]; then
echo "SKIP: vrf sysctl does not exist"
exit 0
exit $ksft_skip
fi

cleanup &> /dev/null
Expand Down
7 changes: 5 additions & 2 deletions tools/testing/selftests/ptp/phc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

ALL_TESTS="
settime
adjtime
Expand All @@ -13,12 +16,12 @@ DEV=$1

if [[ "$(id -u)" -ne 0 ]]; then
echo "SKIP: need root privileges"
exit 0
exit $ksft_skip
fi

if [[ "$DEV" == "" ]]; then
echo "SKIP: PTP device not provided"
exit 0
exit $ksft_skip
fi

require_command()
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/vm/charge_reserved_hugetlb.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

set -e

if [[ $(id -u) -ne 0 ]]; then
echo "This test must be run as root. Skipping..."
exit 0
exit $ksft_skip
fi

fault_limit_file=limit_in_bytes
Expand Down
Loading