]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - Documentation/kselftest.txt
netfilter: x_tables: pack percpu counter allocations
[mirror_ubuntu-artful-kernel.git] / Documentation / kselftest.txt
CommitLineData
80d03428
JK
1Linux Kernel Selftests
2
3The kernel contains a set of "self tests" under the tools/testing/selftests/
3409f9ab
AA
4directory. These are intended to be small tests to exercise individual code
5paths in the kernel. Tests are intended to be run after building, installing
6and booting a kernel.
80d03428 7
ddddda9b
SK
8On some systems, hot-plug tests could hang forever waiting for cpu and
9memory to be ready to be offlined. A special hot-plug target is created
10to run full range of hot-plug tests. In default mode, hot-plug tests run
11in safe mode with a limited scope. In limited mode, cpu-hotplug test is
12run on a single cpu as opposed to all hotplug capable cpus, and memory
13hotplug test is run on 2% of hotplug capable memory instead of 10%.
14
15Running the selftests (hotplug tests are run in limited mode)
16=============================================================
80d03428
JK
17
18To build the tests:
80d03428
JK
19 $ make -C tools/testing/selftests
20
21
22To run the tests:
80d03428
JK
23 $ make -C tools/testing/selftests run_tests
24
3c415707
TB
25To build and run the tests with a single command, use:
26 $ make kselftest
27
80d03428
JK
28- note that some tests will require root privileges.
29
80d03428 30
3c415707
TB
31Running a subset of selftests
32========================================
33You can use the "TARGETS" variable on the make command line to specify
34single test to run, or a list of tests to run.
35
36To run only tests targeted for a single subsystem:
37 $ make -C tools/testing/selftests TARGETS=ptrace run_tests
38
39You can specify multiple tests to build and run:
40 $ make TARGETS="size timers" kselftest
41
42See the top-level tools/testing/selftests/Makefile for the list of all
43possible targets.
80d03428 44
80d03428 45
ddddda9b
SK
46Running the full range hotplug selftests
47========================================
48
3c415707 49To build the hotplug tests:
ddddda9b
SK
50 $ make -C tools/testing/selftests hotplug
51
3c415707 52To run the hotplug tests:
ddddda9b
SK
53 $ make -C tools/testing/selftests run_hotplug
54
55- note that some tests will require root privileges.
80d03428 56
3c415707 57
76caa6ca
WL
58Install selftests
59=================
60
61You can use kselftest_install.sh tool installs selftests in default
62location which is tools/testing/selftests/kselftest or an user specified
63location.
64
65To install selftests in default location:
66 $ cd tools/testing/selftests
67 $ ./kselftest_install.sh
68
69To install selftests in an user specified location:
70 $ cd tools/testing/selftests
71 $ ./kselftest_install.sh install_dir
72
73
80d03428
JK
74Contributing new tests
75======================
76
4db1fa66 77In general, the rules for selftests are
80d03428
JK
78
79 * Do as much as you can if you're not root;
80
81 * Don't take too long;
82
83 * Don't break the build on any architecture, and
84
85 * Don't cause the top-level "make run_tests" to fail if your feature is
86 unconfigured.