commit b08fe7be6d83b5a2707836cdae994156b426fc53 from: Stefan Sperling date: Fri Jan 26 13:34:15 2018 UTC make tests print 'ok' if they pass commit - 322260e1783c1fb6a443258366c79d7546e4fc25 commit + b08fe7be6d83b5a2707836cdae994156b426fc53 blob - ecd210df43649d558b098c7a0677111edc599963 blob + 4bd6cac860f5d1a2785889f4b433226a5cdc89ee --- regress/delta/delta_test.c +++ 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) { blob - 4217a2737bf95376fc1e1b96daed4ea4ec97123e blob + 6b8432947f98187d676709cf988d10e08eb142b9 --- regress/packfiles/packfile_test.c +++ 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) blob - 7619771580a6f0aa760ab9d92e8f4f43ecae340a blob + 5ca8cd8bc3eca6b268ca2550925b0da4bd9e4e46 --- regress/repository/repository_test.c +++ 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 * @@ -345,11 +342,16 @@ repo_diff_tree(const char *repo_path) got_repo_close(repo); 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)