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

Unified Diff: testing/tools/common.py

Issue 2578893004: Gold support in PDFium (Closed)
Patch Set: Incorporated feedback Created 4 years 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 | « samples/pdfium_test.cc ('k') | testing/tools/gold.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/tools/common.py
diff --git a/testing/tools/common.py b/testing/tools/common.py
index 1e1d257f48d608eb33845e9877b588442577e118..a0cc946f1ad5377b4629255adaede150f57c45d1 100755
--- a/testing/tools/common.py
+++ b/testing/tools/common.py
@@ -25,6 +25,24 @@ def RunCommand(cmd):
except subprocess.CalledProcessError as e:
return e
+# RunCommandExtractHashedFiles returns a tuple: (raised_exception, hashed_files)
+# It runs the given command. If it fails it will return an exception and None.
+# If it succeeds it will return None and the list of processed files extracted
+# from the output of the command. It expects lines in this format:
+# MD5:<path_to_image_file>:<md5_hash_in_hex>
+# The returned hashed_files is a list of (file_path, MD5-hash) pairs.
+def RunCommandExtractHashedFiles(cmd):
+ try:
+ output = subprocess.check_output(cmd, universal_newlines=True)
+ ret = []
+ for line in output.split('\n'):
+ line = line.strip()
+ if line.startswith("MD5:"):
+ ret.append([x.strip() for x in line.lstrip("MD5:").rsplit(":", 1)])
+ return None, ret
+ except subprocess.CalledProcessError as e:
+ return e, None
+
# Adjust Dr. Memory wrapper to have separate log directory for each test
# for better error reporting.
def DrMemoryWrapper(wrapper, pdf_name):
« no previous file with comments | « samples/pdfium_test.cc ('k') | testing/tools/gold.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698