From 5b532fd9616ba2a750e25378152bad4c9a2e7c27 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 27 Feb 2014 22:34:24 +0100 Subject: [PATCH 05/10] testsuite: Add test for modprobe --force There is no check if the correct flags are passed to finit_module, but at least we cover the respective code path in kmod. Patch-mainline: v17 Git-commit: 2ce5de0ae6c191920a4eeeab757ccfad092d9e0f [mmarek: Dropped binary files from the patch] --- testsuite/test-modprobe.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index c3ef31e..92348b0 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -187,6 +187,28 @@ static DEFINE_TEST(modprobe_param_kcmdline, .modules_loaded = "", ); +static noreturn int modprobe_force(const struct test *t) +{ + const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe"; + const char *const args[] = { + progname, + "--force", "psmouse", + NULL, + }; + + test_spawn_prog(progname, args); + exit(EXIT_FAILURE); +} +static DEFINE_TEST(modprobe_force, + .description = "check modprobe --force", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/force", + [TC_INIT_MODULE_RETCODES] = "", + }, + .modules_loaded = "psmouse", + ); + static const struct test *tests[] = { &smodprobe_show_depends, @@ -196,6 +218,7 @@ static const struct test *tests[] = { &smodprobe_softdep_loop, &smodprobe_install_cmd_loop, &smodprobe_param_kcmdline, + &smodprobe_force, NULL, }; -- 1.8.4.5