summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2014-05-30 09:36:21 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2014-05-30 09:36:56 -0300
commit8183cfa9dac9216e4f50b2fb33a22ae0eac233e9 (patch)
treec2794646febaa405493d295211c2305f3b245d02
parenta873f2350f15a7803780f473257dc2467df0a229 (diff)
downloadkmod-8183cfa9dac9216e4f50b2fb33a22ae0eac233e9.tar.gz
kmod-8183cfa9dac9216e4f50b2fb33a22ae0eac233e9.tar.bz2
kmod-8183cfa9dac9216e4f50b2fb33a22ae0eac233e9.zip
testsuite: add test to fail depmod on module loops
-rw-r--r--testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleA.kobin0 -> 4713 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleB.kobin0 -> 4713 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleC.kobin0 -> 4713 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleD.kobin0 -> 4713 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleE.kobin0 -> 4713 bytes
-rw-r--r--testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/modules.order5
-rw-r--r--testsuite/test-depmod.c23
7 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleA.ko b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleA.ko
new file mode 100644
index 0000000..c48a418
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleA.ko
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleB.ko b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleB.ko
new file mode 100644
index 0000000..70dc122
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleB.ko
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleC.ko b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleC.ko
new file mode 100644
index 0000000..ded3201
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleC.ko
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleD.ko b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleD.ko
new file mode 100644
index 0000000..2c7273a
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleD.ko
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleE.ko b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleE.ko
new file mode 100644
index 0000000..393e825
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/kernel/moduleE.ko
Binary files differ
diff --git a/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/modules.order b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/modules.order
new file mode 100644
index 0000000..718a50e
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-depmod/detect-loop/lib/modules/4.4.4/modules.order
@@ -0,0 +1,5 @@
+kernel//home/lucas/p/kmod/testsuite/module-playground/moduleA.ko
+kernel//home/lucas/p/kmod/testsuite/module-playground/moduleB.ko
+kernel//home/lucas/p/kmod/testsuite/module-playground/moduleC.ko
+kernel//home/lucas/p/kmod/testsuite/module-playground/moduleD.ko
+kernel//home/lucas/p/kmod/testsuite/module-playground/moduleE.ko
diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 5b67348..c5caec4 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -106,6 +106,28 @@ static DEFINE_TEST(depmod_search_order_same_prefix,
},
});
+#define DETECT_LOOP_ROOTFS TESTSUITE_ROOTFS "test-depmod/detect-loop"
+static noreturn int depmod_detect_loop(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);
+}
+static DEFINE_TEST(depmod_detect_loop,
+ .description = "check if depmod detects module loops correctly",
+ .config = {
+ [TC_UNAME_R] = "4.4.4",
+ [TC_ROOTFS] = DETECT_LOOP_ROOTFS,
+ },
+ .expected_fail = true,
+ );
+
+
static const struct test *tests[] = {
#ifdef ENABLE_ZLIB
@@ -113,6 +135,7 @@ static const struct test *tests[] = {
#endif
&sdepmod_search_order_simple,
&sdepmod_search_order_same_prefix,
+ &sdepmod_detect_loop,
NULL,
};