testsuite: make test-dependencies use DEFINE_TEST

It went missing from previous conversions.
This commit is contained in:
Lucas De Marchi 2015-02-02 23:55:56 -02:00
parent 8dddac5999
commit d2db083ab6
1 changed files with 4 additions and 8 deletions

View File

@ -34,7 +34,7 @@
static int test_dependencies(const struct test *t)
{
struct kmod_ctx *ctx;
struct kmod_module *mod;
struct kmod_module *mod = NULL;
struct kmod_list *list, *l;
int err;
size_t len = 0;
@ -45,7 +45,7 @@ static int test_dependencies(const struct test *t)
return EXIT_FAILURE;
err = kmod_module_new_from_name(ctx, "ext4", &mod);
if (err < 0) {
if (err < 0 || mod == NULL) {
kmod_unref(ctx);
return EXIT_FAILURE;
}
@ -77,15 +77,11 @@ static int test_dependencies(const struct test *t)
return EXIT_SUCCESS;
}
static const struct test stest_dependencies = {
.name = "test_dependencies",
DEFINE_TEST(test_dependencies,
.description = "test if kmod_module_get_dependencies works",
.func = test_dependencies,
.config = {
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-dependencies/",
[TC_UNAME_R] = TEST_UNAME,
},
.need_spawn = true,
};
});
TESTSUITE_MAIN();