testsuite: remove now unused array of tests
authorLucas De Marchi <lucas.demarchi@intel.com>
Thu, 9 Oct 2014 17:29:04 +0000 (14:29 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 9 Oct 2014 17:29:04 +0000 (14:29 -0300)
Remove the arrays and let each test with a guaranteed unique name.

14 files changed:
shared/macro.h
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-loaded.c
testsuite/test-modinfo.c
testsuite/test-modprobe.c
testsuite/test-new-module.c
testsuite/test-testsuite.c
testsuite/test-util.c
testsuite/testsuite.h

index 0f8e4c0..0f035b1 100644 (file)
@@ -68,3 +68,5 @@
 #define noreturn __attribute__((noreturn))
 #endif
 #endif
+
+#define UNIQ __COUNTER__
index 3f095d5..35b49b5 100644 (file)
@@ -160,13 +160,4 @@ static int test_array_remove_at(const struct test *t)
 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();
index 0937391..7202bf8 100644 (file)
@@ -102,9 +102,4 @@ static const struct test sblacklist_1 = {
        .need_spawn = true,
 };
 
-static const struct test *tests[] = {
-       &sblacklist_1,
-       NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
index 98e8f76..6860a98 100644 (file)
@@ -87,9 +87,4 @@ static const struct test stest_dependencies = {
        .need_spawn = true,
 };
 
-static const struct test *tests[] = {
-       &stest_dependencies,
-       NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
index 480a3ef..05284b4 100644 (file)
@@ -40,6 +40,8 @@ static noreturn int depmod_modules_order_for_compressed(const struct test *t)
        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 = {
@@ -53,6 +55,7 @@ DEFINE_TEST(depmod_modules_order_for_compressed,
                        { }
                },
        });
+#endif
 
 #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
 static noreturn int depmod_search_order_simple(const struct test *t)
@@ -129,15 +132,4 @@ DEFINE_TEST(depmod_detect_loop,
                .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();
index 70b4126..b3fb9a0 100644 (file)
@@ -219,16 +219,5 @@ 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 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();
index 8b2419c..7c47d3a 100644 (file)
@@ -113,11 +113,4 @@ DEFINE_TEST(test_remove,
        },
        .need_spawn = true);
 
-static const struct test *tests[] = {
-       &stest_initlib,
-       &stest_insert,
-       &stest_remove,
-       NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
index bb5f6ad..355171f 100644 (file)
@@ -89,9 +89,4 @@ DEFINE_TEST(loaded_1,
                .out = TESTSUITE_ROOTFS "test-loaded/correct.txt",
        });
 
-static const struct test *tests[] = {
-       &sloaded_1,
-       NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
index c5b44a0..76506be 100644 (file)
@@ -49,9 +49,4 @@ DEFINE_TEST(modinfo_jonsmodules,
                .out = TESTSUITE_ROOTFS "test-modinfo/correct.txt",
        });
 
-static const struct test *tests[] = {
-       &smodinfo_jonsmodules,
-       NULL,
-};
-
-TESTSUITE_MAIN(tests);
+TESTSUITE_MAIN();
index 1d874cb..7923257 100644 (file)
@@ -325,22 +325,4 @@ DEFINE_TEST(modprobe_oldkernel_force,
        .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();
index 8b057d1..2f49a11 100644 (file)
@@ -116,10 +116,4 @@ DEFINE_TEST(from_alias,
                .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();
index e2b9446..f324cc9 100644 (file)
@@ -159,13 +159,4 @@ DEFINE_TEST(testsuite_rootfs_opendir,
        },
        .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();
index 5e4fb0e..9ffcf56 100644 (file)
@@ -97,10 +97,4 @@ DEFINE_TEST(test_freadline_wrapped,
                .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();
index f9a6e91..8688ed0 100644 (file)
@@ -132,14 +132,14 @@ int test_run(const struct test *t);
 
 /* 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[])                                                        \