Made approvals more platform agnostic

removes root from all paths - so only relative paths remain
This commit is contained in:
Phil Nash 2014-12-11 23:40:29 +00:00
parent c6d9bde04e
commit a99e75b928
2 changed files with 747 additions and 738 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,9 @@ from scriptCommon import catchPath
rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' ) 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]*)(.*)' ) filelineParser = re.compile( r'(.*\..pp:)([0-9]*)(.*)' )
pathParser = re.compile( r'(.*?)/(.*\..pp)(.*)' )
lineNumberParser = re.compile( r'(.*)line="[0-9]*"(.*)' ) lineNumberParser = re.compile( r'(.*)line="[0-9]*"(.*)' )
hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' ) hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' )
durationsParser = re.compile( r'(.*)time="[0-9]*\.[0-9]*"(.*)' ) durationsParser = re.compile( r'(.*)time="[0-9]*\.[0-9]*"(.*)' )
@ -26,14 +27,20 @@ overallResult = 0
def filterLine( line ): def filterLine( line ):
m = filenameParser.match( line ) m = filenameParser.match( line )
if m: if m:
line = m.group(1) + m.group(2) line = m.group(2) + m.group(3)
m = filelineParser.match( line ) m2 = filelineParser.match( line )
if m: if m2:
line = m.group(1) + "<line number>" + m.group(3) line = m2.group(1) + "<line number>" + m2.group(3)
else: else:
m = lineNumberParser.match( line ) m2 = lineNumberParser.match( line )
if m: if m2:
line = m.group(1) + m.group(2) 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 ) m = versionParser.match( line )
if m: if m:
line = m.group(1) + "<version>" + m.group(2) line = m.group(1) + "<version>" + m.group(2)
@ -52,6 +59,8 @@ def filterLine( line ):
def approve( baseName, args ): def approve( baseName, args ):
global overallResult global overallResult
args[0:0] = [cmdPath] 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 ) ) baselinesPath = os.path.join( rootPath, '{0}.approved.txt'.format( baseName ) )
rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) )
filteredResultsPath = os.path.join( rootPath, '{0}.unapproved.txt'.format( baseName ) ) filteredResultsPath = os.path.join( rootPath, '{0}.unapproved.txt'.format( baseName ) )