From: Emil Velikov Date: Thu, 29 May 2025 14:31:36 +0000 (+0100) Subject: testsuite: stop passing struct test to the test itself X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e22369b34215823ff216d660430589fc3788369;p=thirdparty%2Fkmod.git testsuite: stop passing struct test to the test itself None of our tests require the test fixture details. Stop passing it into the test function itself. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/361 Signed-off-by: Lucas De Marchi --- diff --git a/testsuite/test-array.c b/testsuite/test-array.c index 91382640..b306982a 100644 --- a/testsuite/test-array.c +++ b/testsuite/test-array.c @@ -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"; diff --git a/testsuite/test-blacklist.c b/testsuite/test-blacklist.c index 580a259e..c763d458 100644 --- a/testsuite/test-blacklist.c +++ b/testsuite/test-blacklist.c @@ -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; diff --git a/testsuite/test-dependencies.c b/testsuite/test-dependencies.c index f315af1b..aa6416ae 100644 --- a/testsuite/test-dependencies.c +++ b/testsuite/test-dependencies.c @@ -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; diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index ec157b2c..b06c93ed 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -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); diff --git a/testsuite/test-hash.c b/testsuite/test-hash.c index 16fe5894..07d2a4a9 100644 --- a/testsuite/test-hash.c +++ b/testsuite/test-hash.c @@ -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; diff --git a/testsuite/test-init.c b/testsuite/test-init.c index d23e8a34..4bb12e21 100644 --- a/testsuite/test-init.c +++ b/testsuite/test-init.c @@ -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; diff --git a/testsuite/test-initstate.c b/testsuite/test-initstate.c index 92ad0e37..eaef0a7d 100644 --- a/testsuite/test-initstate.c +++ b/testsuite/test-initstate.c @@ -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; diff --git a/testsuite/test-list.c b/testsuite/test-list.c index 7a4b4483..19518a4d 100644 --- a/testsuite/test-list.c +++ b/testsuite/test-list.c @@ -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"; diff --git a/testsuite/test-loaded.c b/testsuite/test-loaded.c index ad8e37e0..55c6ad19 100644 --- a/testsuite/test-loaded.c +++ b/testsuite/test-loaded.c @@ -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; diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c index b936e2fa..6966fa82 100644 --- a/testsuite/test-modinfo.c +++ b/testsuite/test-modinfo.c @@ -15,15 +15,15 @@ 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 diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index 586f7bbc..7f93483f 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -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"); diff --git a/testsuite/test-multi-softdep.c b/testsuite/test-multi-softdep.c index 9c94472b..e53a65b9 100644 --- a/testsuite/test-multi-softdep.c +++ b/testsuite/test-multi-softdep.c @@ -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; diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c index ed051cae..faf4344e 100644 --- a/testsuite/test-new-module.c +++ b/testsuite/test-new-module.c @@ -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.*", diff --git a/testsuite/test-remove.c b/testsuite/test-remove.c index c8b02c71..88e6f8eb 100644 --- a/testsuite/test-remove.c +++ b/testsuite/test-remove.c @@ -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; diff --git a/testsuite/test-strbuf.c b/testsuite/test-strbuf.c index 71aa7004..d87331d0 100644 --- a/testsuite/test-strbuf.c +++ b/testsuite/test-strbuf.c @@ -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; diff --git a/testsuite/test-testsuite.c b/testsuite/test-testsuite.c index 42fcb6f2..647dc1e4 100644 --- a/testsuite/test-testsuite.c +++ b/testsuite/test-testsuite.c @@ -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; diff --git a/testsuite/test-util.c b/testsuite/test-util.c index 4713fe3d..60962537 100644 --- a/testsuite/test-util.c +++ b/testsuite/test-util.c @@ -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; diff --git a/testsuite/test-weakdep.c b/testsuite/test-weakdep.c index c4de5cc6..cb3e3640 100644 --- a/testsuite/test-weakdep.c +++ b/testsuite/test-weakdep.c @@ -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); diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 8e721040..a2552a16 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -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; diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h index 6bd4b28a..c40d7edc 100644 --- a/testsuite/testsuite.h +++ b/testsuite/testsuite.h @@ -12,7 +12,7 @@ #include struct test; -typedef int (*testfunc)(const struct test *t); +typedef int (*testfunc)(void); enum test_config { /*