2 * Copyright (C) 2012-2013 ProFUSION embedded systems
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
26 #include "testsuite.h"
28 static noreturn
int modprobe_show_depends(const struct test
*t
)
30 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
31 const char *const args
[] = {
33 "--show-depends", "btusb",
37 test_spawn_prog(progname
, args
);
40 DEFINE_TEST(modprobe_show_depends
,
41 .description
= "check if output for modprobe --show-depends is correct for loaded modules",
43 [TC_UNAME_R
] = "4.4.4",
44 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/show-depends",
47 .out
= TESTSUITE_ROOTFS
"test-modprobe/show-depends/correct.txt",
50 static noreturn
int modprobe_show_depends2(const struct test
*t
)
52 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
53 const char *const args
[] = {
55 "--show-depends", "psmouse",
59 test_spawn_prog(progname
, args
);
62 DEFINE_TEST(modprobe_show_depends2
,
63 .description
= "check if output for modprobe --show-depends is correct",
65 [TC_UNAME_R
] = "4.4.4",
66 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/show-depends",
69 .out
= TESTSUITE_ROOTFS
"test-modprobe/show-depends/correct-psmouse.txt",
73 static noreturn
int modprobe_show_alias_to_none(const struct test
*t
)
75 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
76 const char *const args
[] = {
78 "--show-depends", "--ignore-install", "--quiet", "psmouse",
82 test_spawn_prog(progname
, args
);
85 DEFINE_TEST(modprobe_show_alias_to_none
,
86 .description
= "check if modprobe --show-depends doesn't explode with an alias to nothing",
88 [TC_UNAME_R
] = "4.4.4",
89 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/alias-to-none",
92 .out
= TESTSUITE_ROOTFS
"test-modprobe/show-depends/correct-psmouse.txt",
98 static noreturn
int modprobe_builtin(const struct test
*t
)
100 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
101 const char *const args
[] = {
107 test_spawn_prog(progname
, args
);
110 DEFINE_TEST(modprobe_builtin
,
111 .description
= "check if modprobe return 0 for builtin",
113 [TC_UNAME_R
] = "4.4.4",
114 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/builtin",
117 static noreturn
int modprobe_softdep_loop(const struct test
*t
)
119 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
120 const char *const args
[] = {
126 test_spawn_prog(progname
, args
);
129 DEFINE_TEST(modprobe_softdep_loop
,
130 .description
= "check if modprobe breaks softdep loop",
132 [TC_UNAME_R
] = "4.4.4",
133 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/softdep-loop",
134 [TC_INIT_MODULE_RETCODES
] = "",
136 .modules_loaded
= "btusb,bluetooth",
139 static noreturn
int modprobe_install_cmd_loop(const struct test
*t
)
141 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
142 const char *const args
[] = {
148 test_spawn_prog(progname
, args
);
151 DEFINE_TEST(modprobe_install_cmd_loop
,
152 .description
= "check if modprobe breaks install-commands loop",
154 [TC_UNAME_R
] = "4.4.4",
155 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/install-cmd-loop",
156 [TC_INIT_MODULE_RETCODES
] = "",
158 .env_vars
= (const struct keyval
[]) {
159 { "MODPROBE", ABS_TOP_BUILDDIR
"/tools/modprobe" },
162 .modules_loaded
= "snd,snd-pcm",
165 static noreturn
int modprobe_param_kcmdline(const struct test
*t
)
167 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
168 const char *const args
[] = {
170 "--show-depends", "psmouse",
174 test_spawn_prog(progname
, args
);
177 DEFINE_TEST(modprobe_param_kcmdline
,
178 .description
= "check if params from kcmdline are passed in fact passed to (f)init_module call",
180 [TC_UNAME_R
] = "4.4.4",
181 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline",
184 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline/correct.txt",
186 .modules_loaded
= "",
189 static noreturn
int modprobe_param_kcmdline2(const struct test
*t
)
191 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
192 const char *const args
[] = {
198 test_spawn_prog(progname
, args
);
201 DEFINE_TEST(modprobe_param_kcmdline2
,
202 .description
= "check if params with no value are parsed correctly from kcmdline",
204 [TC_UNAME_R
] = "4.4.4",
205 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline2",
208 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline2/correct.txt",
210 .modules_loaded
= "",
213 static noreturn
int modprobe_param_kcmdline3(const struct test
*t
)
215 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
216 const char *const args
[] = {
222 test_spawn_prog(progname
, args
);
225 DEFINE_TEST(modprobe_param_kcmdline3
,
226 .description
= "check if unrelated strings in kcmdline are correctly ignored",
228 [TC_UNAME_R
] = "4.4.4",
229 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline3",
232 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline3/correct.txt",
234 .modules_loaded
= "",
237 static noreturn
int modprobe_param_kcmdline4(const struct test
*t
)
239 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
240 const char *const args
[] = {
246 test_spawn_prog(progname
, args
);
249 DEFINE_TEST(modprobe_param_kcmdline4
,
250 .description
= "check if unrelated strings in kcmdline are correctly ignored",
252 [TC_UNAME_R
] = "4.4.4",
253 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline4",
256 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline4/correct.txt",
258 .modules_loaded
= "",
261 static noreturn
int modprobe_force(const struct test
*t
)
263 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
264 const char *const args
[] = {
266 "--force", "psmouse",
270 test_spawn_prog(progname
, args
);
273 DEFINE_TEST(modprobe_force
,
274 .description
= "check modprobe --force",
276 [TC_UNAME_R
] = "4.4.4",
277 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/force",
278 [TC_INIT_MODULE_RETCODES
] = "",
280 .modules_loaded
= "psmouse",
283 static noreturn
int modprobe_oldkernel(const struct test
*t
)
285 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
286 const char *const args
[] = {
292 test_spawn_prog(progname
, args
);
295 DEFINE_TEST(modprobe_oldkernel
,
296 .description
= "check modprobe --force",
298 [TC_UNAME_R
] = "3.3.3",
299 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/oldkernel",
300 [TC_INIT_MODULE_RETCODES
] = "",
302 .modules_loaded
= "psmouse",
305 static noreturn
int modprobe_oldkernel_force(const struct test
*t
)
307 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
308 const char *const args
[] = {
310 "--force", "psmouse",
314 test_spawn_prog(progname
, args
);
317 DEFINE_TEST(modprobe_oldkernel_force
,
318 .description
= "check modprobe --force",
320 [TC_UNAME_R
] = "3.3.3",
321 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/oldkernel-force",
322 [TC_INIT_MODULE_RETCODES
] = "",
324 .modules_loaded
= "psmouse",