]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: add test for kernel cmdline with quotes
authorLucas De Marchi <lucas.demarchi@intel.com>
Mon, 23 Jan 2017 19:59:31 +0000 (11:59 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 23 Jan 2017 19:59:31 +0000 (11:59 -0800)
Add some tests in which we quotes in kernel cmdline and also spaces
inside quotes.  This doesn't yet cover the case in which quotes are used
for module name, wihch should be forbidden.

testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/correct.txt [new file with mode: 0644]
testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/proc/cmdline [new file with mode: 0644]
testsuite/test-modprobe.c

diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/correct.txt b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/correct.txt
new file mode 100644 (file)
index 0000000..6996ba2
--- /dev/null
@@ -0,0 +1,6 @@
+options psmouse foo
+options psmouse bar=1
+options psmouse foobar="test 1"
+
+# End of configuration files. Dumping indexes now:
+
diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/proc/cmdline b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/proc/cmdline
new file mode 100644 (file)
index 0000000..0c796b3
--- /dev/null
@@ -0,0 +1 @@
+psmouse.foo psmouse.bar=1 psmouse.foobar="test 1" " notamodule" "noteamodule2 " notamodule3 " quiet rw
index 1430c256cbef4e14f31278ac6317f568321b8a45..e0dd1992a784aef24560d8504cf2377998b6338e 100644 (file)
@@ -280,6 +280,31 @@ DEFINE_TEST(modprobe_param_kcmdline4,
        .modules_loaded = "",
        );
 
+static noreturn int modprobe_param_kcmdline5(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);
+}
+DEFINE_TEST(modprobe_param_kcmdline5,
+       .description = "check if params with spaces are parsed correctly from kcmdline",
+       .config = {
+               [TC_UNAME_R] = "4.4.4",
+               [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline5",
+       },
+       .output = {
+               .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline5/correct.txt",
+       },
+       .modules_loaded = "",
+       );
+
+
 static noreturn int modprobe_force(const struct test *t)
 {
        const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";