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_show_exports(const struct test *t)
100 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
101 const char *const args[] = {
103 "--show-exports", "--quiet", "/mod-loop-a.ko",
107 test_spawn_prog(progname, args);
110 DEFINE_TEST(modprobe_show_exports,
111 .description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
113 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-exports",
116 .out = TESTSUITE_ROOTFS "test-modprobe/show-exports/correct.txt",
121 static noreturn int modprobe_builtin(const struct test *t)
123 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
124 const char *const args[] = {
130 test_spawn_prog(progname, args);
133 DEFINE_TEST(modprobe_builtin,
134 .description = "check if modprobe return 0 for builtin",
136 [TC_UNAME_R] = "4.4.4",
137 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/builtin",
140 static noreturn int modprobe_builtin_lookup_only(const struct test *t)
142 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
143 const char *const args[] = {
149 test_spawn_prog(progname, args);
152 DEFINE_TEST(modprobe_builtin_lookup_only,
153 .description = "check if modprobe -R correctly returns the builtin module",
155 [TC_UNAME_R] = "4.4.4",
156 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/builtin",
159 .out = TESTSUITE_ROOTFS "test-modprobe/builtin/correct.txt",
162 static noreturn int modprobe_softdep_loop(const struct test *t)
164 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
165 const char *const args[] = {
171 test_spawn_prog(progname, args);
174 DEFINE_TEST(modprobe_softdep_loop,
175 .description = "check if modprobe breaks softdep loop",
177 [TC_UNAME_R] = "4.4.4",
178 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/softdep-loop",
179 [TC_INIT_MODULE_RETCODES] = "",
181 .modules_loaded = "mod-loop-a,mod-loop-b",
184 static noreturn int modprobe_install_cmd_loop(const struct test *t)
186 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
187 const char *const args[] = {
193 test_spawn_prog(progname, args);
196 DEFINE_TEST(modprobe_install_cmd_loop,
197 .description = "check if modprobe breaks install-commands loop",
199 [TC_UNAME_R] = "4.4.4",
200 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/install-cmd-loop",
201 [TC_INIT_MODULE_RETCODES] = "",
203 .env_vars = (const struct keyval[]) {
204 { "MODPROBE", ABS_TOP_BUILDDIR "/tools/modprobe" },
207 .modules_loaded = "mod-loop-b,mod-loop-a",
210 static noreturn int modprobe_param_kcmdline(const struct test *t)
212 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
213 const char *const args[] = {
215 "--show-depends", "mod-simple",
219 test_spawn_prog(progname, args);
222 DEFINE_TEST(modprobe_param_kcmdline,
223 .description = "check if params from kcmdline are passed to (f)init_module call",
225 [TC_UNAME_R] = "4.4.4",
226 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline",
229 .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline/correct.txt",
231 .modules_loaded = "",
234 static noreturn int modprobe_param_kcmdline2(const struct test *t)
236 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
237 const char *const args[] = {
243 test_spawn_prog(progname, args);
246 DEFINE_TEST(modprobe_param_kcmdline2,
247 .description = "check if params with no value are parsed correctly from kcmdline",
249 [TC_UNAME_R] = "4.4.4",
250 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline2",
253 .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline2/correct.txt",
255 .modules_loaded = "",
258 static noreturn int modprobe_param_kcmdline3(const struct test *t)
260 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
261 const char *const args[] = {
267 test_spawn_prog(progname, args);
270 DEFINE_TEST(modprobe_param_kcmdline3,
271 .description = "check if unrelated strings in kcmdline are correctly ignored",
273 [TC_UNAME_R] = "4.4.4",
274 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline3",
277 .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline3/correct.txt",
279 .modules_loaded = "",
282 static noreturn int modprobe_param_kcmdline4(const struct test *t)
284 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
285 const char *const args[] = {
291 test_spawn_prog(progname, args);
294 DEFINE_TEST(modprobe_param_kcmdline4,
295 .description = "check if unrelated strings in kcmdline are correctly ignored",
297 [TC_UNAME_R] = "4.4.4",
298 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline4",
301 .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline4/correct.txt",
303 .modules_loaded = "",
306 static noreturn int modprobe_param_kcmdline5(const struct test *t)
308 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
309 const char *const args[] = {
315 test_spawn_prog(progname, args);
318 DEFINE_TEST(modprobe_param_kcmdline5,
319 .description = "check if params with spaces are parsed correctly from kcmdline",
321 [TC_UNAME_R] = "4.4.4",
322 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline5",
325 .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline5/correct.txt",
327 .modules_loaded = "",
331 static noreturn int modprobe_param_kcmdline6(const struct test *t)
333 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
334 const char *const args[] = {
340 test_spawn_prog(progname, args);
343 DEFINE_TEST(modprobe_param_kcmdline6,
344 .description = "check if dots on other parts of kcmdline don't confuse our parser",
346 [TC_UNAME_R] = "4.4.4",
347 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline6",
350 .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline6/correct.txt",
352 .modules_loaded = "",
356 static noreturn int modprobe_force(const struct test *t)
358 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
359 const char *const args[] = {
361 "--force", "mod-simple",
365 test_spawn_prog(progname, args);
368 DEFINE_TEST(modprobe_force,
369 .description = "check modprobe --force",
371 [TC_UNAME_R] = "4.4.4",
372 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/force",
373 [TC_INIT_MODULE_RETCODES] = "",
375 .modules_loaded = "mod-simple",
378 static noreturn int modprobe_oldkernel(const struct test *t)
380 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
381 const char *const args[] = {
387 test_spawn_prog(progname, args);
390 DEFINE_TEST(modprobe_oldkernel,
391 .description = "check modprobe with kernel without finit_module()",
393 [TC_UNAME_R] = "3.3.3",
394 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/oldkernel",
395 [TC_INIT_MODULE_RETCODES] = "",
397 .modules_loaded = "mod-simple",
400 static noreturn int modprobe_oldkernel_force(const struct test *t)
402 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
403 const char *const args[] = {
405 "--force", "mod-simple",
409 test_spawn_prog(progname, args);
412 DEFINE_TEST(modprobe_oldkernel_force,
413 .description = "check modprobe --force with kernel without finit_module()",
415 [TC_UNAME_R] = "3.3.3",
416 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/oldkernel-force",
417 [TC_INIT_MODULE_RETCODES] = "",
419 .modules_loaded = "mod-simple",
422 static noreturn int modprobe_external(const struct test *t)
424 const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
425 const char *const args[] = {
431 test_spawn_prog(progname, args);
434 DEFINE_TEST(modprobe_external,
435 .description = "check modprobe able to load external module",
437 [TC_UNAME_R] = "4.4.4",
438 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/external",
439 [TC_INIT_MODULE_RETCODES] = "",
441 .modules_loaded = "mod-simple",