Skip to content

Commit b6d9933

Browse files
committed
Merge tag 'linux_kselftest-kunit-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kunit updates from Shuah Khan: - Make filter parameters configurable via Kconfig - Add description of kunit.enable parameter to documentation * tag 'linux_kselftest-kunit-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: Make filter parameters configurable via Kconfig Documentation: kunit: add description of kunit.enable parameter
2 parents 2488655 + 7bc16e7 commit b6d9933

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

Documentation/dev-tools/kunit/run_manual.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ or be built into the kernel.
3535
a good way of quickly testing everything applicable to the current
3636
config.
3737
38+
KUnit can be enabled or disabled at boot time, and this behavior is
39+
controlled by the kunit.enable kernel parameter.
40+
By default, kunit.enable is set to 1 because KUNIT_DEFAULT_ENABLED is
41+
enabled by default. To ensure that tests are executed as expected,
42+
verify that kunit.enable=1 at boot time.
43+
3844
Once we have built our kernel (and/or modules), it is simple to run
3945
the tests. If the tests are built-in, they will run automatically on the
4046
kernel boot. The results will be written to the kernel log (``dmesg``)

lib/kunit/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,30 @@ config KUNIT_AUTORUN_ENABLED
9393
In most cases this should be left as Y. Only if additional opt-in
9494
behavior is needed should this be set to N.
9595

96+
config 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+
104+
config 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+
112+
config 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+
96120
config KUNIT_DEFAULT_TIMEOUT
97121
int "Default value of the timeout module parameter"
98122
default 300

lib/kunit/executor.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ bool kunit_autorun(void)
4545
return autorun_param;
4646
}
4747

48-
static char *filter_glob_param;
49-
static char *filter_param;
50-
static char *filter_action_param;
48+
#define PARAM_FROM_CONFIG(config) (config[0] ? config : NULL)
49+
50+
static char *filter_glob_param = PARAM_FROM_CONFIG(CONFIG_KUNIT_DEFAULT_FILTER_GLOB);
51+
static char *filter_param = PARAM_FROM_CONFIG(CONFIG_KUNIT_DEFAULT_FILTER);
52+
static char *filter_action_param = PARAM_FROM_CONFIG(CONFIG_KUNIT_DEFAULT_FILTER_ACTION);
5153

5254
module_param_named(filter_glob, filter_glob_param, charp, 0600);
5355
MODULE_PARM_DESC(filter_glob,

0 commit comments

Comments
 (0)