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