testsuite: add test to ignore unrelated strings in kcmdline
authorLucas De Marchi <lucas.demarchi@intel.com>
Thu, 6 Mar 2014 04:24:32 +0000 (01:24 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 6 Mar 2014 04:30:56 +0000 (01:30 -0300)
Strings unrelated to modules and modprobe should be ignored and not
appear in the output of "modprobe -c".

This adds a test for the fix provided in aa87854 ("libkmod-config: Only
match dot before '=' in /proc/cmdline").

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

diff --git a/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline3/correct.txt b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline3/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-kcmdline3/proc/cmdline b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline3/proc/cmdline
new file mode 100644 (file)
index 0000000..3575bb1
--- /dev/null
@@ -0,0 +1 @@
+BOOT_IMAGE=/boot/vmlinuz-3.12.12-57.g5f654cf-default initrd=\initramfs-linux.img psmouse.foo psmouse.bar=1 root=/dev/sda2 rootfstype=ext4 add_efi_memmap quiet rw
index b5eaba3..e5bd925 100644 (file)
@@ -211,6 +211,30 @@ static DEFINE_TEST(modprobe_param_kcmdline2,
        .modules_loaded = "",
        );
 
+static noreturn int modprobe_param_kcmdline3(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_kcmdline3,
+       .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-kcmdline3",
+       },
+       .output = {
+               .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline3/correct.txt",
+       },
+       .modules_loaded = "",
+       );
+
 static noreturn int modprobe_force(const struct test *t)
 {
        const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
@@ -287,6 +311,7 @@ static const struct test *tests[] = {
        &smodprobe_install_cmd_loop,
        &smodprobe_param_kcmdline,
        &smodprobe_param_kcmdline2,
+       &smodprobe_param_kcmdline3,
        &smodprobe_force,
        &smodprobe_oldkernel,
        &smodprobe_oldkernel_force,