testsuite: macronify main function
diff --git a/testsuite/test-alias.c b/testsuite/test-alias.c
index b7afd71..2e84e6b 100644
--- a/testsuite/test-alias.c
+++ b/testsuite/test-alias.c
@@ -74,30 +74,4 @@
 	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);
diff --git a/testsuite/test-init.c b/testsuite/test-init.c
index 0b636eb..d6e1e5c 100644
--- a/testsuite/test-init.c
+++ b/testsuite/test-init.c
@@ -125,30 +125,4 @@
 	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);
diff --git a/testsuite/test-loaded.c b/testsuite/test-loaded.c
index 070351c..cfeb1b4 100644
--- a/testsuite/test-loaded.c
+++ b/testsuite/test-loaded.c
@@ -95,30 +95,4 @@
 	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);
diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c
index 1b09bf2..3047d26 100644
--- a/testsuite/test-modinfo.c
+++ b/testsuite/test-modinfo.c
@@ -55,30 +55,4 @@
 	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);
diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c
index 1aa8ec9..117d978 100644
--- a/testsuite/test-new-module.c
+++ b/testsuite/test-new-module.c
@@ -127,30 +127,4 @@
 	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);
diff --git a/testsuite/test-testsuite.c b/testsuite/test-testsuite.c
index 83ba003..6967b74 100644
--- a/testsuite/test-testsuite.c
+++ b/testsuite/test-testsuite.c
@@ -181,30 +181,4 @@
 	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);
diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h
index 012e510..8bb0fa7 100644
--- a/testsuite/testsuite.h
+++ b/testsuite/testsuite.h
@@ -107,4 +107,33 @@
 		.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