make tests print 'ok' if they pass
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
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)