diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2012-01-29 16:02:20 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2012-01-30 20:05:34 -0200 |
commit | dfdfb962d3e204972facc8439239e258b7d59420 (patch) | |
tree | c79fc071bc50cecb2459ad0c673790c988d17f92 | |
parent | a9474303a45612d4817f61ff0d6106294239997b (diff) | |
download | kmod-dfdfb962d3e204972facc8439239e258b7d59420.tar.gz kmod-dfdfb962d3e204972facc8439239e258b7d59420.zip |
testsuite: check if dots are allowed in aliases
-rw-r--r-- | testsuite/rootfs.tar.xz | bin | 554084 -> 554196 bytes | |||
-rw-r--r-- | testsuite/test-new-module.c | 50 |
2 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/rootfs.tar.xz b/testsuite/rootfs.tar.xz Binary files differindex a37ba95..fa92e20 100644 --- a/testsuite/rootfs.tar.xz +++ b/testsuite/rootfs.tar.xz diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c index 81ee8af..1aa8ec9 100644 --- a/testsuite/test-new-module.c +++ b/testsuite/test-new-module.c @@ -72,8 +72,58 @@ static const struct test sfrom_name = { }, }; + +static int from_alias(const struct test *t) +{ + static const char *modnames[] = { + "ext4.*", + NULL, + }; + const char **p; + struct kmod_ctx *ctx; + int err; + + ctx = kmod_new(NULL, NULL); + if (ctx == NULL) + exit(EXIT_FAILURE); + + for (p = modnames; p != NULL; p++) { + struct kmod_list *l, *list = NULL; + + err = kmod_module_new_from_lookup(ctx, *p, &list); + if (err < 0) + exit(EXIT_SUCCESS); + + kmod_list_foreach(l, list) { + struct kmod_module *m; + m = kmod_module_get_module(l); + + printf("modname: %s\n", kmod_module_get_name(m)); + kmod_module_unref(m); + } + kmod_module_unref_list(list); + } + + kmod_unref(ctx); + + return EXIT_SUCCESS; +} +static const struct test sfrom_alias = { + .name = "sfrom_alias", + .description = "check if aliases are parsed correctly", + .func = from_alias, + .config = { + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-new-module/from_alias/", + }, + .need_spawn = true, + .output = { + .stdout = TESTSUITE_ROOTFS "test-new-module/from_alias/correct.txt", + }, +}; + static const struct test *tests[] = { &sfrom_name, + &sfrom_alias, NULL, }; |