diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-12-15 02:08:03 +0100 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-12-15 02:09:15 +0100 |
commit | bc57b80b837a5497940ac5c3486da6b471420edc (patch) | |
tree | 4c1ac24ba06dafa1d841ae4ace6e96df6a88aeb3 /tests-clay/clay_main.c | |
parent | b5daae68a4ae859653141fb097e7b7c81b25530b (diff) | |
download | libgit2-bc57b80b837a5497940ac5c3486da6b471420edc.tar.gz |
Update to Clay 0.10.0
Comes with support for global events; this fixes #496.
Diffstat (limited to 'tests-clay/clay_main.c')
-rw-r--r-- | tests-clay/clay_main.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tests-clay/clay_main.c b/tests-clay/clay_main.c index 80c13f429..af9e08877 100644 --- a/tests-clay/clay_main.c +++ b/tests-clay/clay_main.c @@ -103,6 +103,10 @@ static void clay_print_onabort(const char *msg, ...); static void clay_unsandbox(void); static int clay_sandbox(void); +/* Event callback overrides */ +#define clay_on_test() /* nop */ +#define clay_on_suite() /* nop */ + /* Autogenerated test data by clay */ static const struct clay_func _clay_cb_buf_basic[] = { {"printf", &test_buf_basic__printf}, @@ -528,6 +532,7 @@ clay_run_test( { int error_st = _clay.suite_errors; + clay_on_test(); _clay.trampoline_enabled = 1; if (setjmp(_clay.trampoline) == 0) { @@ -583,6 +588,7 @@ clay_run_suite(const struct clay_suite *suite) size_t i; clay_print_onsuite(suite->name); + clay_on_suite(); _clay.active_suite = suite->name; _clay.suite_errors = 0; @@ -661,11 +667,12 @@ clay_test(int argc, char **argv) ); if (clay_sandbox() < 0) { - fprintf(stderr, - "Failed to sandbox the test runner.\n" - "Testing will proceed without sandboxing.\n"); + clay_print_onabort("Failed to sandbox the test runner.\n"); + exit(-1); } + clay_on_init(); + if (argc > 1) { clay_parse_args(argc, argv); } else { @@ -675,11 +682,13 @@ clay_test(int argc, char **argv) } clay_print_shutdown( - (int)_clay_callback_count, + _clay.test_count, (int)_clay_suite_count, _clay.total_errors ); + clay_on_shutdown(); + clay_unsandbox(); return _clay.total_errors; } @@ -1049,10 +1058,10 @@ cl_fs_cleanup(void) static void clay_print_init(int test_count, int suite_count, const char *suite_names) { + (void)test_count; (void)suite_names; (void)suite_count; printf("TAP version 13\n"); - printf("1..%d\n", test_count); } static void clay_print_shutdown(int test_count, int suite_count, int error_count) @@ -1061,7 +1070,12 @@ static void clay_print_shutdown(int test_count, int suite_count, int error_count (void)suite_count; (void)error_count; - printf("\n"); + if (!error_count) + printf("# passed all %d test(s)\n", test_count); + else + printf("# failed %d among %d test(s)\n", error_count, + test_count); + printf("1..%d\n", test_count); } static void clay_print_error(int num, const struct clay_error *error) |