summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2018-11-13 10:45:00 -0800
committerLucas De Marchi <lucas.demarchi@intel.com>2018-11-13 10:45:00 -0800
commit068729e3688cbe7eb5a51821f14a668cca314ddf (patch)
treec9901ecbe92e02d7e6d281b9855c6664452f5362
parent3ada8df85c0d493bd8ff13d11eff33f9e4c37676 (diff)
downloadkmod-068729e3688cbe7eb5a51821f14a668cca314ddf.tar.gz
kmod-068729e3688cbe7eb5a51821f14a668cca314ddf.zip
testsuite: add simple test for --show-exports
-rwxr-xr-xtestsuite/populate-modules.sh1
-rw-r--r--testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt1
-rw-r--r--testsuite/test-modprobe.c22
3 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh
index b77e71e..ba68a69 100755
--- a/testsuite/populate-modules.sh
+++ b/testsuite/populate-modules.sh
@@ -39,6 +39,7 @@ map=(
["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko"
+ ["test-modprobe/show-exports/mod-loop-a.ko"]="mod-loop-a.ko"
["test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
["test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
["test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
diff --git a/testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt b/testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt
new file mode 100644
index 0000000..bc2d045
--- /dev/null
+++ b/testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt
@@ -0,0 +1 @@
+0x00000000 printA
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index ee9d82d..52a6621 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -95,6 +95,28 @@ DEFINE_TEST(modprobe_show_alias_to_none,
);
+static noreturn int modprobe_show_exports(const struct test *t)
+{
+ const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *const args[] = {
+ progname,
+ "--show-exports", "--quiet", "/mod-loop-a.ko",
+ NULL,
+ };
+
+ test_spawn_prog(progname, args);
+ exit(EXIT_FAILURE);
+}
+DEFINE_TEST(modprobe_show_exports,
+ .description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
+ .config = {
+ [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-exports",
+ },
+ .output = {
+ .out = TESTSUITE_ROOTFS "test-modprobe/show-exports/correct.txt",
+ });
+
+
static noreturn int modprobe_builtin(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";