From fcad5ab7232a1b556580459e4f46e653ccef969b Mon Sep 17 00:00:00 2001 From: Stas Kobzar Date: Tue, 4 Apr 2017 11:06:15 -0400 Subject: [PATCH] Fix TAP output and summary. Reviewed-by: Andreas Schneider --- src/cmocka.c | 14 +++++++------- tests/CMakeLists.txt | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/cmocka.c b/src/cmocka.c index a74a8e5..6efb4ec 100644 --- a/src/cmocka.c +++ b/src/cmocka.c @@ -2335,7 +2335,7 @@ static void cmprintf_standard(enum cm_printf_type type, static void cmprintf_group_start_tap(const size_t num_tests) { - print_message("\t1..%u\n", (unsigned)num_tests); + print_message("1..%u\n", (unsigned)num_tests); } static void cmprintf_group_finish_tap(const char *group_name, @@ -2347,7 +2347,7 @@ static void cmprintf_group_finish_tap(const char *group_name, if (total_passed + total_skipped == total_executed) { status = "ok"; } - print_message("%s - %s\n", status, group_name); + print_message("# %s - %s\n", status, group_name); } static void cmprintf_tap(enum cm_printf_type type, @@ -2359,10 +2359,10 @@ static void cmprintf_tap(enum cm_printf_type type, case PRINTF_TEST_START: break; case PRINTF_TEST_SUCCESS: - print_message("\tok %u - %s\n", (unsigned)test_number, test_name); + print_message("ok %u - %s\n", (unsigned)test_number, test_name); break; case PRINTF_TEST_FAILURE: - print_message("\tnot ok %u - %s\n", (unsigned)test_number, test_name); + print_message("not ok %u - %s\n", (unsigned)test_number, test_name); if (error_message != NULL) { char *msg; char *p; @@ -2381,7 +2381,7 @@ static void cmprintf_tap(enum cm_printf_type type, p[0] = '\0'; } - print_message("\t# %s\n", q); + print_message("# %s\n", q); if (p == NULL) { break; @@ -2392,10 +2392,10 @@ static void cmprintf_tap(enum cm_printf_type type, } break; case PRINTF_TEST_SKIPPED: - print_message("\tnot ok %u # SKIP %s\n", (unsigned)test_number, test_name); + print_message("not ok %u # SKIP %s\n", (unsigned)test_number, test_name); break; case PRINTF_TEST_ERROR: - print_message("\tnot ok %u - %s %s\n", + print_message("not ok %u - %s %s\n", (unsigned)test_number, test_name, error_message); break; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 68ae4ac..b1380de 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -153,21 +153,21 @@ set(TEST_OUTPUT_FMTS xml) set(test_basics_tap_out - "^\t1\\.\\.2" - "\tok 1 - null_test_success" - "\tok 2 - int_test_success" - "ok - tests") + "^1\\.\\.2" + "ok 1 - null_test_success" + "ok 2 - int_test_success" + "# ok - tests") set(test_assert_macros_fail_tap_out - "^\t1\\.\\.1" - "\tnot ok 1 - test_assert_return_code_fail" - "\t#[^\n\r]+[\n\r]\t#[^\n\r]+[\n\r]not ok - tests") + "^1\\.\\.1" + "not ok 1 - test_assert_return_code_fail" + "#[^\n\r]+[\n\r]#[^\n\r]+[\n\r]# not ok - tests") set(test_groups_tap_out - "^\t1\\.\\.1" - "\tok 1 - null_test_success" - "ok - test_group1" - "\t1\\.\\.1" - "\tok 1 - int_test_success" - "ok - test_group2") + "^1\\.\\.1" + "ok 1 - null_test_success" + "# ok - test_group1" + "1\\.\\.1" + "ok 1 - int_test_success" + "# ok - test_group2") set(test_skip_tap_out "not ok 1 # SKIP") set(test_setup_fail_tap_out -- 2.7.4