Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorPhil Nash2014-12-11 23:40:29 +0000
committerPhil Nash2014-12-11 23:40:29 +0000
commita99e75b928684e1442661e9a8a5ec458770042e2 (patch)
tree7e6b9749f07815f4b66b3e9b00b871caf87e6593 /scripts
parentc6d9bde04e054c2094a03d6dab914ed0f5a44307 (diff)
downloadcatch3-a99e75b928684e1442661e9a8a5ec458770042e2.tar.gz
Made approvals more platform agnostic
removes root from all paths - so only relative paths remain
Diffstat (limited to 'scripts')
-rw-r--r--scripts/approvalTests.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
index 329c99b5..f2ffea5c 100644
--- a/scripts/approvalTests.py
+++ b/scripts/approvalTests.py
@@ -9,8 +9,9 @@ from scriptCommon import catchPath
rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' )
-filenameParser = re.compile( r'.*/(.*\..pp:)(.*)' )
+filenameParser = re.compile( r'(.*)/(.*\..pp:)(.*)' )
filelineParser = re.compile( r'(.*\..pp:)([0-9]*)(.*)' )
+pathParser = re.compile( r'(.*?)/(.*\..pp)(.*)' )
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]*"(.*)' )
@@ -26,14 +27,20 @@ overallResult = 0
def filterLine( line ):
m = filenameParser.match( line )
if m:
- line = m.group(1) + m.group(2)
- m = filelineParser.match( line )
- if m:
- line = m.group(1) + "<line number>" + m.group(3)
+ line = m.group(2) + m.group(3)
+ m2 = filelineParser.match( line )
+ if m2:
+ line = m2.group(1) + "<line number>" + m2.group(3)
else:
- m = lineNumberParser.match( line )
- if m:
- line = m.group(1) + m.group(2)
+ m2 = lineNumberParser.match( line )
+ if m2:
+ line = m2.group(1) + m2.group(2)
+ m = pathParser.match( line )
+ if m:
+ path = "/" + m.group(2)
+ if path.startswith( catchPath ):
+ path = path[1+len(catchPath):]
+ line = m.group(1) + path + m.group(3)
m = versionParser.match( line )
if m:
line = m.group(1) + "<version>" + m.group(2)
@@ -52,6 +59,8 @@ def filterLine( line ):
def approve( baseName, args ):
global overallResult
args[0:0] = [cmdPath]
+ if not os.path.exists( cmdPath ):
+ raise Exception( "Executable doesn't exist at " + cmdPath )
baselinesPath = os.path.join( rootPath, '{0}.approved.txt'.format( baseName ) )
rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) )
filteredResultsPath = os.path.join( rootPath, '{0}.unapproved.txt'.format( baseName ) )