xref: /linux/lib/kunit/Kconfig (revision b6d993310a65b994f37e3347419d9ed398ee37a3)
1#
2# KUnit base configuration
3#
4
5menuconfig KUNIT
6	tristate "KUnit - Enable support for unit tests"
7	select GLOB
8	help
9	  Enables support for kernel unit tests (KUnit), a lightweight unit
10	  testing and mocking framework for the Linux kernel. These tests are
11	  able to be run locally on a developer's workstation without a VM or
12	  special hardware when using UML. Can also be used on most other
13	  architectures. For more information, please see
14	  Documentation/dev-tools/kunit/.
15
16if KUNIT
17
18config KUNIT_DEBUGFS
19	bool "KUnit - Enable /sys/kernel/debug/kunit debugfs representation" if !KUNIT_ALL_TESTS
20	default KUNIT_ALL_TESTS
21	help
22	  Enable debugfs representation for kunit.  Currently this consists
23	  of /sys/kernel/debug/kunit/<test_suite>/results files for each
24	  test suite, which allow users to see results of the last test suite
25	  run that occurred.
26
27config KUNIT_FAULT_TEST
28	bool "Enable KUnit tests which print BUG stacktraces"
29	depends on KUNIT_TEST
30	depends on !UML
31	default y
32	help
33	  Enables fault handling tests for the KUnit framework. These tests may
34	  trigger a kernel BUG(), and the associated stack trace, even when they
35	  pass. If this conflicts with your test infrastrcture (or is confusing
36	  or annoying), they can be disabled by setting this to N.
37
38config KUNIT_TEST
39	tristate "KUnit test for KUnit" if !KUNIT_ALL_TESTS
40	default KUNIT_ALL_TESTS
41	help
42	  Enables the unit tests for the KUnit test framework. These tests test
43	  the KUnit test framework itself; the tests are both written using
44	  KUnit and test KUnit. This option should only be enabled for testing
45	  purposes by developers interested in testing that KUnit works as
46	  expected.
47
48config KUNIT_EXAMPLE_TEST
49	tristate "Example test for KUnit" if !KUNIT_ALL_TESTS
50	default KUNIT_ALL_TESTS
51	help
52	  Enables an example unit test that illustrates some of the basic
53	  features of KUnit. This test only exists to help new users understand
54	  what KUnit is and how it is used. Please refer to the example test
55	  itself, lib/kunit/example-test.c, for more information. This option
56	  is intended for curious hackers who would like to understand how to
57	  use KUnit for kernel development.
58
59config KUNIT_ALL_TESTS
60	tristate "All KUnit tests with satisfied dependencies"
61	help
62	  Enables all KUnit tests, if they can be enabled.
63	  KUnit tests run during boot and output the results to the debug log
64	  in TAP format (http://testanything.org/). Only useful for kernel devs
65	  running the KUnit test harness, and not intended for inclusion into a
66	  production build.
67
68	  For more information on KUnit and unit tests in general please refer
69	  to the KUnit documentation in Documentation/dev-tools/kunit/.
70
71	  If unsure, say N.
72
73config KUNIT_DEFAULT_ENABLED
74	bool "Default value of kunit.enable"
75	default y
76	help
77	  Sets the default value of kunit.enable. If set to N then KUnit
78	  tests will not execute unless kunit.enable=1 is passed to the
79	  kernel command line.
80
81	  In most cases this should be left as Y. Only if additional opt-in
82	  behavior is needed should this be set to N.
83
84config KUNIT_AUTORUN_ENABLED
85	bool "Default value of kunit.autorun"
86	default y
87	help
88	  Sets the default value of kunit.autorun. If set to N then KUnit
89	  tests will not run after initialization unless kunit.autorun=1 is
90	  passed to the kernel command line. The test can still be run manually
91	  via debugfs interface.
92
93	  In most cases this should be left as Y. Only if additional opt-in
94	  behavior is needed should this be set to N.
95
96config KUNIT_DEFAULT_FILTER_GLOB
97	string "Default value of the filter_glob module parameter"
98	help
99	  Sets the default value of kunit.filter_glob. If set to a non-empty
100	  string only matching tests are executed.
101
102	  If unsure, leave empty so all tests are executed.
103
104config KUNIT_DEFAULT_FILTER
105	string "Default value of the filter module parameter"
106	help
107	  Sets the default value of kunit.filter. If set to a non-empty
108	  string only matching tests are executed.
109
110	  If unsure, leave empty so all tests are executed.
111
112config KUNIT_DEFAULT_FILTER_ACTION
113	string "Default value of the filter_action module parameter"
114	help
115	  Sets the default value of kunit.filter_action. If set to a non-empty
116	  string only matching tests are executed.
117
118	  If unsure, leave empty so all tests are executed.
119
120config KUNIT_DEFAULT_TIMEOUT
121	int "Default value of the timeout module parameter"
122	default 300
123	help
124	  Sets the default timeout, in seconds, for Kunit test cases. This value
125	  is further multiplied by a factor determined by the assigned speed
126	  setting: 1x for `DEFAULT`, 3x for `KUNIT_SPEED_SLOW`, and 12x for
127	  `KUNIT_SPEED_VERY_SLOW`. This allows slower tests on slower machines
128	  sufficient time to complete.
129
130	  If unsure, the default timeout of 300 seconds is suitable for most
131	  cases.
132
133config KUNIT_UML_PCI
134	bool "KUnit UML PCI Support"
135	depends on UML
136	select UML_PCI
137	help
138	  Enables the PCI subsystem on UML for use by KUnit tests.
139	  Some KUnit tests require the PCI core which is not enabled by
140	  default on UML.
141
142	  If unsure, say N.
143
144endif # KUNIT
145