From: Lucas De Marchi Date: Thu, 6 Mar 2014 04:09:30 +0000 (-0300) Subject: testsuite: add test for kcmdline params with no value X-Git-Tag: v17~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55bcc4a5bdb8cf9317de4420584f676515c1f763;p=thirdparty%2Fkmod.git testsuite: add test for kcmdline params with no value 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 .option, without any value is correctly parsed, as fixed in commit 493dc65 ("libkmod: Fix getting param with no value from kcmdline") --- 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 index 00000000..b73a6801 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline2/correct.txt @@ -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 index 00000000..f048fdd1 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/module-param-kcmdline2/proc/cmdline @@ -0,0 +1 @@ +psmouse.foo psmouse.bar=1 quiet rw diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index b675f488..492b4d8d 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -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,