summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/isolate/list_test_cases.py11
-rwxr-xr-xtools/isolate/run_test_cases.py2
-rwxr-xr-xtools/isolate/run_test_cases_test.py4
3 files changed, 16 insertions, 1 deletions
diff --git a/tools/isolate/list_test_cases.py b/tools/isolate/list_test_cases.py
index 6c1cf49..340a9ba 100755
--- a/tools/isolate/list_test_cases.py
+++ b/tools/isolate/list_test_cases.py
@@ -17,8 +17,19 @@ class Failure(Exception):
pass
+def fix_python_path(cmd):
+ """Returns the fixed command line to call the right python executable."""
+ out = cmd[:]
+ if out[0] == 'python':
+ out[0] = sys.executable
+ elif out[0].endswith('.py'):
+ out.insert(0, sys.executable)
+ return out
+
+
def gtest_list_tests(executable):
cmd = [executable, '--gtest_list_tests']
+ cmd = fix_python_path(cmd)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if p.returncode:
diff --git a/tools/isolate/run_test_cases.py b/tools/isolate/run_test_cases.py
index 78225f6..1410013 100755
--- a/tools/isolate/run_test_cases.py
+++ b/tools/isolate/run_test_cases.py
@@ -66,7 +66,7 @@ class Runner(object):
def map(self, test_case):
"""Traces a single test case and returns its output."""
cmd = [self.executable, '--gtest_filter=%s' % test_case]
-
+ cmd = list_test_cases.fix_python_path(cmd)
out = []
for retry in range(self.retry_count):
start = time.time()
diff --git a/tools/isolate/run_test_cases_test.py b/tools/isolate/run_test_cases_test.py
index ac4b0f9..bfea851 100755
--- a/tools/isolate/run_test_cases_test.py
+++ b/tools/isolate/run_test_cases_test.py
@@ -25,11 +25,15 @@ class TraceTestCases(unittest.TestCase):
'--no-dump',
target,
]
+ logging.debug(' '.join(cmd))
proc = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# pylint is confused.
out, err = proc.communicate() or ('', '')
self.assertEquals(0, proc.returncode)
+ if sys.platform == 'win32':
+ # TODO(maruel): Figure out why replace('\r\n', '\n') doesn't work.
+ out = out.replace('\r', '')
expected = (
'Note: Google Test filter = Baz.Fail\n'
'\n'