''', 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) if len(sys.argv) == 2: cmdPath = sys.argv[1] else: cmdPath = os.path.join(catchPath, scriptCommon.getBuildExecutable()) overallResult = 0 def diffFiles(fileA, fileB): with io.open(fileA, 'r', encoding='utf-8', errors='surrogateescape') as file: aLines = [line.rstrip() for line in file.readlines()] with io.open(fileB, 'r', encoding='utf-8', errors='surrogateescape') as file: bLines = [line.rstrip() for line in file.readlines()] shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1] shortenedFilenameB = fileB.rsplit(os.sep, 1)[-1]
\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\ \(\)\) | \(\*__error\(\)\) ''', re.VERBOSE) if len(sys.argv) == 2: cmdPath = sys.argv[1] else: cmdPath = os.path.join(catchPath, scriptCommon.getBuildExecutable()) overallResult = 0 def diffFiles(fileA, fileB): with open(fileA, 'r') as file: aLines = [line.rstrip() for line in file.readlines()] with open(fileB, 'r') as file: bLines = [line.rstrip() for line in file.readlines()] shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1] shortenedFilenameB = fileB.rsplit(os.sep, 1)[-1] diff = difflib.unified_diff(aLines, bLines, fromfile=shortenedFilenameA, tofile=shortenedFilenameB, n=0) return [line for line in diff if line[0] in ('+', '-')]