Cleanups output normalization in ApprovalTests
Removed: * NaN normalization * INFINITY normalization * errno normalization * Completely unused duration regex Tests using these macros should be tagged `[approvals]` so they are not run as part of approval tests. Also simplified regex for the test's executable filename, and hidden some tests relying on nullptr normalization.
This commit is contained in:
parent
d861e73f86
commit
4ff8b27bb6
22 changed files with 55 additions and 264 deletions
|
@ -28,7 +28,6 @@ filelocParser = re.compile(r'''
|
|||
''', re.VERBOSE)
|
||||
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]*"')
|
||||
# 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.
|
||||
|
@ -39,40 +38,14 @@ versionParser = re.compile(r'Catch2 v[0-9]+\.[0-9]+\.[0-9]+(-\w*\.[0-9]+)?')
|
|||
nullParser = re.compile(r'\b(__null|nullptr)\b')
|
||||
exeNameParser = re.compile(r'''
|
||||
\b
|
||||
(CatchSelfTest|SelfTest) # Expected executable name
|
||||
SelfTest # Expected executable name
|
||||
(?:.exe)? # Executable name contains .exe on Windows.
|
||||
\b
|
||||
''', re.VERBOSE)
|
||||
# This is a hack until something more reasonable is figured out
|
||||
specialCaseParser = re.compile(r'file\((\d+)\)')
|
||||
|
||||
# errno macro expands into various names depending on platform, so we need to fix them up as well
|
||||
errnoParser = re.compile(r'''
|
||||
\(\*__errno_location\s*\(\)\)
|
||||
|
|
||||
\(\*__error\(\)\)
|
||||
|
|
||||
\(\*_errno\(\)\)
|
||||
''', re.VERBOSE)
|
||||
sinceEpochParser = re.compile(r'\d+ .+ since epoch')
|
||||
infParser = re.compile(r'''
|
||||
\(\(float\)\(1e\+300\ \*\ 1e\+300\)\) # MSVC INFINITY macro
|
||||
|
|
||||
\(__builtin_inff\(\)\) # Linux (ubuntu) INFINITY macro
|
||||
|
|
||||
\(__builtin_inff\ \(\)\) # Fedora INFINITY macro
|
||||
|
|
||||
__builtin_huge_valf\(\) # OSX macro
|
||||
''', re.VERBOSE)
|
||||
nanParser = re.compile(r'''
|
||||
\(\(float\)\(\(\(float\)\(1e\+300\ \*\ 1e\+300\)\)\ \*\ 0\.0F\)\) # MSVC NAN macro
|
||||
|
|
||||
\(\(float\)\(INFINITY\ \*\ 0\.0F\)\) # Yet another MSVC NAN macro
|
||||
|
|
||||
\(__builtin_nanf\ \(""\)\) # Linux (ubuntu) NAN macro
|
||||
|
|
||||
__builtin_nanf\("0x<hex\ digits>"\) # The weird content of the brackets is there because a different parser has already ran before this one
|
||||
''', re.VERBOSE)
|
||||
|
||||
# The weird OR is there to always have at least empty string for group 1
|
||||
tapTestNumParser = re.compile(r'^((?:not ok)|(?:ok)|(?:warning)|(?:info)) (\d+) -')
|
||||
|
@ -157,10 +130,7 @@ def filterLine(line, isCompact):
|
|||
line = durationParser.sub(' duration="{duration}"', line)
|
||||
line = timestampsParser.sub('{iso8601-timestamp}', line)
|
||||
line = specialCaseParser.sub('file:\g<1>', line)
|
||||
line = errnoParser.sub('errno', line)
|
||||
line = sinceEpochParser.sub('{since-epoch-report}', line)
|
||||
line = infParser.sub('INFINITY', line)
|
||||
line = nanParser.sub('NAN', line)
|
||||
return line
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue