summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYauheni Kaliuta <yauheni.kaliuta@redhat.com>2017-12-07 21:16:07 +0200
committerLucas De Marchi <lucas.demarchi@intel.com>2017-12-07 13:08:00 -0800
commit809b9fb6cf6b1f5cd665a1da3fa296d705c2af2b (patch)
tree315e3e6a77e1462aaeaa401ff0849c4cb2d8a44a
parente22e1c1f6efb4b8643d159b4c66a5f392ad4ff5a (diff)
downloadkmod-809b9fb6cf6b1f5cd665a1da3fa296d705c2af2b.tar.gz
kmod-809b9fb6cf6b1f5cd665a1da3fa296d705c2af2b.tar.bz2
kmod-809b9fb6cf6b1f5cd665a1da3fa296d705c2af2b.zip
testsuite: depmod: add override test
Simple test to check if depmod honors override keyword. Uses mod-simple.ko for foo/ and override/ directories, search.conf to search in foo and built-in and simple override configuration: override mod-simple 4.4.4 override The resulting modules.dep should point to the override directory. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
-rwxr-xr-xtestsuite/populate-modules.sh2
-rw-r--r--testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf1
-rw-r--r--testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf1
-rw-r--r--testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep1
-rw-r--r--testsuite/test-depmod.c26
5 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh
index 3ac92ee..b77e71e 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/populate-modules.sh
@@ -28,6 +28,8 @@ map=(
["test-depmod/search-order-external-last/lib/modules/4.4.4/foo/"]="mod-simple.ko"
["test-depmod/search-order-external-last/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
["test-depmod/search-order-external-last/lib/modules/external/"]="mod-simple.ko"
+ ["test-depmod/search-order-override/lib/modules/4.4.4/foo/"]="mod-simple.ko"
+ ["test-depmod/search-order-override/lib/modules/4.4.4/override/"]="mod-simple.ko"
["test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
["test-dependencies/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
["test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf
new file mode 100644
index 0000000..fadf811
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf
@@ -0,0 +1 @@
+override mod-simple 4.4.4 override
diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf
new file mode 100644
index 0000000..289ddcd
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf
@@ -0,0 +1 @@
+search foo built-in
diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep
new file mode 100644
index 0000000..4c7ea8e
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep
@@ -0,0 +1 @@
+override/mod-simple.ko:
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index e249c61..47dafb4 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -183,4 +183,30 @@ DEFINE_TEST(depmod_search_order_external_last,
},
});
+#define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override"
+static noreturn int depmod_search_order_override(const struct test *t)
+{
+ const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
+ const char *const args[] = {
+ progname,
+ NULL,
+ };
+
+ test_spawn_prog(progname, args);
+ exit(EXIT_FAILURE);
+}
+DEFINE_TEST(depmod_search_order_override,
+ .description = "check if depmod honor override keyword",
+ .config = {
+ [TC_UNAME_R] = "4.4.4",
+ [TC_ROOTFS] = SEARCH_ORDER_OVERRIDE_ROOTFS,
+ },
+ .output = {
+ .files = (const struct keyval[]) {
+ { SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
+ SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+ { }
+ },
+ });
+
TESTSUITE_MAIN();