Commit 7bc16e72 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Shuah Khan
Browse files

kunit: Make filter parameters configurable via Kconfig

Enable the preset of filter parameters from kconfig options, similar to
how other KUnit configuration parameters are handled already.
This is useful to run a subset of tests even if the cmdline is not
readily modifyable.

Link: https://lore.kernel.org/r/20251106-kunit-filter-kconfig-v1-1-d723fb7ac221@linutronix.de


Signed-off-by: default avatarThomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: default avatarDavid Gow <davidgow@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 9de5f847
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -93,6 +93,30 @@ config KUNIT_AUTORUN_ENABLED
	  In most cases this should be left as Y. Only if additional opt-in
	  behavior is needed should this be set to N.

config KUNIT_DEFAULT_FILTER_GLOB
	string "Default value of the filter_glob module parameter"
	help
	  Sets the default value of kunit.filter_glob. If set to a non-empty
	  string only matching tests are executed.

	  If unsure, leave empty so all tests are executed.

config KUNIT_DEFAULT_FILTER
	string "Default value of the filter module parameter"
	help
	  Sets the default value of kunit.filter. If set to a non-empty
	  string only matching tests are executed.

	  If unsure, leave empty so all tests are executed.

config KUNIT_DEFAULT_FILTER_ACTION
	string "Default value of the filter_action module parameter"
	help
	  Sets the default value of kunit.filter_action. If set to a non-empty
	  string only matching tests are executed.

	  If unsure, leave empty so all tests are executed.

config KUNIT_DEFAULT_TIMEOUT
	int "Default value of the timeout module parameter"
	default 300
+5 −3
Original line number Diff line number Diff line
@@ -45,9 +45,11 @@ bool kunit_autorun(void)
	return autorun_param;
}

static char *filter_glob_param;
static char *filter_param;
static char *filter_action_param;
#define PARAM_FROM_CONFIG(config) (config[0] ? config : NULL)

static char *filter_glob_param = PARAM_FROM_CONFIG(CONFIG_KUNIT_DEFAULT_FILTER_GLOB);
static char *filter_param = PARAM_FROM_CONFIG(CONFIG_KUNIT_DEFAULT_FILTER);
static char *filter_action_param = PARAM_FROM_CONFIG(CONFIG_KUNIT_DEFAULT_FILTER_ACTION);

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