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 noreturn
int test_initlib(const struct test
*t
)
34 const char *null_config
= NULL
;
36 ctx
= kmod_new(NULL
, &null_config
);
44 DEFINE_TEST(test_initlib
,
45 .description
= "test if libkmod's init function work");
47 static noreturn
int test_insert(const struct test
*t
)
50 struct kmod_module
*mod
;
51 const char *null_config
= NULL
;
54 ctx
= kmod_new(NULL
, &null_config
);
58 err
= kmod_module_new_from_path(ctx
, "/ext4-x86_64.ko", &mod
);
60 ERR("could not create module from path: %m\n");
64 err
= kmod_module_insert_module(mod
, 0, NULL
);
66 ERR("could not insert module: %m\n");
73 DEFINE_TEST(test_insert
,
74 .description
= "test if libkmod's insert_module returns ok",
76 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-init/",
77 [TC_INIT_MODULE_RETCODES
] = "bla:1:20",
79 .modules_loaded
= "ext4",
82 static noreturn
int test_remove(const struct test
*t
)
85 struct kmod_module
*mod
;
86 const char *null_config
= NULL
;
89 ctx
= kmod_new(NULL
, &null_config
);
93 err
= kmod_module_new_from_name(ctx
, "ext4", &mod
);
95 ERR("could not create module from name: %m\n");
99 err
= kmod_module_remove_module(mod
, 0);
101 ERR("could not remove module: %m\n");
108 DEFINE_TEST(test_remove
,
109 .description
= "test if libkmod's remove_module returns ok",
111 [TC_ROOTFS
] = TESTSUITE_ROOTFS
"test-remove/",
112 [TC_DELETE_MODULE_RETCODES
] = "bla:1:20",
116 static const struct test
*tests
[] = {
123 TESTSUITE_MAIN(tests
);