summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2017-01-23 11:59:31 -0800
committerLucas De Marchi <lucas.demarchi@intel.com>2017-01-23 11:59:31 -0800
commitded0bebca80ac1f20caa488efb412aa72ea8a7fd (patch)
tree0e11d2d69c936e3a11b5869466d7aa631d52c6cb
parent55f8286fcd773770be762f9174f22cb1df1b4678 (diff)
downloadkmod-ded0bebca80ac1f20caa488efb412aa72ea8a7fd.tar.gz
testsuite: add test for kernel cmdline with quotes
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.
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/correct.txt6
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/proc/cmdline1
-rw-r--r--testsuite/test-modprobe.c25
3 files changed, 32 insertions, 0 deletions
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
index 0000000..6996ba2
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/correct.txt
@@ -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
index 0000000..0c796b3
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline5/proc/cmdline
@@ -0,0 +1 @@
+psmouse.foo psmouse.bar=1 psmouse.foobar="test 1" " notamodule" "noteamodule2 " notamodule3 " quiet rw
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index 1430c25..e0dd199 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -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";