testsuite: add test for kcmdline params with no value
authorLucas De Marchi <lucas.demarchi@intel.com>
Thu, 6 Mar 2014 04:09:30 +0000 (01:09 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 6 Mar 2014 04:29:41 +0000 (01:29 -0300)
Use "modprobe -c" to dump the configuration. Since we configure our
rootfs to have only a /proc/cmdline file, this should dump the knowledge
we have from its parsed content.

Test if <module>.option, without any value is correctly parsed, as fixed
in commit 493dc65 ("libkmod: Fix getting param with no value from kcmdline")

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

diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline2/correct.txt b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline2/correct.txt
new file mode 100644 (file)
index 0000000..b73a680
--- /dev/null
@@ -0,0 +1,5 @@
+options psmouse foo
+options psmouse bar=1
+
+# End of configuration files. Dumping indexes now:
+
diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline2/proc/cmdline b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline2/proc/cmdline
new file mode 100644 (file)
index 0000000..f048fdd
--- /dev/null
@@ -0,0 +1 @@
+psmouse.foo psmouse.bar=1 quiet rw
index b675f48..492b4d8 100644 (file)
@@ -187,6 +187,30 @@ static DEFINE_TEST(modprobe_param_kcmdline,
        .modules_loaded = "",
        );
 
+static noreturn int modprobe_param_kcmdline2(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_kcmdline2,
+       .description = "check if params with no value are parsed correctly from kcmdline",
+       .config = {
+               [TC_UNAME_R] = "4.4.4",
+               [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline2",
+       },
+       .output = {
+               .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline2/correct.txt",
+       },
+       .modules_loaded = "",
+       );
+
 static noreturn int modprobe_force(const struct test *t)
 {
        const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
@@ -262,6 +286,7 @@ static const struct test *tests[] = {
        &smodprobe_softdep_loop,
        &smodprobe_install_cmd_loop,
        &smodprobe_param_kcmdline,
+       &smodprobe_param_kcmdline2,
        &smodprobe_force,
        &smodprobe_oldkernel,
        &smodprobe_oldkernel_force,