]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: stop passing struct test to the test itself
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 29 May 2025 14:31:36 +0000 (15:31 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 11 Jun 2025 12:54:40 +0000 (07:54 -0500)
None of our tests require the test fixture details. Stop passing it into
the test function itself.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/361
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
20 files changed:
testsuite/test-array.c
testsuite/test-blacklist.c
testsuite/test-dependencies.c
testsuite/test-depmod.c
testsuite/test-hash.c
testsuite/test-init.c
testsuite/test-initstate.c
testsuite/test-list.c
testsuite/test-loaded.c
testsuite/test-modinfo.c
testsuite/test-modprobe.c
testsuite/test-multi-softdep.c
testsuite/test-new-module.c
testsuite/test-remove.c
testsuite/test-strbuf.c
testsuite/test-testsuite.c
testsuite/test-util.c
testsuite/test-weakdep.c
testsuite/testsuite.c
testsuite/testsuite.h

index 913826407c24d6e1938eebf3dade56c7bdf4df40..b306982ac3dd3a0ab909822b1f7d1c7212ed2061 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "testsuite.h"
 
-static int test_array_append1(const struct test *t)
+static int test_array_append1(void)
 {
        struct array array;
        const char *c1 = "test1";
@@ -29,7 +29,7 @@ static int test_array_append1(const struct test *t)
 }
 DEFINE_TEST(test_array_append1, .description = "test simple array append");
 
-static int test_array_append2(const struct test *t)
+static int test_array_append2(void)
 {
        struct array array;
        const char *c1 = "test1";
@@ -50,7 +50,7 @@ static int test_array_append2(const struct test *t)
 }
 DEFINE_TEST(test_array_append2, .description = "test array append over step");
 
-static int test_array_append_unique(const struct test *t)
+static int test_array_append_unique(void)
 {
        struct array array;
        const char *c1 = "test1";
@@ -82,7 +82,7 @@ static int strptrcmp(const void *pa, const void *pb)
        return strcmp(a, b);
 }
 
-static int test_array_sort(const struct test *t)
+static int test_array_sort(void)
 {
        struct array array;
        const char *c1 = "test1";
@@ -110,7 +110,7 @@ static int test_array_sort(const struct test *t)
 }
 DEFINE_TEST(test_array_sort, .description = "test array sort");
 
-static int test_array_remove_at(const struct test *t)
+static int test_array_remove_at(void)
 {
        struct array array;
        const char *c1 = "test1";
@@ -153,7 +153,7 @@ static int test_array_remove_at(const struct test *t)
 }
 DEFINE_TEST(test_array_remove_at, .description = "test array remove at");
 
-static int test_array_pop(const struct test *t)
+static int test_array_pop(void)
 {
        struct array array;
        const char *c1 = "test1";
index 580a259e301f63820571ad0a53c41208c86a7401..c763d4589b3c8cb95cab442aac49a90a2142cc7b 100644 (file)
@@ -23,7 +23,7 @@
 #undef ERR
 #include "testsuite.h"
 
-static int blacklist_1(const struct test *t)
+static int blacklist_1(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_list *list = NULL, *l, *filtered;
index f315af1b0611424be50ad2be6db3079aa976f3ec..aa6416ae65e41413ab8fbd22af2f51e9d8a939b2 100644 (file)
@@ -19,7 +19,7 @@
 
 #define TEST_UNAME "4.0.20-kmod"
 
-static noreturn int test_dependencies(const struct test *t)
+static noreturn int test_dependencies(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod = NULL;
index ec157b2c75c30ec9217484ffadaa7ed65802848f..b06c93ed908d62ca2f48114f97a8de1917ef453c 100644 (file)
@@ -21,7 +21,7 @@
 #define MODULES_UNAME "4.4.4"
 #define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
 #define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_modules_order_for_compressed(const struct test *t)
+static noreturn int depmod_modules_order_for_compressed(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -45,7 +45,7 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
        MODULES_OUTDIR_ROOTFS "/outdir" MODULE_DIRECTORY "/" MODULES_UNAME
 #define MODULES_OUTDIR_LIB_MODULES_INPUT \
        MODULES_OUTDIR_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_modules_outdir(const struct test *t)
+static noreturn int depmod_modules_outdir(void)
 {
        EXEC_DEPMOD("--outdir", "/outdir/");
        exit(EXIT_FAILURE);
@@ -69,7 +69,7 @@ DEFINE_TEST(depmod_modules_outdir,
 #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
 #define SEARCH_ORDER_SIMPLE_LIB_MODULES \
        SEARCH_ORDER_SIMPLE_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_search_order_simple(const struct test *t)
+static noreturn int depmod_search_order_simple(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -91,12 +91,12 @@ DEFINE_TEST(depmod_search_order_simple,
 #define ANOTHER_MODDIR "/foobar"
 #define RELATIVE_MODDIR "foobar2"
 #define MODULES_ANOTHER_MODDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/another-moddir"
-static noreturn int depmod_another_moddir(const struct test *t)
+static noreturn int depmod_another_moddir(void)
 {
        EXEC_DEPMOD("-m", ANOTHER_MODDIR);
        exit(EXIT_FAILURE);
 }
-static noreturn int depmod_another_moddir_relative(const struct test *t)
+static noreturn int depmod_another_moddir_relative(void)
 {
        EXEC_DEPMOD("-m", RELATIVE_MODDIR);
        exit(EXIT_FAILURE);
@@ -132,7 +132,7 @@ DEFINE_TEST(depmod_another_moddir_relative,
        TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix"
 #define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES \
        SEARCH_ORDER_SAME_PREFIX_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_search_order_same_prefix(const struct test *t)
+static noreturn int depmod_search_order_same_prefix(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -152,7 +152,7 @@ DEFINE_TEST(depmod_search_order_same_prefix,
        });
 
 #define DETECT_LOOP_ROOTFS TESTSUITE_ROOTFS "test-depmod/detect-loop"
-static noreturn int depmod_detect_loop(const struct test *t)
+static noreturn int depmod_detect_loop(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -172,7 +172,7 @@ DEFINE_TEST(depmod_detect_loop,
        TESTSUITE_ROOTFS "test-depmod/search-order-external-first"
 #define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES \
        SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_search_order_external_first(const struct test *t)
+static noreturn int depmod_search_order_external_first(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -195,7 +195,7 @@ DEFINE_TEST(depmod_search_order_external_first,
        TESTSUITE_ROOTFS "test-depmod/search-order-external-last"
 #define SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES \
        SEARCH_ORDER_EXTERNAL_LAST_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_search_order_external_last(const struct test *t)
+static noreturn int depmod_search_order_external_last(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -217,7 +217,7 @@ DEFINE_TEST(depmod_search_order_external_last,
 #define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override"
 #define SEARCH_ORDER_OVERRIDE_LIB_MODULES \
        SEARCH_ORDER_OVERRIDE_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_search_order_override(const struct test *t)
+static noreturn int depmod_search_order_override(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
@@ -238,7 +238,7 @@ DEFINE_TEST(depmod_search_order_override,
 
 #define CHECK_WEAKDEP_ROOTFS TESTSUITE_ROOTFS "test-depmod/check-weakdep"
 #define CHECK_WEAKDEP_LIB_MODULES CHECK_WEAKDEP_ROOTFS MODULE_DIRECTORY "/" MODULES_UNAME
-static noreturn int depmod_check_weakdep(const struct test *t)
+static noreturn int depmod_check_weakdep(void)
 {
        EXEC_DEPMOD();
        exit(EXIT_FAILURE);
index 16fe58942e47ae7fa956fc02064e2159182b68e1..07d2a4a995636884825a7c86d051a8ca78e6ddfd 100644 (file)
@@ -22,7 +22,7 @@ static void countfreecalls(void *v)
        freecount++;
 }
 
-static int test_hash_new(const struct test *t)
+static int test_hash_new(void)
 {
        struct hash *h = hash_new(8, NULL);
        assert_return(h != NULL, EXIT_FAILURE);
@@ -31,7 +31,7 @@ static int test_hash_new(const struct test *t)
 }
 DEFINE_TEST(test_hash_new, .description = "test hash_new");
 
-static int test_hash_get_count(const struct test *t)
+static int test_hash_get_count(void)
 {
        struct hash *h = hash_new(8, NULL);
        const char *k1 = "k1", *k2 = "k2", *k3 = "k3";
@@ -48,7 +48,7 @@ static int test_hash_get_count(const struct test *t)
 }
 DEFINE_TEST(test_hash_get_count, .description = "test hash_add / hash_get_count");
 
-static int test_hash_replace(const struct test *t)
+static int test_hash_replace(void)
 {
        struct hash *h = hash_new(8, countfreecalls);
        const char *k1 = "k1", *k2 = "k2", *k3 = "k3";
@@ -76,7 +76,7 @@ static int test_hash_replace(const struct test *t)
 }
 DEFINE_TEST(test_hash_replace, .description = "test hash_add replacing existing value");
 
-static int test_hash_replace_failing(const struct test *t)
+static int test_hash_replace_failing(void)
 {
        struct hash *h = hash_new(8, countfreecalls);
        const char *k1 = "k1", *k2 = "k2", *k3 = "k3";
@@ -106,7 +106,7 @@ static int test_hash_replace_failing(const struct test *t)
 DEFINE_TEST(test_hash_replace_failing,
            .description = "test hash_add_unique failing to replace existing value");
 
-static int test_hash_iter(const struct test *t)
+static int test_hash_iter(void)
 {
        struct hash *h = hash_new(8, NULL);
        struct hash *h2 = hash_new(8, NULL);
@@ -137,7 +137,7 @@ static int test_hash_iter(const struct test *t)
 }
 DEFINE_TEST(test_hash_iter, .description = "test hash_iter");
 
-static int test_hash_iter_after_del(const struct test *t)
+static int test_hash_iter_after_del(void)
 {
        struct hash *h = hash_new(8, NULL);
        struct hash *h2 = hash_new(8, NULL);
@@ -171,7 +171,7 @@ static int test_hash_iter_after_del(const struct test *t)
 DEFINE_TEST(test_hash_iter_after_del,
            .description = "test hash_iter, after deleting element");
 
-static int test_hash_del(const struct test *t)
+static int test_hash_del(void)
 {
        struct hash *h = hash_new(32, NULL);
        const char *k1 = "k1";
@@ -186,7 +186,7 @@ static int test_hash_del(const struct test *t)
 }
 DEFINE_TEST(test_hash_del, .description = "test add / delete a single element");
 
-static int test_hash_del_nonexistent(const struct test *t)
+static int test_hash_del_nonexistent(void)
 {
        struct hash *h = hash_new(32, NULL);
        const char *k1 = "k1";
@@ -202,7 +202,7 @@ static int test_hash_del_nonexistent(const struct test *t)
 DEFINE_TEST(test_hash_del_nonexistent,
            .description = "test deleting an element that doesn't exist");
 
-static int test_hash_free(const struct test *t)
+static int test_hash_free(void)
 {
        struct hash *h = hash_new(8, countfreecalls);
        const char *k1 = "k1", *k2 = "k2", *k3 = "k3";
@@ -227,7 +227,7 @@ static int test_hash_free(const struct test *t)
 DEFINE_TEST(test_hash_free,
            .description = "test hash_free calling free function for all values");
 
-static int test_hash_add_unique(const struct test *t)
+static int test_hash_add_unique(void)
 {
        const char *k[] = { "k1", "k2", "k3", "k4", "k5" };
        const char *v[] = { "v1", "v2", "v3", "v4", "v5" };
@@ -252,7 +252,7 @@ static int test_hash_add_unique(const struct test *t)
 DEFINE_TEST(test_hash_add_unique,
            .description = "test hash_add_unique with different key orders");
 
-static int test_hash_massive_add_del(const struct test *t)
+static int test_hash_massive_add_del(void)
 {
        char buf[1024 * 8];
        char *k;
index d23e8a34df913305e0d4cd262a1b156feac9a06e..4bb12e2175bc1350f7fc00b5277f2dedcc66013c 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "testsuite.h"
 
-static noreturn int test_load_resources(const struct test *t)
+static noreturn int test_load_resources(void)
 {
        struct kmod_ctx *ctx;
        const char *null_config = NULL;
@@ -58,7 +58,7 @@ DEFINE_TEST_WITH_FUNC(
                [TC_UNAME_R] = "5.6.0",
        });
 
-static noreturn int test_initlib(const struct test *t)
+static noreturn int test_initlib(void)
 {
        struct kmod_ctx *ctx;
        const char *null_config = NULL;
@@ -73,7 +73,7 @@ static noreturn int test_initlib(const struct test *t)
 }
 DEFINE_TEST(test_initlib, .description = "test if libkmod's init function work");
 
-static noreturn int test_insert(const struct test *t)
+static noreturn int test_insert(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod;
@@ -107,7 +107,7 @@ DEFINE_TEST(test_insert,
        },
        .modules_loaded = "mod_simple");
 
-static noreturn int test_remove(const struct test *t)
+static noreturn int test_remove(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod_simple, *mod_bla;
index 92ad0e3746541101a9edc0f947577b7f19df5710..eaef0a7d6a760818b86b1b2a66f80caec40ca0be 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "testsuite.h"
 
-static noreturn int test_initstate_from_lookup(const struct test *t)
+static noreturn int test_initstate_from_lookup(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_list *list = NULL;
@@ -66,7 +66,7 @@ DEFINE_TEST(
                [TC_UNAME_R] = "4.4.4",
        });
 
-static noreturn int test_initstate_from_name(const struct test *t)
+static noreturn int test_initstate_from_name(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod = NULL;
index 7a4b4483c81e8aa4ec7e5c5c43b2b0275ce15f5f..19518a4d85357b888f27e405091459adc3367ab4 100644 (file)
@@ -27,7 +27,7 @@ static void kmod_list_remove_all(struct kmod_list *list)
                list = kmod_list_remove(list);
 }
 
-static int test_list_last(const struct test *t)
+static int test_list_last(void)
 {
        struct kmod_list *list = NULL, *last;
        int i;
@@ -47,7 +47,7 @@ static int test_list_last(const struct test *t)
 }
 DEFINE_TEST(test_list_last, .description = "test for the last element of a list");
 
-static int test_list_prev(const struct test *t)
+static int test_list_prev(void)
 {
        struct kmod_list *list = NULL, *l, *p;
        int i;
@@ -76,7 +76,7 @@ static int test_list_prev(const struct test *t)
 }
 DEFINE_TEST(test_list_prev, .description = "test list prev");
 
-static int test_list_remove_data(const struct test *t)
+static int test_list_remove_data(void)
 {
        struct kmod_list *list = NULL, *l;
        int i;
@@ -100,7 +100,7 @@ static int test_list_remove_data(const struct test *t)
 DEFINE_TEST(test_list_remove_data,
            .description = "test list function to remove element by data");
 
-static int test_list_append_list(const struct test *t)
+static int test_list_append_list(void)
 {
        struct kmod_list *a = NULL, *b = NULL, *c, *l;
        int i;
@@ -137,7 +137,7 @@ static int test_list_append_list(const struct test *t)
 DEFINE_TEST(test_list_append_list,
            .description = "test list function to append another list");
 
-static int test_list_insert_before(const struct test *t)
+static int test_list_insert_before(void)
 {
        struct kmod_list *list = NULL, *l;
        const char *v1 = "v1", *v2 = "v2", *v3 = "v3", *vx = "vx";
@@ -172,7 +172,7 @@ static int test_list_insert_before(const struct test *t)
 DEFINE_TEST(test_list_insert_before,
            .description = "test list function to insert before element");
 
-static int test_list_insert_after(const struct test *t)
+static int test_list_insert_after(void)
 {
        struct kmod_list *list = NULL, *l;
        const char *v1 = "v1", *v2 = "v2", *v3 = "v3", *vx = "vx";
index ad8e37e038e558c684f2d9568077694196675912..55c6ad196538ae83e284c726727edb6320403710 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "testsuite.h"
 
-static int loaded_1(const struct test *t)
+static int loaded_1(void)
 {
        struct kmod_ctx *ctx;
        const char *null_config = NULL;
index b936e2fa28cf614161f44b0d4e2eeb17801c36a3..6966fa8275ab93cc2b0ecb7978c622cc3d26248a 100644 (file)
 
 static const char *progname = TOOLS_DIR "/modinfo";
 
-#define DEFINE_MODINFO_TEST(_field, _flavor, ...)                       \
-       static noreturn int test_modinfo_##_field(const struct test *t) \
-       {                                                               \
-               const char *const args[] = {                            \
-                       progname, "-F", #_field, __VA_ARGS__, NULL,     \
-               };                                                      \
-               test_spawn_prog(progname, args);                        \
-               exit(EXIT_FAILURE);                                     \
-       }                                                               \
+#define DEFINE_MODINFO_TEST(_field, _flavor, ...)                   \
+       static noreturn int test_modinfo_##_field(void)             \
+       {                                                           \
+               const char *const args[] = {                        \
+                       progname, "-F", #_field, __VA_ARGS__, NULL, \
+               };                                                  \
+               test_spawn_prog(progname, args);                    \
+               exit(EXIT_FAILURE);                                 \
+       }                                                           \
        DEFINE_TEST(test_modinfo_##_field, \
        .description = "check " #_field " output of modinfo for different architectures", \
        .config = { \
@@ -59,7 +59,7 @@ DEFINE_MODINFO_SIGN_TEST(sig_key);
 DEFINE_MODINFO_SIGN_TEST(sig_hashalgo);
 
 #if 0
-static noreturn int test_modinfo_signature(const struct test *t)
+static noreturn int test_modinfo_signature(void)
 {
        const char *const args[] = {
                progname,
@@ -79,7 +79,7 @@ DEFINE_TEST(test_modinfo_signature,
        });
 #endif
 
-static noreturn int test_modinfo_external(const struct test *t)
+static noreturn int test_modinfo_external(void)
 {
        const char *const args[] = {
                // clang-format off
@@ -102,7 +102,7 @@ DEFINE_TEST(test_modinfo_external,
                .out = TESTSUITE_ROOTFS "test-modinfo/correct-external.txt",
        });
 
-static noreturn int test_modinfo_builtin(const struct test *t)
+static noreturn int test_modinfo_builtin(void)
 {
        const char *const args[] = {
                // clang-format off
index 586f7bbc6c67f7b182ffcbca54b5cc429d8aa9fb..7f93483f03f45081ca1f3889c49a1e06889ca441 100644 (file)
@@ -18,7 +18,7 @@
        test_spawn_prog(TOOLS_DIR "/modprobe", \
                        (const char *[]){ TOOLS_DIR "/modprobe", ##__VA_ARGS__, NULL })
 
-static noreturn int modprobe_show_depends(const struct test *t)
+static noreturn int modprobe_show_depends(void)
 {
        EXEC_MODPROBE("--show-depends", "mod-loop-a");
        exit(EXIT_FAILURE);
@@ -33,7 +33,7 @@ DEFINE_TEST(modprobe_show_depends,
                .out = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct.txt",
        });
 
-static noreturn int modprobe_show_depends2(const struct test *t)
+static noreturn int modprobe_show_depends2(void)
 {
        EXEC_MODPROBE("--show-depends", "mod-simple");
        exit(EXIT_FAILURE);
@@ -56,7 +56,7 @@ DEFINE_TEST_WITH_FUNC(modprobe_show_depends_no_load, modprobe_show_depends2,
        .modules_loaded = "",
        );
 
-static noreturn int modprobe_show_alias_to_none(const struct test *t)
+static noreturn int modprobe_show_alias_to_none(void)
 {
        EXEC_MODPROBE("--show-depends", "--ignore-install", "--quiet", "mod-simple");
        exit(EXIT_FAILURE);
@@ -73,7 +73,7 @@ DEFINE_TEST(modprobe_show_alias_to_none,
        .modules_loaded = "",
        );
 
-static noreturn int modprobe_show_exports(const struct test *t)
+static noreturn int modprobe_show_exports(void)
 {
        EXEC_MODPROBE("--show-exports", "--quiet", "/mod-loop-a.ko");
        exit(EXIT_FAILURE);
@@ -88,7 +88,7 @@ DEFINE_TEST(modprobe_show_exports,
                .regex = true,
        });
 
-static noreturn int modprobe_builtin(const struct test *t)
+static noreturn int modprobe_builtin(void)
 {
        EXEC_MODPROBE("unix");
        exit(EXIT_FAILURE);
@@ -99,7 +99,7 @@ DEFINE_TEST(modprobe_builtin, .description = "check if modprobe return 0 for bui
                    [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/builtin",
            });
 
-static noreturn int modprobe_builtin_lookup_only(const struct test *t)
+static noreturn int modprobe_builtin_lookup_only(void)
 {
        EXEC_MODPROBE("-R", "unix");
        exit(EXIT_FAILURE);
@@ -114,7 +114,7 @@ DEFINE_TEST(modprobe_builtin_lookup_only,
                .out = TESTSUITE_ROOTFS "test-modprobe/builtin/correct.txt",
        });
 
-static noreturn int modprobe_softdep_loop(const struct test *t)
+static noreturn int modprobe_softdep_loop(void)
 {
        EXEC_MODPROBE("mod-loop-b");
        exit(EXIT_FAILURE);
@@ -129,7 +129,7 @@ DEFINE_TEST(modprobe_softdep_loop,
        .modules_loaded = "mod-loop-a,mod-loop-b",
        );
 
-static noreturn int modprobe_weakdep_loop(const struct test *t)
+static noreturn int modprobe_weakdep_loop(void)
 {
        EXEC_MODPROBE("mod-loop-b");
        exit(EXIT_FAILURE);
@@ -145,7 +145,7 @@ DEFINE_TEST(modprobe_weakdep_loop,
        .modules_not_loaded = "mod-loop-a,mod-simple-c",
        );
 
-static noreturn int modprobe_install_cmd_loop(const struct test *t)
+static noreturn int modprobe_install_cmd_loop(void)
 {
        EXEC_MODPROBE("mod-loop-a");
        exit(EXIT_FAILURE);
@@ -164,7 +164,7 @@ DEFINE_TEST(modprobe_install_cmd_loop,
        .modules_loaded = "mod-loop-b,mod-loop-a",
        );
 
-static noreturn int modprobe_param_kcmdline_show_deps(const struct test *t)
+static noreturn int modprobe_param_kcmdline_show_deps(void)
 {
        EXEC_MODPROBE("--show-depends", "mod-simple");
        exit(EXIT_FAILURE);
@@ -179,7 +179,7 @@ DEFINE_TEST(modprobe_param_kcmdline_show_deps,
                .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline/correct.txt",
        });
 
-static noreturn int modprobe_param_kcmdline(const struct test *t)
+static noreturn int modprobe_param_kcmdline(void)
 {
        EXEC_MODPROBE("-c");
        exit(EXIT_FAILURE);
@@ -266,7 +266,7 @@ DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline9, modprobe_param_kcmdline,
                .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline9/correct.txt",
        });
 
-static noreturn int modprobe_force(const struct test *t)
+static noreturn int modprobe_force(void)
 {
        EXEC_MODPROBE("--force", "mod-simple");
        exit(EXIT_FAILURE);
@@ -281,7 +281,7 @@ DEFINE_TEST(modprobe_force,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_force_modversion(const struct test *t)
+static noreturn int modprobe_force_modversion(void)
 {
        EXEC_MODPROBE("--force-modversion", "mod-simple");
        exit(EXIT_FAILURE);
@@ -296,7 +296,7 @@ DEFINE_TEST(modprobe_force_modversion,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_force_vermagic(const struct test *t)
+static noreturn int modprobe_force_vermagic(void)
 {
        EXEC_MODPROBE("--force-vermagic", "mod-simple");
        exit(EXIT_FAILURE);
@@ -311,7 +311,7 @@ DEFINE_TEST(modprobe_force_vermagic,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_oldkernel(const struct test *t)
+static noreturn int modprobe_oldkernel(void)
 {
        EXEC_MODPROBE("mod-simple");
        exit(EXIT_FAILURE);
@@ -326,7 +326,7 @@ DEFINE_TEST(modprobe_oldkernel,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_oldkernel_force(const struct test *t)
+static noreturn int modprobe_oldkernel_force(void)
 {
        EXEC_MODPROBE("--force", "mod-simple");
        exit(EXIT_FAILURE);
@@ -341,7 +341,7 @@ DEFINE_TEST(modprobe_oldkernel_force,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_oldkernel_force_modversion(const struct test *t)
+static noreturn int modprobe_oldkernel_force_modversion(void)
 {
        EXEC_MODPROBE("--force-modversion", "mod-simple");
        exit(EXIT_FAILURE);
@@ -356,7 +356,7 @@ DEFINE_TEST(modprobe_oldkernel_force_modversion,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_oldkernel_force_vermagic(const struct test *t)
+static noreturn int modprobe_oldkernel_force_vermagic(void)
 {
        EXEC_MODPROBE("--force-vermagic", "mod-simple");
        exit(EXIT_FAILURE);
@@ -371,7 +371,7 @@ DEFINE_TEST(modprobe_oldkernel_force_vermagic,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_external(const struct test *t)
+static noreturn int modprobe_external(void)
 {
        EXEC_MODPROBE("mod-simple");
        exit(EXIT_FAILURE);
@@ -386,7 +386,7 @@ DEFINE_TEST(modprobe_external,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_module_from_abspath(const struct test *t)
+static noreturn int modprobe_module_from_abspath(void)
 {
        EXEC_MODPROBE("/home/foo/mod-simple.ko");
        exit(EXIT_FAILURE);
@@ -401,7 +401,7 @@ DEFINE_TEST(modprobe_module_from_abspath,
        .modules_loaded = "mod-simple",
        );
 
-static noreturn int modprobe_module_from_relpath(const struct test *t)
+static noreturn int modprobe_module_from_relpath(void)
 {
        if (chdir("/home/foo") != 0) {
                perror("failed to change into /home/foo");
index 9c94472bee6b9c57af7321ac8fa0e24b99f97283..e53a65b9aedb53005a52fce94d385a526a430607 100644 (file)
@@ -67,7 +67,7 @@ static int check_dependencies(const char *const *modnames,
                return -1;
 }
 
-static int multi_softdep(const struct test *t)
+static int multi_softdep(void)
 {
        struct kmod_ctx *ctx = NULL;
        struct kmod_module *mod = NULL;
index ed051cae52f6bbcac466aaaf2f334e9c9e63e882..faf4344e528722d43cb7a1e61f612afcac4a3f53 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "testsuite.h"
 
-static int from_name(const struct test *t)
+static int from_name(void)
 {
        static const char *const modnames[] = {
                // clang-format off
@@ -59,7 +59,7 @@ DEFINE_TEST(from_name,
                .out = TESTSUITE_ROOTFS "test-new-module/from_name/correct.txt",
        });
 
-static int from_alias(const struct test *t)
+static int from_alias(void)
 {
        static const char *const modnames[] = {
                "ext4.*",
index c8b02c71add53c4532202cc650dd60f48c69632b..88e6f8eb324b6e7d7c732fcecbec8fb012396d97 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "testsuite.h"
 
-static noreturn int test_remove(const struct test *t)
+static noreturn int test_remove(void)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod;
index 71aa70041533ff1a68b50ed7aac6d5e80dbfc4ce..d87331d036e40f688bcb5f8b9281d61f502bfb9d 100644 (file)
@@ -18,7 +18,7 @@
 static const char *TEXT =
        "this is a very long test that is longer than the size we initially se in the strbuf";
 
-static int test_strbuf_pushchar(const struct test *t)
+static int test_strbuf_pushchar(void)
 {
        _cleanup_strbuf_ struct strbuf buf;
        const char *result;
@@ -37,7 +37,7 @@ static int test_strbuf_pushchar(const struct test *t)
 }
 DEFINE_TEST(test_strbuf_pushchar, .description = "test strbuf_{pushchar, str, steal}");
 
-static int test_strbuf_pushchars(const struct test *t)
+static int test_strbuf_pushchars(void)
 {
        _cleanup_strbuf_ struct strbuf buf;
        const char *result;
@@ -78,7 +78,7 @@ static int test_strbuf_pushchars(const struct test *t)
 DEFINE_TEST(test_strbuf_pushchars,
            .description = "test strbuf_{pushchars, popchar, popchars}");
 
-static int test_strbuf_with_stack(const struct test *t)
+static int test_strbuf_with_stack(void)
 {
        const char test[] = "test-something-small";
        const char *stack_buf;
@@ -117,7 +117,7 @@ static int test_strbuf_with_stack(const struct test *t)
 }
 DEFINE_TEST(test_strbuf_with_stack, .description = "test strbuf with stack");
 
-static int test_strbuf_with_heap(const struct test *t)
+static int test_strbuf_with_heap(void)
 {
        DECLARE_STRBUF(heapbuf);
 
@@ -133,7 +133,7 @@ static int test_strbuf_with_heap(const struct test *t)
 }
 DEFINE_TEST(test_strbuf_with_heap, .description = "test strbuf with heap only");
 
-static int test_strbuf_pushmem(const struct test *t)
+static int test_strbuf_pushmem(void)
 {
        _cleanup_strbuf_ struct strbuf buf;
 
@@ -147,7 +147,7 @@ static int test_strbuf_pushmem(const struct test *t)
 }
 DEFINE_TEST(test_strbuf_pushmem, .description = "test strbuf_reserve");
 
-static int test_strbuf_used(const struct test *t)
+static int test_strbuf_used(void)
 {
        _cleanup_strbuf_ struct strbuf buf;
 
@@ -172,7 +172,7 @@ static int test_strbuf_used(const struct test *t)
 }
 DEFINE_TEST(test_strbuf_used, .description = "test strbuf_used");
 
-static int test_strbuf_shrink_to(const struct test *t)
+static int test_strbuf_shrink_to(void)
 {
        _cleanup_strbuf_ struct strbuf buf;
 
@@ -188,7 +188,7 @@ static int test_strbuf_shrink_to(const struct test *t)
 }
 DEFINE_TEST(test_strbuf_shrink_to, .description = "test strbuf_shrink_to");
 
-static int xfail_strbuf_shrink_to(const struct test *t)
+static int xfail_strbuf_shrink_to(void)
 {
        _cleanup_strbuf_ struct strbuf buf;
 
index 42fcb6f2df7984487b688684218f6dbb65246de4..647dc1e4df0897ae494a00647b8cd9a3d7a8fae2 100644 (file)
@@ -21,7 +21,7 @@
 #include "testsuite.h"
 
 #define TEST_UNAME "4.0.20-kmod"
-static noreturn int testsuite_uname(const struct test *t)
+static noreturn int testsuite_uname(void)
 {
        struct utsname u;
        int err = uname(&u);
@@ -43,7 +43,7 @@ DEFINE_TEST(testsuite_uname, .description = "test if trap to uname() works",
                    [TC_UNAME_R] = TEST_UNAME,
            });
 
-static int testsuite_rootfs_fopen(const struct test *t)
+static int testsuite_rootfs_fopen(void)
 {
        FILE *fp;
        char s[100];
@@ -67,7 +67,7 @@ DEFINE_TEST(testsuite_rootfs_fopen, .description = "test if rootfs works - fopen
                    [TC_ROOTFS] = TESTSUITE_ROOTFS "test-rootfs/",
            });
 
-static int testsuite_rootfs_open(const struct test *t)
+static int testsuite_rootfs_open(void)
 {
        char buf[100];
        int fd, done;
@@ -98,7 +98,7 @@ DEFINE_TEST(testsuite_rootfs_open, .description = "test if rootfs works - open()
                    [TC_ROOTFS] = TESTSUITE_ROOTFS "test-rootfs/",
            });
 
-static int testsuite_rootfs_stat(const struct test *t)
+static int testsuite_rootfs_stat(void)
 {
        struct stat st;
 
@@ -114,7 +114,7 @@ DEFINE_TEST(testsuite_rootfs_stat, .description = "test if rootfs works - stat()
                    [TC_ROOTFS] = TESTSUITE_ROOTFS "test-rootfs/",
            });
 
-static int testsuite_rootfs_opendir(const struct test *t)
+static int testsuite_rootfs_opendir(void)
 {
        DIR *d;
 
index 4713fe3d67b8bb0f531ad416714428c902a1729f..609625371c3fbfd1cc4a30992648b0b8556d66ca 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "testsuite.h"
 
-static int alias_1(const struct test *t)
+static int alias_1(void)
 {
        static const char *const input[] = {
                // clang-format off
@@ -60,7 +60,7 @@ DEFINE_TEST(alias_1,
                .out = TESTSUITE_ROOTFS "test-util/alias-correct.txt",
        });
 
-static int test_freadline_wrapped(const struct test *t)
+static int test_freadline_wrapped(void)
 {
        FILE *fp = fopen("/freadline_wrapped-input.txt", "re");
 
@@ -89,7 +89,7 @@ DEFINE_TEST(test_freadline_wrapped,
                .out = TESTSUITE_ROOTFS "test-util/freadline_wrapped-correct.txt",
        });
 
-static int test_strchr_replace(const struct test *t)
+static int test_strchr_replace(void)
 {
        _cleanup_free_ char *s = strdup("this is a test string");
        const char *res = "thiC iC a teCt Ctring";
@@ -102,7 +102,7 @@ static int test_strchr_replace(const struct test *t)
 DEFINE_TEST(test_strchr_replace,
            .description = "check implementation of strchr_replace()");
 
-static int test_underscores(const struct test *t)
+static int test_underscores(void)
 {
        struct teststr {
                char *val;
@@ -127,7 +127,7 @@ static int test_underscores(const struct test *t)
 }
 DEFINE_TEST(test_underscores, .description = "check implementation of underscores()");
 
-static int test_path_ends_with_kmod_ext(const struct test *t)
+static int test_path_ends_with_kmod_ext(void)
 {
        struct teststr {
                const char *val;
@@ -163,7 +163,7 @@ DEFINE_TEST(test_path_ends_with_kmod_ext,
 
 #define TEST_WRITE_STR_SAFE_FILE "/write-str-safe"
 #define TEST_WRITE_STR_SAFE_PATH TESTSUITE_ROOTFS "test-util2/" TEST_WRITE_STR_SAFE_FILE
-static int test_write_str_safe(const struct test *t)
+static int test_write_str_safe(void)
 {
        const char *s = "test";
        int fd;
@@ -189,7 +189,7 @@ DEFINE_TEST(test_write_str_safe,
                },
        });
 
-static int test_uadd32_overflow(const struct test *t)
+static int test_uadd32_overflow(void)
 {
        uint32_t res;
        bool overflow;
@@ -206,7 +206,7 @@ static int test_uadd32_overflow(const struct test *t)
 DEFINE_TEST(test_uadd32_overflow,
            .description = "check implementation of uadd32_overflow()");
 
-static int test_uadd64_overflow(const struct test *t)
+static int test_uadd64_overflow(void)
 {
        uint64_t res;
        bool overflow;
@@ -223,7 +223,7 @@ static int test_uadd64_overflow(const struct test *t)
 DEFINE_TEST(test_uadd64_overflow,
            .description = "check implementation of uadd64_overflow()");
 
-static int test_umul32_overflow(const struct test *t)
+static int test_umul32_overflow(void)
 {
        uint32_t res;
        bool overflow;
@@ -240,7 +240,7 @@ static int test_umul32_overflow(const struct test *t)
 DEFINE_TEST(test_umul32_overflow,
            .description = "check implementation of umul32_overflow()");
 
-static int test_umul64_overflow(const struct test *t)
+static int test_umul64_overflow(void)
 {
        uint64_t res;
        bool overflow;
@@ -257,7 +257,7 @@ static int test_umul64_overflow(const struct test *t)
 DEFINE_TEST(test_umul64_overflow,
            .description = "check implementation of umul64_overflow()");
 
-static int test_backoff_time(const struct test *t)
+static int test_backoff_time(void)
 {
        unsigned long long delta = 0;
 
index c4de5cc6a3471b168b9cb863acc851d59207ee54..cb3e3640c97310b592042b085a6a72cb6cd9b222 100644 (file)
@@ -25,7 +25,7 @@ static const char *const mod_name[] = {
        NULL,
 };
 
-static int test_weakdep(const struct test *t)
+static int test_weakdep(void)
 {
        struct kmod_ctx *ctx;
        int mod_name_index = 0;
@@ -90,7 +90,7 @@ DEFINE_TEST(test_weakdep,
                .out = TESTSUITE_ROOTFS "test-weakdep/correct-weakdep.txt",
        });
 
-static noreturn int modprobe_config(const struct test *t)
+static noreturn int modprobe_config(void)
 {
        EXEC_MODPROBE("-c");
        exit(EXIT_FAILURE);
index 8e721040711e16d9977aebebdae4f16d3aaac0fb..a2552a160f9832196f420dad832178aa7dec70c4 100644 (file)
@@ -142,7 +142,7 @@ static int test_spawn_test(const struct test *t)
 
 static int test_run_spawned(const struct test *t)
 {
-       int err = t->func(t);
+       int err = t->func();
        exit(err);
 
        return EXIT_FAILURE;
index 6bd4b28a38b43378dcb258934ce44f7a2677c96a..c40d7edc793cbcbbd3a071314b09d7e013e74156 100644 (file)
@@ -12,7 +12,7 @@
 #include <shared/macro.h>
 
 struct test;
-typedef int (*testfunc)(const struct test *t);
+typedef int (*testfunc)(void);
 
 enum test_config {
        /*