aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bronnikov <Sergey.Bronnikov@kaspersky.com>2019-10-02 15:51:57 +0300
committerAndreas Schneider <asn@cryptomilk.org>2020-10-04 11:05:33 +0200
commit0df9d23baba1ab2fe787f96eab85609191e1acd7 (patch)
treec7500746fc54c7cf88de8e231f885a4adb1fe5d8
parent1206b4ac0e40ee3e9f23d7d133589f9a29e09c56 (diff)
downloadcmocka-0df9d23baba1ab2fe787f96eab85609191e1acd7.tar.gz
cmocka-0df9d23baba1ab2fe787f96eab85609191e1acd7.tar.xz
cmocka-0df9d23baba1ab2fe787f96eab85609191e1acd7.zip
cmocka: add header with version to TAP13 output
Version must be specified in a first line of TAP13 output. See TAP13 specification - https://testanything.org/tap-version-13-specification.html Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/cmocka.c7
-rw-r--r--tests/CMakeLists.txt9
2 files changed, 13 insertions, 3 deletions
diff --git a/src/cmocka.c b/src/cmocka.c
index 0e29a2c..8f510ad 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#include <time.h>
#include <float.h>
@@ -2604,6 +2605,12 @@ static void cmprintf_standard(enum cm_printf_type type,
static void cmprintf_group_start_tap(const size_t num_tests)
{
+ static bool version_printed = false;
+ if (!version_printed) {
+ print_message("TAP version 13\n");
+ version_printed = true;
+ }
+
print_message("1..%u\n", (unsigned)num_tests);
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 60e727a..b616a45 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -174,16 +174,19 @@ set(TEST_OUTPUT_FMTS
xml)
set(test_basics_tap_out
- "^1\\.\\.2"
+ "^TAP version 13"
+ "1\\.\\.2"
"ok 1 - null_test_success"
"ok 2 - int_test_success"
"# ok - tests")
set(test_assert_macros_fail_tap_out
- "^1\\.\\.1"
+ "^TAP version 13"
+ "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
- "^1\\.\\.1"
+ "^TAP version 13"
+ "1\\.\\.1"
"ok 1 - null_test_success"
"# ok - test_group1"
"1\\.\\.1"