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 "4.4.4"
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
);
43 DEFINE_TEST(depmod_modules_order_for_compressed
,
44 #if defined(KMOD_SYSCONFDIR_NOT_ETC)
47 .description
= "check if depmod let aliases in right order when using compressed modules",
49 [TC_UNAME_R
] = MODULES_ORDER_UNAME
,
50 [TC_ROOTFS
] = MODULES_ORDER_ROOTFS
,
53 .files
= (const struct keyval
[]) {
54 { MODULES_ORDER_LIB_MODULES
"/correct-modules.alias",
55 MODULES_ORDER_LIB_MODULES
"/modules.alias" },
60 #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
61 static noreturn
int depmod_search_order_simple(const struct test
*t
)
63 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
64 const char *const args
[] = {
69 test_spawn_prog(progname
, args
);
72 DEFINE_TEST(depmod_search_order_simple
,
73 .description
= "check if depmod honor search order in config",
75 [TC_UNAME_R
] = "4.4.4",
76 [TC_ROOTFS
] = SEARCH_ORDER_SIMPLE_ROOTFS
,
79 .files
= (const struct keyval
[]) {
80 { SEARCH_ORDER_SIMPLE_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
81 SEARCH_ORDER_SIMPLE_ROOTFS
"/lib/modules/4.4.4/modules.dep" },
86 #define SEARCH_ORDER_SAME_PREFIX_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix"
87 static noreturn
int depmod_search_order_same_prefix(const struct test
*t
)
89 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
90 const char *const args
[] = {
95 test_spawn_prog(progname
, args
);
98 DEFINE_TEST(depmod_search_order_same_prefix
,
99 .description
= "check if depmod honor search order in config with same prefix",
101 [TC_UNAME_R
] = "4.4.4",
102 [TC_ROOTFS
] = SEARCH_ORDER_SAME_PREFIX_ROOTFS
,
105 .files
= (const struct keyval
[]) {
106 { SEARCH_ORDER_SAME_PREFIX_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
107 SEARCH_ORDER_SAME_PREFIX_ROOTFS
"/lib/modules/4.4.4/modules.dep" },
112 #define DETECT_LOOP_ROOTFS TESTSUITE_ROOTFS "test-depmod/detect-loop"
113 static noreturn
int depmod_detect_loop(const struct test
*t
)
115 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
116 const char *const args
[] = {
121 test_spawn_prog(progname
, args
);
124 DEFINE_TEST(depmod_detect_loop
,
125 #if defined(KMOD_SYSCONFDIR_NOT_ETC)
128 .description
= "check if depmod detects module loops correctly",
130 [TC_UNAME_R
] = "4.4.4",
131 [TC_ROOTFS
] = DETECT_LOOP_ROOTFS
,
133 .expected_fail
= true,
135 .err
= DETECT_LOOP_ROOTFS
"/correct.txt",
138 #define SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-first"
139 static noreturn
int depmod_search_order_external_first(const struct test
*t
)
141 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
142 const char *const args
[] = {
147 test_spawn_prog(progname
, args
);
150 DEFINE_TEST(depmod_search_order_external_first
,
151 #if defined(KMOD_SYSCONFDIR_NOT_ETC)
154 .description
= "check if depmod honor external keyword with higher priority",
156 [TC_UNAME_R
] = "4.4.4",
157 [TC_ROOTFS
] = SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS
,
160 .files
= (const struct keyval
[]) {
161 { SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
162 SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS
"/lib/modules/4.4.4/modules.dep" },
167 #define SEARCH_ORDER_EXTERNAL_LAST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-last"
168 static noreturn
int depmod_search_order_external_last(const struct test
*t
)
170 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
171 const char *const args
[] = {
176 test_spawn_prog(progname
, args
);
179 DEFINE_TEST(depmod_search_order_external_last
,
180 .description
= "check if depmod honor external keyword with lower priority",
182 [TC_UNAME_R
] = "4.4.4",
183 [TC_ROOTFS
] = SEARCH_ORDER_EXTERNAL_LAST_ROOTFS
,
186 .files
= (const struct keyval
[]) {
187 { SEARCH_ORDER_EXTERNAL_LAST_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
188 SEARCH_ORDER_EXTERNAL_LAST_ROOTFS
"/lib/modules/4.4.4/modules.dep" },
193 #define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override"
194 static noreturn
int depmod_search_order_override(const struct test
*t
)
196 const char *progname
= ABS_TOP_BUILDDIR
"/tools/depmod";
197 const char *const args
[] = {
202 test_spawn_prog(progname
, args
);
205 DEFINE_TEST(depmod_search_order_override
,
206 #if defined(KMOD_SYSCONFDIR_NOT_ETC)
209 .description
= "check if depmod honor override keyword",
211 [TC_UNAME_R
] = "4.4.4",
212 [TC_ROOTFS
] = SEARCH_ORDER_OVERRIDE_ROOTFS
,
215 .files
= (const struct keyval
[]) {
216 { SEARCH_ORDER_OVERRIDE_ROOTFS
"/lib/modules/4.4.4/correct-modules.dep",
217 SEARCH_ORDER_OVERRIDE_ROOTFS
"/lib/modules/4.4.4/modules.dep" },