diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-09 13:49:17 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-09 13:49:17 -0700 |
commit | 6f3c2ffd369af00e1a4f0ac5413b816f464cba78 (patch) | |
tree | 23e91ac9d6ef93f9dc02d7da47057e23a80a6932 /testing/tools/common.py | |
parent | 79c38e39d5094b03bfddd80dd39a666a96bbcdcc (diff) | |
download | pdfium-6f3c2ffd369af00e1a4f0ac5413b816f464cba78.tar.xz |
Merge to XFA: Parallelize run_corpus_tests.py.
- Use the number of cores as the default -j value
- Fall back to old code for -j 1
TBR=nparker@chromium.org
Review URL: https://codereview.chromium.org/1398793003 .
(cherry picked from commit fd751f28cecce61ab36038799043639d570e0b26)
Review URL: https://codereview.chromium.org/1395253002 .
Diffstat (limited to 'testing/tools/common.py')
-rwxr-xr-x | testing/tools/common.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/tools/common.py b/testing/tools/common.py index 14745a8a3e..d45404b4d4 100755 --- a/testing/tools/common.py +++ b/testing/tools/common.py @@ -4,6 +4,7 @@ # found in the LICENSE file. import os +import subprocess import sys def os_name(): @@ -16,6 +17,17 @@ def os_name(): raise Exception('Confused, can not determine OS, aborting.') +def RunCommand(cmd, redirect_output=False): + try: + if redirect_output: + sys.stdout.write(subprocess.check_output(cmd, stderr=subprocess.STDOUT)) + else: + subprocess.check_call(cmd) + return None + except subprocess.CalledProcessError as e: + return e + + class DirectoryFinder: '''A class for finding directories and paths under either a standalone checkout or a chromium checkout of PDFium.''' |