testsuite: add check for kmod_load_resources master
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 10 Mar 2020 05:00:29 +0000 (22:00 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 23 Mar 2020 19:39:58 +0000 (12:39 -0700)
Make sure we can call kmod_load_resources when we do have all the
mandatory indexes in place.

testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias.bin [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin.bin [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep.bin [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.devname [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.softdep [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols [new file with mode: 0644]
testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols.bin [new file with mode: 0644]
testsuite/test-init.c

diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias
new file mode 100644 (file)
index 0000000..ba76e18
--- /dev/null
@@ -0,0 +1 @@
+# Aliases extracted from modules themselves.
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias.bin b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias.bin
new file mode 100644 (file)
index 0000000..7075435
Binary files /dev/null and b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.alias.bin differ
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin
new file mode 100644 (file)
index 0000000..1cbec61
--- /dev/null
@@ -0,0 +1 @@
+kernel/fake_builtin.ko
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin.bin b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin.bin
new file mode 100644 (file)
index 0000000..0423f03
Binary files /dev/null and b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.builtin.bin differ
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep.bin b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep.bin
new file mode 100644 (file)
index 0000000..7075435
Binary files /dev/null and b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.dep.bin differ
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.devname b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.devname
new file mode 100644 (file)
index 0000000..58f6d6d
--- /dev/null
@@ -0,0 +1 @@
+# Device nodes to trigger on-demand module loading.
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.softdep b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.softdep
new file mode 100644 (file)
index 0000000..5554ccc
--- /dev/null
@@ -0,0 +1 @@
+# Soft dependencies extracted from modules themselves.
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols
new file mode 100644 (file)
index 0000000..618c345
--- /dev/null
@@ -0,0 +1 @@
+# Aliases for symbols, used by symbol_request().
diff --git a/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols.bin b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols.bin
new file mode 100644 (file)
index 0000000..7075435
Binary files /dev/null and b/testsuite/rootfs-pristine/test-init-load-resources/lib/modules/5.6.0/modules.symbols.bin differ
index 9651280..3a69b43 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",
+           .config = {
+               [TC_ROOTFS] = TESTSUITE_ROOTFS "test-init-load-resources/",
+               [TC_UNAME_R] = "5.6.0",
+           },
+           .need_spawn = true);
+
+
 static noreturn int test_initlib(const struct test *t)
 {
        struct kmod_ctx *ctx;