2 * Copyright (C) 2012-2013 ProFUSION embedded systems
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
26 #include <libkmod/libkmod.h>
28 #include "testsuite.h"
30 static int from_name(const struct test *t)
32 static const char *modnames[] = {
34 "balbalbalbbalbalbalbalbalbalbal",
42 struct kmod_module *mod;
43 const char *null_config = NULL;
46 ctx = kmod_new(NULL, &null_config);
50 for (p = modnames; p != NULL; p++) {
51 err = kmod_module_new_from_name(ctx, *p, &mod);
55 printf("modname: %s\n", kmod_module_get_name(mod));
56 kmod_module_unref(mod);
63 DEFINE_TEST(from_name,
64 .description = "check if module names are parsed correctly",
66 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-new-module/from_name/",
70 .out = TESTSUITE_ROOTFS "test-new-module/from_name/correct.txt",
73 static int from_alias(const struct test *t)
75 static const char *modnames[] = {
83 ctx = kmod_new(NULL, NULL);
87 for (p = modnames; p != NULL; p++) {
88 struct kmod_list *l, *list = NULL;
90 err = kmod_module_new_from_lookup(ctx, *p, &list);
94 kmod_list_foreach(l, list) {
95 struct kmod_module *m;
96 m = kmod_module_get_module(l);
98 printf("modname: %s\n", kmod_module_get_name(m));
101 kmod_module_unref_list(list);
108 DEFINE_TEST(from_alias,
109 .description = "check if aliases are parsed correctly",
111 [TC_ROOTFS] = TESTSUITE_ROOTFS "test-new-module/from_alias/",
115 .out = TESTSUITE_ROOTFS "test-new-module/from_alias/correct.txt",