summaryrefslogtreecommitdiff
path: root/testing/tools/pngdiffer.py
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-04-15 12:03:00 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-15 12:03:00 -0700
commitc3b26b1479824aa5ce745c220a82de7528bc26a9 (patch)
tree83b094cf403a010499e1bac1ed94fef28ec8cc52 /testing/tools/pngdiffer.py
parent85fc26f3411584586707798c1ebf39a194f60cf0 (diff)
downloadpdfium-c3b26b1479824aa5ce745c220a82de7528bc26a9.tar.xz
Use platform specific test results as fallback in difference tests
So far, we have only two Windows tests require to use platform specific test results due to platform idiosyncracies. However, VS2015 has fixed those issues. So in general, We only need to use platform based results if checking against the regular results failed. Review URL: https://codereview.chromium.org/1892013003
Diffstat (limited to 'testing/tools/pngdiffer.py')
-rwxr-xr-xtesting/tools/pngdiffer.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/testing/tools/pngdiffer.py b/testing/tools/pngdiffer.py
index bef252674f..79d1b7588a 100755
--- a/testing/tools/pngdiffer.py
+++ b/testing/tools/pngdiffer.py
@@ -49,21 +49,32 @@ class PNGDiffer():
while True:
actual_path = actual_path_template % i
expected_path = expected_path_template % i
+ # PDFium tests should be platform independent. Platform based results are
+ # used to capture platform dependent implementations.
platform_expected_path = (
platform_expected_path_template % (self.os_name, i))
- if os.path.exists(platform_expected_path):
- expected_path = platform_expected_path
- elif not os.path.exists(expected_path):
+ if (not os.path.exists(expected_path) and
+ not os.path.exists(platform_expected_path)):
if i == 0:
print "WARNING: no expected results files for " + input_filename
break
print "Checking " + actual_path
sys.stdout.flush()
- error = common.RunCommand(
- [self.pdfium_diff_path, expected_path, actual_path], redirect_output)
+ if os.path.exists(expected_path):
+ error = common.RunCommand(
+ [self.pdfium_diff_path, expected_path, actual_path],
+ redirect_output)
+ else:
+ error = 1;
if error:
- print "FAILURE: " + input_filename + "; " + str(error)
- return True
+ # When failed, we check against platform based results.
+ if os.path.exists(platform_expected_path):
+ error = common.RunCommand(
+ [self.pdfium_diff_path, platform_expected_path, actual_path],
+ redirect_output)
+ if error:
+ print "FAILURE: " + input_filename + "; " + str(error)
+ return True
i += 1
return False