]>
git.ipfire.org Git - thirdparty/kmod.git/blob - testsuite/test-new-module.c
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, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "testsuite.h"
31 static int from_name(const struct test
*t
)
33 static const char *modnames
[] = {
35 "balbalbalbbalbalbalbalbalbalbal",
43 struct kmod_module
*mod
;
44 const char *null_config
= NULL
;
47 ctx
= kmod_new(NULL
, &null_config
);
51 for (p
= modnames
; p
!= NULL
; p
++) {
52 err
= kmod_module_new_from_name(ctx
, *p
, &mod
);
56 printf("modname: %s\n", kmod_module_get_name(mod
));
57 kmod_module_unref(mod
);
64 static DEFINE_TEST(from_name
,
65 .description
= "check if module names are parsed correctly",
67 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-new-module/from_name/",
71 .out
= TESTSUITE_ROOTFS
"test-new-module/from_name/correct.txt",
74 static int from_alias(const struct test
*t
)
76 static const char *modnames
[] = {
84 ctx
= kmod_new(NULL
, NULL
);
88 for (p
= modnames
; p
!= NULL
; p
++) {
89 struct kmod_list
*l
, *list
= NULL
;
91 err
= kmod_module_new_from_lookup(ctx
, *p
, &list
);
95 kmod_list_foreach(l
, list
) {
96 struct kmod_module
*m
;
97 m
= kmod_module_get_module(l
);
99 printf("modname: %s\n", kmod_module_get_name(m
));
100 kmod_module_unref(m
);
102 kmod_module_unref_list(list
);
109 static DEFINE_TEST(from_alias
,
110 .description
= "check if aliases are parsed correctly",
112 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-new-module/from_alias/",
116 .out
= TESTSUITE_ROOTFS
"test-new-module/from_alias/correct.txt",
119 static const struct test
*tests
[] = {
125 TESTSUITE_MAIN(tests
);