about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-05-26 02:06:03 -0400
committerFedor Indutny <fedor@indutny.com>2016-05-26 02:06:03 -0400
commit1e6358c6e292beafaa09cd4298552d73b5aaa3a0 (patch)
tree0bb5e40db07be1bdff2b1262c12733baf58dc7b5 /test
parenta4e614177addfebb6f669e707dc5552c3d3ced1a (diff)
downloaduv_link_t-1e6358c6e292beafaa09cd4298552d73b5aaa3a0.tar.gz
test: kind of run all
Diffstat (limited to 'test')
-rw-r--r--test/src/main.c20
-rw-r--r--test/src/test-common.h2
2 files changed, 18 insertions, 4 deletions
diff --git a/test/src/main.c b/test/src/main.c
index 716e721..e8a0351 100644
--- a/test/src/main.c
+++ b/test/src/main.c
@@ -1,8 +1,11 @@
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "test-list.h"
 
+/* TODO(indutny): TAP */
+
 #define TEST_SELECT(N)                                                        \
     if (strncmp(argv[1], #N, sizeof(#N) - 1) == 0) {                          \
       fprintf(stderr, "===== " #N " =====\n");                                \
@@ -10,13 +13,24 @@
       return 0;                                                               \
     }
 
+/* TODO(indutny): fork and run */
+
+#define TEST_RUN(N)                                                           \
+    do {                                                                      \
+      fprintf(stderr, "===== " #N " =====\n");                                \
+      TEST_FN(N)();                                                           \
+    } while (0);
+
 int main(int argc, char** argv) {
-  if (argc != 2)
+  if (argc == 2) {
+    TEST_ENUM(TEST_SELECT)
+
     return -1;
+  }
 
-  TEST_ENUM(TEST_SELECT)
+  TEST_ENUM(TEST_RUN)
 
-  return -1;
+  return 0;
 }
 
 #undef TEST_SELECT
diff --git a/test/src/test-common.h b/test/src/test-common.h
index a78bf9d..925a63d 100644
--- a/test/src/test-common.h
+++ b/test/src/test-common.h
@@ -15,7 +15,7 @@
       if ((VALUE)) break;                                                    \
       fprintf(stderr, "Assertion failure: " #MESSAGE "\n");                  \
       abort();                                                               \
-    } while (0);
+    } while (0)
 
 #define CHECK_EQ(A, B, MESSAGE) CHECK((A) == (B), MESSAGE)
 #define CHECK_NE(A, B, MESSAGE) CHECK((A) != (B), MESSAGE)