Remove the arrays and let each test with a guaranteed unique name.
#define noreturn __attribute__((noreturn))
#endif
#endif
+
+#define UNIQ __COUNTER__
DEFINE_TEST(test_array_remove_at,
.description = "test array remove at");
-static const struct test *tests[] = {
- &stest_array_append1,
- &stest_array_append2,
- &stest_array_append_unique,
- &stest_array_sort,
- &stest_array_remove_at,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.need_spawn = true,
};
-static const struct test *tests[] = {
- &sblacklist_1,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.need_spawn = true,
};
-static const struct test *tests[] = {
- &stest_dependencies,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
test_spawn_prog(progname, args);
exit(EXIT_FAILURE);
}
+
+#ifdef ENABLE_ZLIB
DEFINE_TEST(depmod_modules_order_for_compressed,
.description = "check if depmod let aliases in right order when using compressed modules",
.config = {
{ }
},
});
+#endif
#define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
static noreturn int depmod_search_order_simple(const struct test *t)
.err = DETECT_LOOP_ROOTFS "/correct.txt",
});
-
-static const struct test *tests[] = {
-#ifdef ENABLE_ZLIB
- &sdepmod_modules_order_for_compressed,
-#endif
- &sdepmod_search_order_simple,
- &sdepmod_search_order_same_prefix,
- &sdepmod_detect_loop,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
}
DEFINE_TEST(test_hash_free,
.description = "test hash_free calling free function for all values");
-static const struct test *tests[] = {
- &stest_hash_new,
- &stest_hash_get_count,
- &stest_hash_replace,
- &stest_hash_replace_failing,
- &stest_hash_iter,
- &stest_hash_iter_after_del,
- &stest_hash_free,
- NULL,
-};
-
-
-TESTSUITE_MAIN(tests);
+
+TESTSUITE_MAIN();
},
.need_spawn = true);
-static const struct test *tests[] = {
- &stest_initlib,
- &stest_insert,
- &stest_remove,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.out = TESTSUITE_ROOTFS "test-loaded/correct.txt",
});
-static const struct test *tests[] = {
- &sloaded_1,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.out = TESTSUITE_ROOTFS "test-modinfo/correct.txt",
});
-static const struct test *tests[] = {
- &smodinfo_jonsmodules,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.modules_loaded = "psmouse",
);
-
-static const struct test *tests[] = {
- &smodprobe_show_depends,
- &smodprobe_show_depends2,
- &smodprobe_show_alias_to_none,
- &smodprobe_builtin,
- &smodprobe_softdep_loop,
- &smodprobe_install_cmd_loop,
- &smodprobe_param_kcmdline,
- &smodprobe_param_kcmdline2,
- &smodprobe_param_kcmdline3,
- &smodprobe_param_kcmdline4,
- &smodprobe_force,
- &smodprobe_oldkernel,
- &smodprobe_oldkernel_force,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.out = TESTSUITE_ROOTFS "test-new-module/from_alias/correct.txt",
});
-static const struct test *tests[] = {
- &sfrom_name,
- &sfrom_alias,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
},
.need_spawn = true);
-static const struct test *tests[] = {
- &stestsuite_uname,
- &stestsuite_rootfs_fopen,
- &stestsuite_rootfs_open,
- &stestsuite_rootfs_stat_access,
- &stestsuite_rootfs_opendir,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
.out = TESTSUITE_ROOTFS "test-util/freadline_wrapped-correct.txt",
});
-static const struct test *tests[] = {
- &salias_1,
- &stest_freadline_wrapped,
- NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
/* Test definitions */
#define DEFINE_TEST(_name, ...) \
- static const struct test s##_name \
+ static const struct test s##_name##UNIQ \
__attribute__((used, section("kmod_tests"), aligned(8))) = { \
.name = #_name, \
.func = _name, \
## __VA_ARGS__ \
};
-#define TESTSUITE_MAIN(_tests) \
+#define TESTSUITE_MAIN() \
extern struct test __start_kmod_tests[] __attribute__((weak, visibility("hidden"))); \
extern struct test __stop_kmod_tests[] __attribute__((weak, visibility("hidden"))); \
int main(int argc, char *argv[]) \