diff options
| author | Martin Hořeňovský | 2021-05-22 23:41:58 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-10-10 22:10:48 +0200 |
| commit | de67278e145bf0d5d4ceb3e2bdcf42fda5b4876d (patch) | |
| tree | 0f5179887180c0a3f05c4e5cf63c5926faba6501 /tools | |
| parent | 1d9696d22d4a33b106dee1e3f69cb310d855b637 (diff) | |
| download | catch3-de67278e145bf0d5d4ceb3e2bdcf42fda5b4876d.tar.gz | |
JUnit reporter uses only 3 decimal places when reporting durations
We used to use whatever precision we ended up having from C++'s
stdlib. However, some relatively popular tools, like Jenkins,
use Maven SureFire XML schema to validate JUnit test reports, and
Maven SureFire schema requires the duration to have at most 3
decimal places.
For compatibility, the JUnit reporter will now respect this
limitation.
Closes #2221
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/scripts/approvalTests.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/scripts/approvalTests.py b/tools/scripts/approvalTests.py index 73e9b832..1bef3e52 100755 --- a/tools/scripts/approvalTests.py +++ b/tools/scripts/approvalTests.py @@ -29,7 +29,11 @@ filelocParser = re.compile(r''' lineNumberParser = re.compile(r' line="[0-9]*"') hexParser = re.compile(r'\b(0[xX][0-9a-fA-F]+)\b') durationsParser = re.compile(r' time="[0-9]*\.[0-9]*"') -sonarqubeDurationParser = re.compile(r''' duration=["'][0-9]+["']''') +# Note: junit must serialize time with 3 (or or less) decimal places +# before generalizing this parser, make sure that this is checked +# in other places too. +junitDurationsParser = re.compile(r' time="[0-9]+\.[0-9]{3}"') +durationParser = re.compile(r''' duration=['"][0-9]+['"]''') timestampsParser = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z') versionParser = re.compile(r'Catch v[0-9]+\.[0-9]+\.[0-9]+(-\w*\.[0-9]+)?') nullParser = re.compile(r'\b(__null|nullptr)\b') @@ -143,8 +147,8 @@ def filterLine(line, isCompact): line = hexParser.sub("0x<hex digits>", line) # strip durations and timestamps - line = durationsParser.sub(' time="{duration}"', line) - line = sonarqubeDurationParser.sub(' duration="{duration}"', line) + line = junitDurationsParser.sub(' time="{duration}"', line) + line = durationParser.sub(' duration="{duration}"', line) line = timestampsParser.sub('{iso8601-timestamp}', line) line = specialCaseParser.sub('file:\g<1>', line) line = errnoParser.sub('errno', line) |