diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-03-06 01:36:02 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-03-06 01:36:02 -0300 |
commit | 49776627e60f2718c9511569e73e4d671065dd61 (patch) | |
tree | d8f6c05ad045fef7866b022fb39ef1968535caf0 | |
parent | 42149024828509d93dd7d93464ac96b040160ba1 (diff) | |
download | kmod-49776627e60f2718c9511569e73e4d671065dd61.tar.gz |
testsuite: add test for '.' correctly parsed in param's value
In kcmdline it's possible to have a dot in the param's value. The
support for this was added in 66f3228 ("libkmod: Add support for '.' in
module parameter on kcmdline") and is needed to correctly support some
modules that depend on it.
This test was added in order to make sure the commit aa87854
("libkmod-config: Only match dot before '=' in /proc/cmdline") didn't
break it. Although that commit message says it's allowing to match a
dot before '=' it's actually enforcing the first part of the string to
be always in the format "<module-name>.param". Dots after '=' are still
correctly allowed.
3 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline4/correct.txt b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline4/correct.txt new file mode 100644 index 0000000..60fa483 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline4/correct.txt @@ -0,0 +1,4 @@ +options testmodule testparam=1.5G + +# End of configuration files. Dumping indexes now: + diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline4/proc/cmdline b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline4/proc/cmdline new file mode 100644 index 0000000..c460c5e --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline4/proc/cmdline @@ -0,0 +1 @@ +testmodule.testparam=1.5G diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index e5bd925..d7663e6 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -235,6 +235,30 @@ static DEFINE_TEST(modprobe_param_kcmdline3, .modules_loaded = "", ); +static noreturn int modprobe_param_kcmdline4(const struct test *t) +{ + const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe"; + const char *const args[] = { + progname, + "-c", + NULL, + }; + + test_spawn_prog(progname, args); + exit(EXIT_FAILURE); +} +static DEFINE_TEST(modprobe_param_kcmdline4, + .description = "check if unrelated strings in kcmdline are correctly ignored", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline4", + }, + .output = { + .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline4/correct.txt", + }, + .modules_loaded = "", + ); + static noreturn int modprobe_force(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe"; @@ -312,6 +336,7 @@ static const struct test *tests[] = { &smodprobe_param_kcmdline, &smodprobe_param_kcmdline2, &smodprobe_param_kcmdline3, + &smodprobe_param_kcmdline4, &smodprobe_force, &smodprobe_oldkernel, &smodprobe_oldkernel_force, |