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", "mod-loop-a",
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", "mod-simple",
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-mod-simple.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", "mod-simple",
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/alias-to-none/correct.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_builtin_lookup_only(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_builtin_lookup_only
,
130 .description
= "check if modprobe -R correctly returns the builtin module",
132 [TC_UNAME_R
] = "4.4.4",
133 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/builtin",
136 .out
= TESTSUITE_ROOTFS
"test-modprobe/builtin/correct.txt",
139 static noreturn
int modprobe_softdep_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_softdep_loop
,
152 .description
= "check if modprobe breaks softdep loop",
154 [TC_UNAME_R
] = "4.4.4",
155 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/softdep-loop",
156 [TC_INIT_MODULE_RETCODES
] = "",
158 .modules_loaded
= "mod-loop-a,mod-loop-b",
161 static noreturn
int modprobe_install_cmd_loop(const struct test
*t
)
163 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
164 const char *const args
[] = {
170 test_spawn_prog(progname
, args
);
173 DEFINE_TEST(modprobe_install_cmd_loop
,
174 .description
= "check if modprobe breaks install-commands loop",
176 [TC_UNAME_R
] = "4.4.4",
177 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/install-cmd-loop",
178 [TC_INIT_MODULE_RETCODES
] = "",
180 .env_vars
= (const struct keyval
[]) {
181 { "MODPROBE", ABS_TOP_BUILDDIR
"/tools/modprobe" },
184 .modules_loaded
= "mod-loop-b,mod-loop-a",
187 static noreturn
int modprobe_param_kcmdline(const struct test
*t
)
189 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
190 const char *const args
[] = {
192 "--show-depends", "mod-simple",
196 test_spawn_prog(progname
, args
);
199 DEFINE_TEST(modprobe_param_kcmdline
,
200 .description
= "check if params from kcmdline are passed to (f)init_module call",
202 [TC_UNAME_R
] = "4.4.4",
203 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline",
206 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline/correct.txt",
208 .modules_loaded
= "",
211 static noreturn
int modprobe_param_kcmdline2(const struct test
*t
)
213 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
214 const char *const args
[] = {
220 test_spawn_prog(progname
, args
);
223 DEFINE_TEST(modprobe_param_kcmdline2
,
224 .description
= "check if params with no value are parsed correctly from kcmdline",
226 [TC_UNAME_R
] = "4.4.4",
227 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline2",
230 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline2/correct.txt",
232 .modules_loaded
= "",
235 static noreturn
int modprobe_param_kcmdline3(const struct test
*t
)
237 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
238 const char *const args
[] = {
244 test_spawn_prog(progname
, args
);
247 DEFINE_TEST(modprobe_param_kcmdline3
,
248 .description
= "check if unrelated strings in kcmdline are correctly ignored",
250 [TC_UNAME_R
] = "4.4.4",
251 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline3",
254 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline3/correct.txt",
256 .modules_loaded
= "",
259 static noreturn
int modprobe_param_kcmdline4(const struct test
*t
)
261 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
262 const char *const args
[] = {
268 test_spawn_prog(progname
, args
);
271 DEFINE_TEST(modprobe_param_kcmdline4
,
272 .description
= "check if unrelated strings in kcmdline are correctly ignored",
274 [TC_UNAME_R
] = "4.4.4",
275 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline4",
278 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline4/correct.txt",
280 .modules_loaded
= "",
283 static noreturn
int modprobe_param_kcmdline5(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_param_kcmdline5
,
296 .description
= "check if params with spaces are parsed correctly from kcmdline",
298 [TC_UNAME_R
] = "4.4.4",
299 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline5",
302 .out
= TESTSUITE_ROOTFS
"test-modprobe/module-param-kcmdline5/correct.txt",
304 .modules_loaded
= "",
308 static noreturn
int modprobe_force(const struct test
*t
)
310 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
311 const char *const args
[] = {
313 "--force", "mod-simple",
317 test_spawn_prog(progname
, args
);
320 DEFINE_TEST(modprobe_force
,
321 .description
= "check modprobe --force",
323 [TC_UNAME_R
] = "4.4.4",
324 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/force",
325 [TC_INIT_MODULE_RETCODES
] = "",
327 .modules_loaded
= "mod-simple",
330 static noreturn
int modprobe_oldkernel(const struct test
*t
)
332 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
333 const char *const args
[] = {
339 test_spawn_prog(progname
, args
);
342 DEFINE_TEST(modprobe_oldkernel
,
343 .description
= "check modprobe with kernel without finit_module()",
345 [TC_UNAME_R
] = "3.3.3",
346 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/oldkernel",
347 [TC_INIT_MODULE_RETCODES
] = "",
349 .modules_loaded
= "mod-simple",
352 static noreturn
int modprobe_oldkernel_force(const struct test
*t
)
354 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
355 const char *const args
[] = {
357 "--force", "mod-simple",
361 test_spawn_prog(progname
, args
);
364 DEFINE_TEST(modprobe_oldkernel_force
,
365 .description
= "check modprobe --force with kernel without finit_module()",
367 [TC_UNAME_R
] = "3.3.3",
368 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/oldkernel-force",
369 [TC_INIT_MODULE_RETCODES
] = "",
371 .modules_loaded
= "mod-simple",
374 static noreturn
int modprobe_external(const struct test
*t
)
376 const char *progname
= ABS_TOP_BUILDDIR
"/tools/modprobe";
377 const char *const args
[] = {
383 test_spawn_prog(progname
, args
);
386 DEFINE_TEST(modprobe_external
,
387 .description
= "check modprobe able to load external module",
389 [TC_UNAME_R
] = "4.4.4",
390 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-modprobe/external",
391 [TC_INIT_MODULE_RETCODES
] = "",
393 .modules_loaded
= "mod-simple",