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.
This commit is contained in:
Michal Marek 2014-02-28 13:05:29 +01:00 committed by Lucas De Marchi
parent 88ac40840f
commit 2ce5de0ae6
12 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# Aliases extracted from modules themselves.
alias serio:ty05pr*id*ex* psmouse
alias serio:ty01pr*id*ex* psmouse

View File

@ -0,0 +1 @@
kernel/drivers/input/mouse/psmouse.ko:

View File

@ -0,0 +1 @@
# Device nodes to trigger on-demand module loading.

View File

@ -0,0 +1,2 @@
# Soft dependencies extracted from modules themselves.
# Copy, with a .conf extension, to /etc/modprobe.d to use it with modprobe.

View File

@ -0,0 +1 @@
# Aliases for symbols, used by symbol_request().

View File

@ -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,
};