Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions tools/scripts/approvalTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
os.system('')

rootPath = os.path.join(catchPath, 'tests/SelfTest/Baselines')
# Compilers can retain a symlinked source path even though baseline I/O uses
# the canonical repository path. Strip the longer root first if they overlap.
sourceRootPaths = sorted({
catchPath,
os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')),
}, key=len, reverse=True)
# Init so it is guaranteed to fail loudly if the scoping gets messed up
outputDirPath = None

Expand Down Expand Up @@ -97,12 +103,13 @@ def normalizeFilepath(line):
# Sometimes the path separators used by compiler and Python can differ,
# so we try to match the path with both forward and backward path
# separators, to make the paths relative to Catch2 repo root.
forwardSlashPath = catchPath.replace('\\', '/')
if forwardSlashPath in line:
line = line.replace(forwardSlashPath + '/', '')
backwardSlashPath = catchPath.replace('/', '\\')
if backwardSlashPath in line:
line = line.replace(backwardSlashPath + '\\', '')
for sourceRootPath in sourceRootPaths:
forwardSlashPath = sourceRootPath.replace('\\', '/')
if forwardSlashPath in line:
line = line.replace(forwardSlashPath + '/', '')
backwardSlashPath = sourceRootPath.replace('/', '\\')
if backwardSlashPath in line:
line = line.replace(backwardSlashPath + '\\', '')

m = langFilenameParser.match(line)
if m:
Expand Down