diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-03-19 09:15:59 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2014-03-19 09:22:20 -0300 |
commit | ad7f1757c03122506525c90d3d519a38aa1ceac2 (patch) | |
tree | 3a0555b940fcada688795cdf397bd53bdd8ff0ed /testsuite | |
parent | 49b33c1f215d5d58838845cbbaefc007bd0f9ac7 (diff) | |
download | kmod-ad7f1757c03122506525c90d3d519a38aa1ceac2.tar.gz kmod-ad7f1757c03122506525c90d3d519a38aa1ceac2.tar.bz2 kmod-ad7f1757c03122506525c90d3d519a38aa1ceac2.zip |
Add test for depmod using search dirs with same prefix
Test depmod with search dirs "foo" and "foobar". Previously to 49b33c1
("depmod: do not allow partial matches with "search" directive") we were
failing this test due to matching the prefix without checking if
it's the full dir name.
We are adding 2 tests here in order to catch the case we only pass the
test due to processing the directories in a favourable order.
Diffstat (limited to 'testsuite')
9 files changed, 59 insertions, 0 deletions
diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/etc/depmod.d/search.conf b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/etc/depmod.d/search.conf new file mode 100644 index 0000000..d43973e --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/etc/depmod.d/search.conf @@ -0,0 +1 @@ +search foobar foo built-in diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/correct-modules.dep new file mode 100644 index 0000000..7cac981 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/correct-modules.dep @@ -0,0 +1 @@ +foobar/md5.ko.gz: diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/foo/md5.ko.gz b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/foo/md5.ko.gz Binary files differnew file mode 100644 index 0000000..cf5ab6d --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/foo/md5.ko.gz diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/foobar/md5.ko.gz b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/foobar/md5.ko.gz Binary files differnew file mode 100644 index 0000000..cf5ab6d --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix/lib/modules/4.4.4/foobar/md5.ko.gz diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/etc/depmod.d/search.conf b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/etc/depmod.d/search.conf new file mode 100644 index 0000000..ddf4064 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/etc/depmod.d/search.conf @@ -0,0 +1 @@ +search foo foobar built-in diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/correct-modules.dep new file mode 100644 index 0000000..346a257 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/correct-modules.dep @@ -0,0 +1 @@ +foo/md5.ko.gz: diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/foo/md5.ko.gz b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/foo/md5.ko.gz Binary files differnew file mode 100644 index 0000000..cf5ab6d --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/foo/md5.ko.gz diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/foobar/md5.ko.gz b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/foobar/md5.ko.gz Binary files differnew file mode 100644 index 0000000..cf5ab6d --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-same-prefix2/lib/modules/4.4.4/foobar/md5.ko.gz diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index fe1d502..b6023f1 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -80,10 +80,65 @@ static DEFINE_TEST(depmod_search_order_simple, }, }); +#define SEARCH_ORDER_SAME_PREFIX_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix" +static noreturn int depmod_search_order_same_prefix(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_search_order_same_prefix, + .description = "check if depmod honor search order in config with same prefix", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = SEARCH_ORDER_SAME_PREFIX_ROOTFS, + }, + .output = { + .files = (const struct keyval[]) { + { SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", + SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { } + }, + }); + +#define SEARCH_ORDER_SAME_PREFIX2_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix2" +static noreturn int depmod_search_order_same_prefix2(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_search_order_same_prefix2, + .description = "check if depmod honor search order in config with same prefi: " + "the same as depmod_search_order_same_prefix, but in inverse order", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = SEARCH_ORDER_SAME_PREFIX2_ROOTFS, + }, + .output = { + .files = (const struct keyval[]) { + { SEARCH_ORDER_SAME_PREFIX2_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", + SEARCH_ORDER_SAME_PREFIX2_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { } + }, + }); + static const struct test *tests[] = { &sdepmod_modules_order_for_compressed, &sdepmod_search_order_simple, + &sdepmod_search_order_same_prefix, + &sdepmod_search_order_same_prefix2, NULL, }; |