]> git.ipfire.org Git - thirdparty/kmod.git/blobdiff - testsuite/test-init.c
Install kmod.pc in ${datadir}/pkgconfig
[thirdparty/kmod.git] / testsuite / test-init.c
index 96512808b82951fc5b013f3cd6e217e6fb0c172c..edbfc233160165e567b203a8e4360cfbdb0fa729 100644 (file)
 
 #include "testsuite.h"
 
+static noreturn int test_load_resources(const struct test *t)
+{
+       struct kmod_ctx *ctx;
+       const char *null_config = NULL;
+       int err;
+
+       ctx = kmod_new(NULL, &null_config);
+       if (ctx == NULL)
+               exit(EXIT_FAILURE);
+
+       kmod_set_log_priority(ctx, 7);
+
+       err = kmod_load_resources(ctx);
+       if (err != 0) {
+               ERR("could not load libkmod resources: %s\n", strerror(-err));
+               exit(EXIT_FAILURE);
+       }
+
+       kmod_unref(ctx);
+
+       exit(EXIT_SUCCESS);
+}
+DEFINE_TEST(test_load_resources,
+           .description = "test if kmod_load_resources works (recent modprobe on kernel without modules.builtin.modinfo)",
+           .config = {
+               [TC_ROOTFS] = TESTSUITE_ROOTFS "test-init-load-resources/",
+               [TC_UNAME_R] = "5.6.0",
+           },
+           .need_spawn = true);
+
+DEFINE_TEST(test_load_resources,
+           .description = "test if kmod_load_resources works with empty modules.builtin.aliases.bin (recent depmod on kernel without modules.builtin.modinfo)",
+           .config = {
+               [TC_ROOTFS] = TESTSUITE_ROOTFS "test-init-load-resources-empty-builtin-aliases-bin/",
+               [TC_UNAME_R] = "5.6.0",
+           },
+           .need_spawn = true);
+
 static noreturn int test_initlib(const struct test *t)
 {
        struct kmod_ctx *ctx;