diff options
author | Yauheni Kaliuta <yauheni.kaliuta@redhat.com> | 2017-05-09 22:09:24 +0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2017-06-01 20:31:37 -0700 |
commit | df492f5ca3dc4d37323ee9e14fd4564e34264713 (patch) | |
tree | f0bdef5540dbcbebbdcbb907a655a4e602f2db47 | |
parent | 7da6884e7357ac05772e90f6d7e63b1948103fc4 (diff) | |
download | kmod-df492f5ca3dc4d37323ee9e14fd4564e34264713.tar.gz kmod-df492f5ca3dc4d37323ee9e14fd4564e34264713.tar.bz2 kmod-df492f5ca3dc4d37323ee9e14fd4564e34264713.zip |
testsuite: add tests for external directory support
The following tests added:
- depmod_search_order_external_first -- checks if external module
is taken in use when it has higher priority;
- depmod_search_order_external_last -- checks if external module
is skipped when it has lower priority;
- test_modinfo_external -- checks if modinfo is able to look up
correct external module;
- modprobe_external -- checks if modprobe is able to look up
correct external module and loads it.
Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
30 files changed, 118 insertions, 0 deletions
diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh index a7e5036..3ac92ee 100755 --- a/testsuite/populate-modules.sh +++ b/testsuite/populate-modules.sh @@ -22,6 +22,12 @@ map=( ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-i.ko"]="mod-loop-i.ko" ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-j.ko"]="mod-loop-j.ko" ["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-k.ko"]="mod-loop-k.ko" + ["test-depmod/search-order-external-first/lib/modules/4.4.4/foo/"]="mod-simple.ko" + ["test-depmod/search-order-external-first/lib/modules/4.4.4/foobar/"]="mod-simple.ko" + ["test-depmod/search-order-external-first/lib/modules/external/"]="mod-simple.ko" + ["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-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" @@ -40,6 +46,7 @@ map=( ["test-modprobe/oldkernel-force/lib/modules/3.3.3/kernel/"]="mod-simple.ko" ["test-modprobe/alias-to-none/lib/modules/4.4.4/kernel/"]="mod-simple.ko" ["test-modprobe/module-param-kcmdline/lib/modules/4.4.4/kernel/"]="mod-simple.ko" + ["test-modprobe/external/lib/modules/external/"]="mod-simple.ko" ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko" ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko" ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko" @@ -48,6 +55,7 @@ map=( ["test-modinfo/mod-simple-sparc64.ko"]="mod-simple-sparc64.ko" ["test-modinfo/mod-simple-sha1.ko"]="mod-simple.ko" ["test-modinfo/mod-simple-sha256.ko"]="mod-simple.ko" + ["test-modinfo/external/lib/modules/external/mod-simple.ko"]="mod-simple.ko" ["test-tools/insert/lib/modules/4.4.4/kernel/"]="mod-simple.ko" ["test-tools/remove/lib/modules/4.4.4/kernel/"]="mod-simple.ko" ) diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-external-first/etc/depmod.d/external.conf b/testsuite/rootfs-pristine/test-depmod/search-order-external-first/etc/depmod.d/external.conf new file mode 100644 index 0000000..59f46ae --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-external-first/etc/depmod.d/external.conf @@ -0,0 +1 @@ +external 4\.4\..* /lib/modules/external diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-external-first/etc/depmod.d/search.conf b/testsuite/rootfs-pristine/test-depmod/search-order-external-first/etc/depmod.d/search.conf new file mode 100644 index 0000000..642e497 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-external-first/etc/depmod.d/search.conf @@ -0,0 +1 @@ +search external foobar foo built-in diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-external-first/lib/modules/4.4.4/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/search-order-external-first/lib/modules/4.4.4/correct-modules.dep new file mode 100644 index 0000000..e612900 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-external-first/lib/modules/4.4.4/correct-modules.dep @@ -0,0 +1 @@ +/lib/modules/external/mod-simple.ko: diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-external-last/etc/depmod.d/external.conf b/testsuite/rootfs-pristine/test-depmod/search-order-external-last/etc/depmod.d/external.conf new file mode 100644 index 0000000..59f46ae --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-external-last/etc/depmod.d/external.conf @@ -0,0 +1 @@ +external 4\.4\..* /lib/modules/external diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-external-last/etc/depmod.d/search.conf b/testsuite/rootfs-pristine/test-depmod/search-order-external-last/etc/depmod.d/search.conf new file mode 100644 index 0000000..5fdb812 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-external-last/etc/depmod.d/search.conf @@ -0,0 +1 @@ +search foobar foo built-in external diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-external-last/lib/modules/4.4.4/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/search-order-external-last/lib/modules/4.4.4/correct-modules.dep new file mode 100644 index 0000000..eab3bb0 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-external-last/lib/modules/4.4.4/correct-modules.dep @@ -0,0 +1 @@ +foobar/mod-simple.ko: diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-external.txt b/testsuite/rootfs-pristine/test-modinfo/correct-external.txt new file mode 100644 index 0000000..a094abe --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/correct-external.txt @@ -0,0 +1 @@ +/lib/modules/external/mod-simple.ko diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.alias new file mode 100644 index 0000000..ba76e18 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.alias @@ -0,0 +1 @@ +# Aliases extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.alias.bin Binary files differnew file mode 100644 index 0000000..7075435 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.alias.bin diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.builtin.bin new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.builtin.bin diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.dep new file mode 100644 index 0000000..e612900 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.dep @@ -0,0 +1 @@ +/lib/modules/external/mod-simple.ko: diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.dep.bin Binary files differnew file mode 100644 index 0000000..556e3c8 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.dep.bin diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.devname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.devname diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.softdep new file mode 100644 index 0000000..5554ccc --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.softdep @@ -0,0 +1 @@ +# Soft dependencies extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.symbols new file mode 100644 index 0000000..618c345 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.symbols @@ -0,0 +1 @@ +# Aliases for symbols, used by symbol_request(). diff --git a/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.symbols.bin Binary files differnew file mode 100644 index 0000000..7075435 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/external/lib/modules/4.4.4/modules.symbols.bin diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.alias b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.alias new file mode 100644 index 0000000..ba76e18 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.alias @@ -0,0 +1 @@ +# Aliases extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.alias.bin b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.alias.bin Binary files differnew file mode 100644 index 0000000..7075435 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.alias.bin diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.builtin.bin b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.builtin.bin new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.builtin.bin diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.dep b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.dep new file mode 100644 index 0000000..e612900 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.dep @@ -0,0 +1 @@ +/lib/modules/external/mod-simple.ko: diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.dep.bin b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.dep.bin Binary files differnew file mode 100644 index 0000000..556e3c8 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.dep.bin diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.devname b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.devname new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.devname diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.softdep b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.softdep new file mode 100644 index 0000000..5554ccc --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.softdep @@ -0,0 +1 @@ +# Soft dependencies extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.symbols b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.symbols new file mode 100644 index 0000000..618c345 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.symbols @@ -0,0 +1 @@ +# Aliases for symbols, used by symbol_request(). diff --git a/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.symbols.bin b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.symbols.bin Binary files differnew file mode 100644 index 0000000..7075435 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/lib/modules/4.4.4/modules.symbols.bin diff --git a/testsuite/rootfs-pristine/test-modprobe/external/proc/modules b/testsuite/rootfs-pristine/test-modprobe/external/proc/modules new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/external/proc/modules diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index b9beb01..e249c61 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -131,4 +131,56 @@ DEFINE_TEST(depmod_detect_loop, .err = DETECT_LOOP_ROOTFS "/correct.txt", }); +#define SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-first" +static noreturn int depmod_search_order_external_first(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_external_first, + .description = "check if depmod honor external keyword with higher priority", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS, + }, + .output = { + .files = (const struct keyval[]) { + { SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", + SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { } + }, + }); + +#define SEARCH_ORDER_EXTERNAL_LAST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-last" +static noreturn int depmod_search_order_external_last(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_external_last, + .description = "check if depmod honor external keyword with lower priority", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_LAST_ROOTFS, + }, + .output = { + .files = (const struct keyval[]) { + { SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", + SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { } + }, + }); + TESTSUITE_MAIN(); diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c index 4877502..8fdfe35 100644 --- a/testsuite/test-modinfo.c +++ b/testsuite/test-modinfo.c @@ -89,4 +89,25 @@ DEFINE_TEST(test_modinfo_signature, .out = TESTSUITE_ROOTFS "test-modinfo/correct.txt", }); #endif + +static noreturn int test_modinfo_external(const struct test *t) +{ + const char *const args[] = { + progname, "-F", "filename", + "mod-simple", + NULL, + }; + test_spawn_prog(progname, args); + exit(EXIT_FAILURE); +} +DEFINE_TEST(test_modinfo_external, + .description = "check if modinfo finds external module", + .config = { + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/external", + [TC_UNAME_R] = "4.4.4", + }, + .output = { + .out = TESTSUITE_ROOTFS "test-modinfo/correct-external.txt", + }) + TESTSUITE_MAIN(); diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index e0dd199..ee9d82d 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -371,4 +371,26 @@ DEFINE_TEST(modprobe_oldkernel_force, .modules_loaded = "mod-simple", ); +static noreturn int modprobe_external(const struct test *t) +{ + const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe"; + const char *const args[] = { + progname, + "mod-simple", + NULL, + }; + + test_spawn_prog(progname, args); + exit(EXIT_FAILURE); +} +DEFINE_TEST(modprobe_external, + .description = "check modprobe able to load external module", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/external", + [TC_INIT_MODULE_RETCODES] = "", + }, + .modules_loaded = "mod-simple", + ); + TESTSUITE_MAIN(); |