]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: macronify main function
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 7 Feb 2012 12:09:20 +0000 (10:09 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 7 Feb 2012 12:09:20 +0000 (10:09 -0200)
testsuite/test-alias.c
testsuite/test-init.c
testsuite/test-loaded.c
testsuite/test-modinfo.c
testsuite/test-new-module.c
testsuite/test-testsuite.c
testsuite/testsuite.h

index b7afd718c0df1a9f81aba507a96fd2cbfe0d6c49..2e84e6b325d2aef3c39636c1b390b673c5a526a3 100644 (file)
@@ -74,30 +74,4 @@ static const struct test *tests[] = {
        NULL,
 };
 
-int main(int argc, char *argv[])
-{
-       const struct test *t;
-       int arg;
-       size_t i;
-
-       arg = test_init(argc, argv, tests);
-       if (arg == 0)
-               return 0;
-
-       if (arg < argc) {
-               t = test_find(tests, argv[arg]);
-               if (t == NULL) {
-                       fprintf(stderr, "could not find test %s\n", argv[arg]);
-                       exit(EXIT_FAILURE);
-               }
-
-               return test_run(t);
-       }
-
-       for (i = 0; tests[i] != NULL; i++) {
-               if (test_run(tests[i]) != 0)
-                       exit(EXIT_FAILURE);
-       }
-
-       exit(EXIT_SUCCESS);
-}
+TESTSUITE_MAIN(tests);
index 0b636eba72c0ba4f943f941fb854d603c33060d1..d6e1e5c8bb62fc0bd4bdd1de26624964d0737313 100644 (file)
@@ -125,30 +125,4 @@ static const struct test *tests[] = {
        NULL,
 };
 
-int main(int argc, char *argv[])
-{
-       const struct test *t;
-       int arg;
-       size_t i;
-
-       arg = test_init(argc, argv, tests);
-       if (arg == 0)
-               return 0;
-
-       if (arg < argc) {
-               t = test_find(tests, argv[arg]);
-               if (t == NULL) {
-                       fprintf(stderr, "could not find test %s\n", argv[arg]);
-                       exit(EXIT_FAILURE);
-               }
-
-               return test_run(t);
-       }
-
-       for (i = 0; tests[i] != NULL; i++) {
-               if (test_run(tests[i]) != 0)
-                       exit(EXIT_FAILURE);
-       }
-
-       exit(EXIT_SUCCESS);
-}
+TESTSUITE_MAIN(tests);
index 070351c1a262f0804120ec30f85b3e46a371a269..cfeb1b49f5778e3103d39503c395150f540533b3 100644 (file)
@@ -95,30 +95,4 @@ static const struct test *tests[] = {
        NULL,
 };
 
-int main(int argc, char *argv[])
-{
-       const struct test *t;
-       int arg;
-       size_t i;
-
-       arg = test_init(argc, argv, tests);
-       if (arg == 0)
-               return 0;
-
-       if (arg < argc) {
-               t = test_find(tests, argv[arg]);
-               if (t == NULL) {
-                       fprintf(stderr, "could not find test %s\n", argv[arg]);
-                       exit(EXIT_FAILURE);
-               }
-
-               return test_run(t);
-       }
-
-       for (i = 0; tests[i] != NULL; i++) {
-               if (test_run(tests[i]) != 0)
-                       exit(EXIT_FAILURE);
-       }
-
-       exit(EXIT_SUCCESS);
-}
+TESTSUITE_MAIN(tests);
index 1b09bf28ffa29c45893d8beda78f79bef339eb2a..3047d269d671b1ecb2e85439e053ce22dfd10ff0 100644 (file)
@@ -55,30 +55,4 @@ static const struct test *tests[] = {
        NULL,
 };
 
-int main(int argc, char *argv[])
-{
-       const struct test *t;
-       int arg;
-       size_t i;
-
-       arg = test_init(argc, argv, tests);
-       if (arg == 0)
-               return 0;
-
-       if (arg < argc) {
-               t = test_find(tests, argv[arg]);
-               if (t == NULL) {
-                       fprintf(stderr, "could not find test %s\n", argv[arg]);
-                       exit(EXIT_FAILURE);
-               }
-
-               return test_run(t);
-       }
-
-       for (i = 0; tests[i] != NULL; i++) {
-               if (test_run(tests[i]) != 0)
-                       exit(EXIT_FAILURE);
-       }
-
-       exit(EXIT_SUCCESS);
-}
+TESTSUITE_MAIN(tests);
index 1aa8ec9f9485ed2b5f8ecda48b9522d874df273f..117d978845fa0778c2b841aa2bb6c9c98e37b386 100644 (file)
@@ -127,30 +127,4 @@ static const struct test *tests[] = {
        NULL,
 };
 
-int main(int argc, char *argv[])
-{
-       const struct test *t;
-       int arg;
-       size_t i;
-
-       arg = test_init(argc, argv, tests);
-       if (arg == 0)
-               return 0;
-
-       if (arg < argc) {
-               t = test_find(tests, argv[arg]);
-               if (t == NULL) {
-                       fprintf(stderr, "could not find test %s\n", argv[arg]);
-                       exit(EXIT_FAILURE);
-               }
-
-               return test_run(t);
-       }
-
-       for (i = 0; tests[i] != NULL; i++) {
-               if (test_run(tests[i]) != 0)
-                       exit(EXIT_FAILURE);
-       }
-
-       exit(EXIT_SUCCESS);
-}
+TESTSUITE_MAIN(tests);
index 83ba0030eb48936c6a841c5c010bf88a4c3c0852..6967b74841209f14d8d8b8a39eb11af12dcf8552 100644 (file)
@@ -181,30 +181,4 @@ static const struct test *tests[] = {
        NULL,
 };
 
-int main(int argc, char *argv[])
-{
-       const struct test *t;
-       int arg;
-       size_t i;
-
-       arg = test_init(argc, argv, tests);
-       if (arg == 0)
-               return 0;
-
-       if (arg < argc) {
-               t = test_find(tests, argv[arg]);
-               if (t == NULL) {
-                       fprintf(stderr, "could not find test %s\n", argv[arg]);
-                       exit(EXIT_FAILURE);
-               }
-
-               return test_run(t);
-       }
-
-       for (i = 0; tests[i] != NULL; i++) {
-               if (test_run(tests[i]) != 0)
-                       exit(EXIT_FAILURE);
-       }
-
-       exit(EXIT_SUCCESS);
-}
+TESTSUITE_MAIN(tests);
index 012e5103a87f695011e844e4d963903b6c49b406..8bb0fa7ab36cd66375af0d98aa8e3bdf9bb28a84 100644 (file)
@@ -107,4 +107,33 @@ int test_run(const struct test *t);
                .func = _name, \
        }
 
+#define TESTSUITE_MAIN(_tests) \
+       int main(int argc, char *argv[])                        \
+       {                                                       \
+               const struct test *t;                           \
+               int arg;                                        \
+               size_t i;                                       \
+                                                               \
+               arg = test_init(argc, argv, tests);             \
+               if (arg == 0)                                   \
+                       return 0;                               \
+                                                               \
+               if (arg < argc) {                               \
+                       t = test_find(tests, argv[arg]);        \
+                       if (t == NULL) {                        \
+                               fprintf(stderr, "could not find test %s\n", argv[arg]);\
+                               exit(EXIT_FAILURE);             \
+                       }                                       \
+                                                               \
+                       return test_run(t);                     \
+               }                                               \
+                                                               \
+               for (i = 0; tests[i] != NULL; i++) {            \
+                       if (test_run(tests[i]) != 0)            \
+                               exit(EXIT_FAILURE);             \
+               }                                               \
+                                                               \
+               exit(EXIT_SUCCESS);                             \
+       }                                                       \
+
 #endif