浏览代码

Exit test on first failure.

Stefano Cossu 3 年之前
父节点
当前提交
0218020be3
共有 2 个文件被更改,包括 14 次插入12 次删除
  1. 1 1
      Makefile
  2. 13 11
      test.c

+ 1 - 1
Makefile

@@ -1,6 +1,6 @@
 CC=gcc
 CFLAGS+= -Wall -std=c99 -D_XOPEN_SOURCE=500
-INCLUDE=-Iinclude -Iext/xxHash -Iext/openldap/libraries/liblmdb
+INCLUDE=-Iinclude -Iext/xxHash -Iext/openldap/libraries/liblmdb -Iext/uthash/src
 LIB=-luuid -lpthread
 SRC=ext/xxHash/xxhash.c ext/openldap/libraries/liblmdb/mdb.c \
 	ext/openldap/libraries/liblmdb/midl.c src/*.c

+ 13 - 11
test.c

@@ -1,4 +1,5 @@
 #include "test_term.c"
+#include "test_store_ht.c"
 #include "test_store_mdb.c"
 #include "test_graph.c"
 
@@ -9,23 +10,24 @@ int main(int argc, char **argv) {
     // Clear out database from previous test.
     rm_r (getenv ("LSUP_MDB_STORE_PATH"));
 
-    int result = (
-        term_tests() |
-        store_mdb_test() |
-        graph_tests() |
-        0);
+    int rc;
 
-    printf("Test result: %lu\n", (size_t)result);
-
-    if (result != 0) {
+    if (
+        term_tests() ||
+        store_ht_tests() ||
+        store_mdb_tests() ||
+        graph_tests() ||
+        0
+    ) {
         printf("Test failed.");
-    }
-    else {
+        rc = -1;
+    } else {
         printf("ALL TESTS PASSED\n");
+        rc = 0;
     }
 
     printf("Tests run: %d\n", tests_run);
 
-    return result != 0;
+    return rc;
 }