Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: testing/tools/pngdiffer.py

Issue 1398793003: Parallelize run_corpus_tests.py. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/tools/common.py ('k') | testing/tools/run_corpus_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/tools/pngdiffer.py
diff --git a/testing/tools/pngdiffer.py b/testing/tools/pngdiffer.py
index 35eaaa437a3d48f68bb4f7ffd31440aac78c4c30..bef252674f09d848a37448afb099fb2dd54b1577 100755
--- a/testing/tools/pngdiffer.py
+++ b/testing/tools/pngdiffer.py
@@ -4,9 +4,10 @@
# found in the LICENSE file.
import os
-import subprocess
import sys
+import common
+
class PNGDiffer():
ACTUAL_TEMPLATE = '.pdf.%d.png'
EXPECTED_TEMPLATE = '_expected' + ACTUAL_TEMPLATE
@@ -37,33 +38,33 @@ class PNGDiffer():
i += 1
return actual_paths
- def HasDifferences(self, input_filename, source_dir, working_dir):
+ def HasDifferences(self, input_filename, source_dir, working_dir,
+ redirect_output=False):
template_paths = self._GetTemplatePaths(
input_filename, source_dir, working_dir)
actual_path_template = template_paths[0];
expected_path_template = template_paths[1]
platform_expected_path_template = template_paths[2]
i = 0
- try:
- while True:
- actual_path = actual_path_template % i
- expected_path = expected_path_template % i
- 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 i == 0:
- print "WARNING: no expected results files for " + input_filename
- break
- print "Checking " + actual_path
- sys.stdout.flush()
- subprocess.check_call(
- [self.pdfium_diff_path, expected_path, actual_path])
- i += 1
- except subprocess.CalledProcessError as e:
- print "FAILURE: " + input_filename + "; " + str(e)
- return True
+ while True:
+ actual_path = actual_path_template % i
+ expected_path = expected_path_template % i
+ 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 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 error:
+ print "FAILURE: " + input_filename + "; " + str(error)
+ return True
+ i += 1
return False
def _GetTemplatePaths(self, input_filename, source_dir, working_dir):
« no previous file with comments | « testing/tools/common.py ('k') | testing/tools/run_corpus_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698