From 17554bd0a05e1c78f898ad8c78f8236b1f7eb395 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 15 Mar 2012 19:55:30 +0000 Subject: [PATCH] Fixed an issue with comparing repeated values in regression tests --- site_scons/buildutils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/site_scons/buildutils.py b/site_scons/buildutils.py index a3f227e58..17d392a3e 100644 --- a/site_scons/buildutils.py +++ b/site_scons/buildutils.py @@ -211,6 +211,7 @@ def compareTextFiles(env, file1, file2): if len(floats1) != len(floats2): continue + allMatch = True for j in range(len(floats1)): if floats1[j] == floats2[j]: # String representations match, so replacement is unnecessary @@ -219,16 +220,18 @@ def compareTextFiles(env, file1, file2): delta = max(getPrecision(floats1[j][1]), getPrecision(floats2[j][1])) num1 = float(floats1[j][1]) num2 = float(floats2[j][1]) - if num1 - 1.1*delta < num2 < num1 + 1.1*delta: - # update the string with a matching string - line2 = line2.replace(''.join(floats2[j]), - ''.join(floats1[j])) - text2[i] = line2 + if not num1 - 1.1*delta < num2 < num1 + 1.1*delta: + allMatch = False + break + + # All the values are sufficiently close, so replace the string + # so that the diff of this line will succeed + text2[i] = line1 # Try the comparison again diff = list(difflib.unified_diff(text1, text2)) if diff: - 'Found differences between %s and %s:' % (file1, file2) + print 'Found differences between %s and %s:' % (file1, file2) print '>>>' print '\n'.join(diff) print '<<<'