xref: /linux/lib/kunit/Kconfig (revision 50897c955902c93ae71c38698abb910525ebdc89)
1914cc63eSBrendan Higgins#
2914cc63eSBrendan Higgins# KUnit base configuration
3914cc63eSBrendan Higgins#
4914cc63eSBrendan Higgins
5914cc63eSBrendan Higginsmenuconfig KUNIT
69fe124bfSAlan Maguire	tristate "KUnit - Enable support for unit tests"
7b67abaadSJanusz Krzysztofik	select GLOB
8914cc63eSBrendan Higgins	help
9914cc63eSBrendan Higgins	  Enables support for kernel unit tests (KUnit), a lightweight unit
10914cc63eSBrendan Higgins	  testing and mocking framework for the Linux kernel. These tests are
11914cc63eSBrendan Higgins	  able to be run locally on a developer's workstation without a VM or
12914cc63eSBrendan Higgins	  special hardware when using UML. Can also be used on most other
13914cc63eSBrendan Higgins	  architectures. For more information, please see
14914cc63eSBrendan Higgins	  Documentation/dev-tools/kunit/.
15d8e2a76bSBrendan Higgins
16d8e2a76bSBrendan Higginsif KUNIT
17d8e2a76bSBrendan Higgins
18e2219db2SAlan Maguireconfig KUNIT_DEBUGFS
1917e4c68fSDavid Gow	bool "KUnit - Enable /sys/kernel/debug/kunit debugfs representation"
20*8f80b5b2SDavid Gow	depends on DEBUG_FS
2117e4c68fSDavid Gow	default y
22e2219db2SAlan Maguire	help
23e2219db2SAlan Maguire	  Enable debugfs representation for kunit.  Currently this consists
24e2219db2SAlan Maguire	  of /sys/kernel/debug/kunit/<test_suite>/results files for each
25e2219db2SAlan Maguire	  test suite, which allow users to see results of the last test suite
26e2219db2SAlan Maguire	  run that occurred.
27e2219db2SAlan Maguire
284b513a02SDavid Gowconfig KUNIT_FAULT_TEST
294b513a02SDavid Gow	bool "Enable KUnit tests which print BUG stacktraces"
304b513a02SDavid Gow	depends on KUNIT_TEST
314b513a02SDavid Gow	depends on !UML
32c33b6880SBrendan Jackman	default !PANIC_ON_OOPS
334b513a02SDavid Gow	help
344b513a02SDavid Gow	  Enables fault handling tests for the KUnit framework. These tests may
354b513a02SDavid Gow	  trigger a kernel BUG(), and the associated stack trace, even when they
364b513a02SDavid Gow	  pass. If this conflicts with your test infrastrcture (or is confusing
374b513a02SDavid Gow	  or annoying), they can be disabled by setting this to N.
384b513a02SDavid Gow
39d8e2a76bSBrendan Higginsconfig KUNIT_TEST
40beaed42cSAnders Roxell	tristate "KUnit test for KUnit" if !KUNIT_ALL_TESTS
41beaed42cSAnders Roxell	default KUNIT_ALL_TESTS
42d8e2a76bSBrendan Higgins	help
43d8e2a76bSBrendan Higgins	  Enables the unit tests for the KUnit test framework. These tests test
44d8e2a76bSBrendan Higgins	  the KUnit test framework itself; the tests are both written using
45d8e2a76bSBrendan Higgins	  KUnit and test KUnit. This option should only be enabled for testing
46d8e2a76bSBrendan Higgins	  purposes by developers interested in testing that KUnit works as
47d8e2a76bSBrendan Higgins	  expected.
48d8e2a76bSBrendan Higgins
49d8e2a76bSBrendan Higginsconfig KUNIT_EXAMPLE_TEST
50beaed42cSAnders Roxell	tristate "Example test for KUnit" if !KUNIT_ALL_TESTS
51beaed42cSAnders Roxell	default KUNIT_ALL_TESTS
52d8e2a76bSBrendan Higgins	help
53d8e2a76bSBrendan Higgins	  Enables an example unit test that illustrates some of the basic
54d8e2a76bSBrendan Higgins	  features of KUnit. This test only exists to help new users understand
55d8e2a76bSBrendan Higgins	  what KUnit is and how it is used. Please refer to the example test
56d8e2a76bSBrendan Higgins	  itself, lib/kunit/example-test.c, for more information. This option
57d8e2a76bSBrendan Higgins	  is intended for curious hackers who would like to understand how to
58d8e2a76bSBrendan Higgins	  use KUnit for kernel development.
59d8e2a76bSBrendan Higgins
6092238b31SAnders Roxellconfig KUNIT_ALL_TESTS
6192238b31SAnders Roxell	tristate "All KUnit tests with satisfied dependencies"
6292238b31SAnders Roxell	help
6392238b31SAnders Roxell	  Enables all KUnit tests, if they can be enabled.
6492238b31SAnders Roxell	  KUnit tests run during boot and output the results to the debug log
6592238b31SAnders Roxell	  in TAP format (http://testanything.org/). Only useful for kernel devs
6692238b31SAnders Roxell	  running the KUnit test harness, and not intended for inclusion into a
6792238b31SAnders Roxell	  production build.
6892238b31SAnders Roxell
6992238b31SAnders Roxell	  For more information on KUnit and unit tests in general please refer
7092238b31SAnders Roxell	  to the KUnit documentation in Documentation/dev-tools/kunit/.
7192238b31SAnders Roxell
7292238b31SAnders Roxell	  If unsure, say N.
7392238b31SAnders Roxell
74d20a6ba5SJoe Fradleyconfig KUNIT_DEFAULT_ENABLED
75d20a6ba5SJoe Fradley	bool "Default value of kunit.enable"
76d20a6ba5SJoe Fradley	default y
77d20a6ba5SJoe Fradley	help
78d20a6ba5SJoe Fradley	  Sets the default value of kunit.enable. If set to N then KUnit
79d20a6ba5SJoe Fradley	  tests will not execute unless kunit.enable=1 is passed to the
80d20a6ba5SJoe Fradley	  kernel command line.
81d20a6ba5SJoe Fradley
82d20a6ba5SJoe Fradley	  In most cases this should be left as Y. Only if additional opt-in
83d20a6ba5SJoe Fradley	  behavior is needed should this be set to N.
84d20a6ba5SJoe Fradley
8531691914SStanislav Kinsburskiiconfig KUNIT_AUTORUN_ENABLED
8631691914SStanislav Kinsburskii	bool "Default value of kunit.autorun"
8731691914SStanislav Kinsburskii	default y
8831691914SStanislav Kinsburskii	help
8931691914SStanislav Kinsburskii	  Sets the default value of kunit.autorun. If set to N then KUnit
9031691914SStanislav Kinsburskii	  tests will not run after initialization unless kunit.autorun=1 is
9131691914SStanislav Kinsburskii	  passed to the kernel command line. The test can still be run manually
9231691914SStanislav Kinsburskii	  via debugfs interface.
9331691914SStanislav Kinsburskii
9431691914SStanislav Kinsburskii	  In most cases this should be left as Y. Only if additional opt-in
9531691914SStanislav Kinsburskii	  behavior is needed should this be set to N.
9631691914SStanislav Kinsburskii
977bc16e72SThomas Weißschuhconfig KUNIT_DEFAULT_FILTER_GLOB
987bc16e72SThomas Weißschuh	string "Default value of the filter_glob module parameter"
997bc16e72SThomas Weißschuh	help
1007bc16e72SThomas Weißschuh	  Sets the default value of kunit.filter_glob. If set to a non-empty
1017bc16e72SThomas Weißschuh	  string only matching tests are executed.
1027bc16e72SThomas Weißschuh
1037bc16e72SThomas Weißschuh	  If unsure, leave empty so all tests are executed.
1047bc16e72SThomas Weißschuh
1057bc16e72SThomas Weißschuhconfig KUNIT_DEFAULT_FILTER
1067bc16e72SThomas Weißschuh	string "Default value of the filter module parameter"
1077bc16e72SThomas Weißschuh	help
1087bc16e72SThomas Weißschuh	  Sets the default value of kunit.filter. If set to a non-empty
1097bc16e72SThomas Weißschuh	  string only matching tests are executed.
1107bc16e72SThomas Weißschuh
1117bc16e72SThomas Weißschuh	  If unsure, leave empty so all tests are executed.
1127bc16e72SThomas Weißschuh
1137bc16e72SThomas Weißschuhconfig KUNIT_DEFAULT_FILTER_ACTION
1147bc16e72SThomas Weißschuh	string "Default value of the filter_action module parameter"
1157bc16e72SThomas Weißschuh	help
1167bc16e72SThomas Weißschuh	  Sets the default value of kunit.filter_action. If set to a non-empty
1177bc16e72SThomas Weißschuh	  string only matching tests are executed.
1187bc16e72SThomas Weißschuh
1197bc16e72SThomas Weißschuh	  If unsure, leave empty so all tests are executed.
1207bc16e72SThomas Weißschuh
1215ac244b9SMarie Zhussupovaconfig KUNIT_DEFAULT_TIMEOUT
1225ac244b9SMarie Zhussupova	int "Default value of the timeout module parameter"
1235ac244b9SMarie Zhussupova	default 300
1245ac244b9SMarie Zhussupova	help
1255ac244b9SMarie Zhussupova	  Sets the default timeout, in seconds, for Kunit test cases. This value
1265ac244b9SMarie Zhussupova	  is further multiplied by a factor determined by the assigned speed
1275ac244b9SMarie Zhussupova	  setting: 1x for `DEFAULT`, 3x for `KUNIT_SPEED_SLOW`, and 12x for
1285ac244b9SMarie Zhussupova	  `KUNIT_SPEED_VERY_SLOW`. This allows slower tests on slower machines
1295ac244b9SMarie Zhussupova	  sufficient time to complete.
1305ac244b9SMarie Zhussupova
1315ac244b9SMarie Zhussupova	  If unsure, the default timeout of 300 seconds is suitable for most
1325ac244b9SMarie Zhussupova	  cases.
1335ac244b9SMarie Zhussupova
134031cdd3bSThomas Weißschuhconfig KUNIT_UML_PCI
135031cdd3bSThomas Weißschuh	bool "KUnit UML PCI Support"
136031cdd3bSThomas Weißschuh	depends on UML
137031cdd3bSThomas Weißschuh	select UML_PCI
138031cdd3bSThomas Weißschuh	help
139031cdd3bSThomas Weißschuh	  Enables the PCI subsystem on UML for use by KUnit tests.
140285cae57SThomas Weißschuh	  Some KUnit tests require the PCI core which is not enabled by
141285cae57SThomas Weißschuh	  default on UML.
142285cae57SThomas Weißschuh
143285cae57SThomas Weißschuh	  If unsure, say N.
144031cdd3bSThomas Weißschuh
145d8e2a76bSBrendan Higginsendif # KUNIT
146