Linux Kernel Selftests
Kernel selftests are run in userspace for testing kernel functions. They may be useful for regression testing of new kernels. Since they are run in userspace, the corresponding kernel has to be running for tests.
Keep the previously built kernel config file
Get into kernel source directory:
cp previous_config .config make olddefconfig make kselftest-merge make menuconfig # setup if and as you want make -j 2 make modules modules_install install
Do necessary things for booting the new kernel. Reboot with new kernel.
Required software setup for selftests
Debian instructions for setup:
sudo apt-get install libmount-dev libcap-ng-dev libcap-dev libelf-dev libfuse-dev libpopt-dev
Note: Install libcap-dev if libcap-ng-dev is not available
Note: Install for subset net selftests follow next section
Debian instructions for setup: Install necessary softwares for kselftest:
sudo apt-get install libnuma-dev traceroute net-tools
Get into previously built kernel source directory and run:
make summary=1 TARGETS=net kselftest |& tee /tmp/kselftest_summary_net.log make TARGETS=net kselftest |& tee /tmp/kselftest_net.log
You may see the above log files for later need.
The kselftest target builds "nettest" executable binary. Copy it to PATH or make a symlink.
cp tools/testing/selftests/net/nettest /usr/local/bin
Rerun the selftest to pass some failing tests because of previously non-existant nettest binary.