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 #define MODULES_ORDER_UNAME "3.5.4-1-ARCH"
29 #define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
30 #define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME
31 static noreturn
int depmod_modules_order_for_compressed(const struct test
*t
)
33 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
34 const char *const args
[] = {
39 test_spawn_prog(progname
, args
);
44 DEFINE_TEST(depmod_modules_order_for_compressed
,
45 .description
= "check if depmod let aliases in right order when using compressed modules",
47 [TC_UNAME_R
] = MODULES_ORDER_UNAME
,
48 [TC_ROOTFS
] = MODULES_ORDER_ROOTFS
,
51 .files
= (const struct keyval
[]) {
52 { MODULES_ORDER_LIB_MODULES
"/correct-modules.alias",
53 MODULES_ORDER_LIB_MODULES
"/modules.alias" },
59 #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
60 static noreturn
int depmod_search_order_simple(const struct test
*t
)
62 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
63 const char *const args
[] = {
68 test_spawn_prog(progname
, args
);
71 DEFINE_TEST(depmod_search_order_simple
,
72 .description
= "check if depmod honor search order in config",
74 [TC_UNAME_R
] = "4.4.4",
75 [TC_ROOTFS
] = SEARCH_ORDER_SIMPLE_ROOTFS
,
78 .files
= (const struct keyval
[]) {
79 { SEARCH_ORDER_SIMPLE_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
80 SEARCH_ORDER_SIMPLE_ROOTFS
"/lib/modules/4.4.4/modules.dep" },
85 #define SEARCH_ORDER_SAME_PREFIX_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix"
86 static noreturn
int depmod_search_order_same_prefix(const struct test
*t
)
88 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
89 const char *const args
[] = {
94 test_spawn_prog(progname
, args
);
97 DEFINE_TEST(depmod_search_order_same_prefix
,
98 .description
= "check if depmod honor search order in config with same prefix",
100 [TC_UNAME_R
] = "4.4.4",
101 [TC_ROOTFS
] = SEARCH_ORDER_SAME_PREFIX_ROOTFS
,
104 .files
= (const struct keyval
[]) {
105 { SEARCH_ORDER_SAME_PREFIX_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
106 SEARCH_ORDER_SAME_PREFIX_ROOTFS
"/lib/modules/4.4.4/modules.dep" },
111 #define DETECT_LOOP_ROOTFS TESTSUITE_ROOTFS "test-depmod/detect-loop"
112 static noreturn
int depmod_detect_loop(const struct test
*t
)
114 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
115 const char *const args
[] = {
120 test_spawn_prog(progname
, args
);
123 DEFINE_TEST(depmod_detect_loop
,
124 .description
= "check if depmod detects module loops correctly",
126 [TC_UNAME_R
] = "4.4.4",
127 [TC_ROOTFS
] = DETECT_LOOP_ROOTFS
,
129 .expected_fail
= true,
131 .err
= DETECT_LOOP_ROOTFS
"/correct.txt",