summaryrefslogtreecommitdiff
path: root/testing/tools/common.py
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-09 13:42:58 -0700
committerLei Zhang <thestig@chromium.org>2015-10-09 13:42:58 -0700
commitfd751f28cecce61ab36038799043639d570e0b26 (patch)
treed9af90a23c0176348430080b23c386d758ca26f6 /testing/tools/common.py
parent848a13b6777cbff8cc4aea3ab3d69eaa0b82ae6c (diff)
downloadpdfium-fd751f28cecce61ab36038799043639d570e0b26.tar.xz
Parallelize run_corpus_tests.py.
- Use the number of cores as the default -j value - Fall back to old code for -j 1 R=nparker@chromium.org Review URL: https://codereview.chromium.org/1398793003 .
Diffstat (limited to 'testing/tools/common.py')
-rwxr-xr-xtesting/tools/common.py12
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.'''