xref: /linux/lib/kunit/Kconfig (revision e8f17cb6f5abd4e52e89b5768c7016b7dab1e6fe)
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
19beaed42cSAnders Roxell	bool "KUnit - Enable /sys/kernel/debug/kunit debugfs representation" if !KUNIT_ALL_TESTS
20beaed42cSAnders Roxell	default KUNIT_ALL_TESTS
21e2219db2SAlan Maguire	help
22e2219db2SAlan Maguire	  Enable debugfs representation for kunit.  Currently this consists
23e2219db2SAlan Maguire	  of /sys/kernel/debug/kunit/<test_suite>/results files for each
24e2219db2SAlan Maguire	  test suite, which allow users to see results of the last test suite
25e2219db2SAlan Maguire	  run that occurred.
26e2219db2SAlan Maguire
274b513a02SDavid Gowconfig KUNIT_FAULT_TEST
284b513a02SDavid Gow	bool "Enable KUnit tests which print BUG stacktraces"
294b513a02SDavid Gow	depends on KUNIT_TEST
304b513a02SDavid Gow	depends on !UML
314b513a02SDavid Gow	default y
324b513a02SDavid Gow	help
334b513a02SDavid Gow	  Enables fault handling tests for the KUnit framework. These tests may
344b513a02SDavid Gow	  trigger a kernel BUG(), and the associated stack trace, even when they
354b513a02SDavid Gow	  pass. If this conflicts with your test infrastrcture (or is confusing
364b513a02SDavid Gow	  or annoying), they can be disabled by setting this to N.
374b513a02SDavid Gow
38d8e2a76bSBrendan Higginsconfig KUNIT_TEST
39beaed42cSAnders Roxell	tristate "KUnit test for KUnit" if !KUNIT_ALL_TESTS
40beaed42cSAnders Roxell	default KUNIT_ALL_TESTS
41d8e2a76bSBrendan Higgins	help
42d8e2a76bSBrendan Higgins	  Enables the unit tests for the KUnit test framework. These tests test
43d8e2a76bSBrendan Higgins	  the KUnit test framework itself; the tests are both written using
44d8e2a76bSBrendan Higgins	  KUnit and test KUnit. This option should only be enabled for testing
45d8e2a76bSBrendan Higgins	  purposes by developers interested in testing that KUnit works as
46d8e2a76bSBrendan Higgins	  expected.
47d8e2a76bSBrendan Higgins
48d8e2a76bSBrendan Higginsconfig KUNIT_EXAMPLE_TEST
49beaed42cSAnders Roxell	tristate "Example test for KUnit" if !KUNIT_ALL_TESTS
50beaed42cSAnders Roxell	default KUNIT_ALL_TESTS
51d8e2a76bSBrendan Higgins	help
52d8e2a76bSBrendan Higgins	  Enables an example unit test that illustrates some of the basic
53d8e2a76bSBrendan Higgins	  features of KUnit. This test only exists to help new users understand
54d8e2a76bSBrendan Higgins	  what KUnit is and how it is used. Please refer to the example test
55d8e2a76bSBrendan Higgins	  itself, lib/kunit/example-test.c, for more information. This option
56d8e2a76bSBrendan Higgins	  is intended for curious hackers who would like to understand how to
57d8e2a76bSBrendan Higgins	  use KUnit for kernel development.
58d8e2a76bSBrendan Higgins
5992238b31SAnders Roxellconfig KUNIT_ALL_TESTS
6092238b31SAnders Roxell	tristate "All KUnit tests with satisfied dependencies"
6192238b31SAnders Roxell	help
6292238b31SAnders Roxell	  Enables all KUnit tests, if they can be enabled.
6392238b31SAnders Roxell	  KUnit tests run during boot and output the results to the debug log
6492238b31SAnders Roxell	  in TAP format (http://testanything.org/). Only useful for kernel devs
6592238b31SAnders Roxell	  running the KUnit test harness, and not intended for inclusion into a
6692238b31SAnders Roxell	  production build.
6792238b31SAnders Roxell
6892238b31SAnders Roxell	  For more information on KUnit and unit tests in general please refer
6992238b31SAnders Roxell	  to the KUnit documentation in Documentation/dev-tools/kunit/.
7092238b31SAnders Roxell
7192238b31SAnders Roxell	  If unsure, say N.
7292238b31SAnders Roxell
73d20a6ba5SJoe Fradleyconfig KUNIT_DEFAULT_ENABLED
74d20a6ba5SJoe Fradley	bool "Default value of kunit.enable"
75d20a6ba5SJoe Fradley	default y
76d20a6ba5SJoe Fradley	help
77d20a6ba5SJoe Fradley	  Sets the default value of kunit.enable. If set to N then KUnit
78d20a6ba5SJoe Fradley	  tests will not execute unless kunit.enable=1 is passed to the
79d20a6ba5SJoe Fradley	  kernel command line.
80d20a6ba5SJoe Fradley
81d20a6ba5SJoe Fradley	  In most cases this should be left as Y. Only if additional opt-in
82d20a6ba5SJoe Fradley	  behavior is needed should this be set to N.
83d20a6ba5SJoe Fradley
84*31691914SStanislav Kinsburskiiconfig KUNIT_AUTORUN_ENABLED
85*31691914SStanislav Kinsburskii	bool "Default value of kunit.autorun"
86*31691914SStanislav Kinsburskii	default y
87*31691914SStanislav Kinsburskii	help
88*31691914SStanislav Kinsburskii	  Sets the default value of kunit.autorun. If set to N then KUnit
89*31691914SStanislav Kinsburskii	  tests will not run after initialization unless kunit.autorun=1 is
90*31691914SStanislav Kinsburskii	  passed to the kernel command line. The test can still be run manually
91*31691914SStanislav Kinsburskii	  via debugfs interface.
92*31691914SStanislav Kinsburskii
93*31691914SStanislav Kinsburskii	  In most cases this should be left as Y. Only if additional opt-in
94*31691914SStanislav Kinsburskii	  behavior is needed should this be set to N.
95*31691914SStanislav Kinsburskii
96d8e2a76bSBrendan Higginsendif # KUNIT
97