Commit b08fe7be6d83b5a2707836cdae994156b426fc53

Stefan Sperling 2018-01-26T14:34:15

make tests print 'ok' if they pass

diff --git a/regress/delta/delta_test.c b/regress/delta/delta_test.c
index ecd210d..4bd6cac 100644
--- a/regress/delta/delta_test.c
+++ b/regress/delta/delta_test.c
@@ -23,18 +23,21 @@
 
 #include "delta.h"
 
-#define RUN_TEST(expr, name) \
-	if (!(expr)) { printf("test %s failed\n", (name)); failure = 1; }
-
 static int
 delta_combine()
 {
 	return 1;
 }
 
+#define RUN_TEST(expr, name) \
+	{ test_ok = (expr);  \
+	printf("test %s %s\n", (name), test_ok ? "ok" : "failed"); \
+	failure = (failure || !test_ok); }
+
 int
 main(int argc, const char *argv[])
 {
+	int test_ok;
 	int failure = 0;
 
 	if (argc != 1) {
diff --git a/regress/packfiles/packfile_test.c b/regress/packfiles/packfile_test.c
index 4217a27..6b84329 100644
--- a/regress/packfiles/packfile_test.c
+++ b/regress/packfiles/packfile_test.c
@@ -26,9 +26,6 @@
 #include "got_object.h"
 #include "pack.h"
 
-#define RUN_TEST(expr, name) \
-	if (!(expr)) { printf("test %s failed\n", (name)); failure = 1; }
-
 #define GOT_REPO_PATH "../../../"
 
 static int
@@ -56,10 +53,15 @@ packfile_read_idx(const char *repo_path)
 	return ret;
 }
 
+#define RUN_TEST(expr, name) \
+	{ test_ok = (expr);  \
+	printf("test %s %s\n", (name), test_ok ? "ok" : "failed"); \
+	failure = (failure || !test_ok); }
+
 int
 main(int argc, const char *argv[])
 {
-	int failure = 0;
+	int test_ok = 0, failure = 0;
 	const char *repo_path;
 
 	if (argc == 1)
diff --git a/regress/repository/repository_test.c b/regress/repository/repository_test.c
index 7619771..5ca8cd8 100644
--- a/regress/repository/repository_test.c
+++ b/regress/repository/repository_test.c
@@ -29,9 +29,6 @@
 #include "got_sha1.h"
 #include "got_diff.h"
 
-#define RUN_TEST(expr, name) \
-	if (!(expr)) { printf("test %s failed\n", (name)); failure = 1; }
-
 #define GOT_REPO_PATH "../../../"
 
 static const struct got_error *
@@ -346,10 +343,15 @@ repo_diff_tree(const char *repo_path)
 	return (err == NULL);
 }
 
+#define RUN_TEST(expr, name) \
+	{ test_ok = (expr);  \
+	printf("test %s %s\n", (name), test_ok ? "ok" : "failed"); \
+	failure = (failure || !test_ok); }
+
 int
 main(int argc, const char *argv[])
 {
-	int failure = 0;
+	int test_ok = 0, failure = 0;
 	const char *repo_path;
 
 	if (argc == 1)