kselftest

The Linux kernel contains a set of developer unit and regression tests (Kselftests) in the Kernel sources under tools/testing/selftests directory.It is used to verify the correctness and stability of various kernel subsystems.

What It Tests

  • Functional Behavior of Core Kernel Components: Check subsystems alsa, fs, sched, net and so on functionality

Preconditions

  • The below packages are installed

    • sed perl wget xz-utils iproute2 python3-tap libasound2 socat jq

    • iptables fuse libkeepalive0 linux-cpupower iperf3 ipvsadm ethtool

    • conntrack netcat-openbsd python3-scapy libteam-utils dosfstools bc

    • iputils-clockdiff iputils-tracepath dnsmasq telnet traceroute file

    • wireguard bsdmainutils tcpdump dhcpd host nfs-server rpcbind quota

    • gdb unzip uuid-runtime psmisc libnuma1 netsniff-ng iputils-arping

    • smcroute kselftests

  • System requires root privileges

Test Parameters

Parameter

Default

Description

TST_CMDFILES

""

List of tests to run

TST_CASENAME

""

Single test case to run

TESTPROG

"kselftest_armhf.tar.gz"

Specify Linux kernel self test pre-build tarball name

SKIP_INSTALL

"false"

Skip package installation

SKIPLIST

""

List of known unsupported test cases to be skipped

TESTPROG_URL

""

Specify Linux kernel self test pre-build tarball full url发

KSELFTEST_PATH

"/usr/local/kselftests/"

Specify Linux kernel self test path after installation

SKIPFILE

""

kernel self test skip file

BOARD

""

Match board name with a list of board names in skipfile

BRANCH

"false"

Match branch name with a list of branch names in skipfile

ENVIRONMENT

"false"

Match environment name with a list of environment names in skipfile

SHARD_NUMBER

1

Number of shards that will be done

SHARD_INDEX

1

Which bucket to run

Test Steps

- cd ./automated/linux/kselftest
- ./kselftest.sh -c "${TST_CMDFILES}" -T "${TST_CASENAME}" -t "${TESTPROG}" -s "${SKIP_INSTALL}" -u "${TESTPROG_URL}" -L "${SKIPLIST}" -S "${SKIPFILE}" -b "${BOARD}" -g "${BRANCH}" -e "${ENVIRONMENT}" -p "${KSELFTEST_PATH}" -n "${SHARD_NUMBER}" -i "${SHARD_INDEX}"

Refer to kselftest.yaml for complete test definition and execution details.

Expected Results

  • The sub test cases in the different sub system pass

References