From: Lucas De Marchi Date: Mon, 23 Jan 2017 19:59:31 +0000 (-0800) Subject: testsuite: add test for kernel cmdline with quotes X-Git-Tag: v24~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ded0bebca80ac1f20caa488efb412aa72ea8a7fd;p=thirdparty%2Fkmod.git 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. --- 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 00000000..6996ba26 --- /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 00000000..0c796b3e --- /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 1430c256..e0dd1992 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";