summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-13 19:22:56 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-13 19:22:56 +0000
commit5cf6383fc7efe29cff25c2f41ad02938ee824a7b (patch)
tree6d3302f269f33fc63f9fc5b790c6ff526b4e33e3 /tools
parent11b0856d2970ae13db2e49fc9473128aa2ffbfe1 (diff)
downloadchromium_src-5cf6383fc7efe29cff25c2f41ad02938ee824a7b.zip
chromium_src-5cf6383fc7efe29cff25c2f41ad02938ee824a7b.tar.gz
chromium_src-5cf6383fc7efe29cff25c2f41ad02938ee824a7b.tar.bz2
Fix run_test_cases_test.py on Windows.
Add manual handling to start a python script. Add manual cleanup of CR. In theory using universal_newlines should work but in practice it is confused by the different CRLF/LF combinations.. R=cmp@chromium.org NOTRY=true BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10537140 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-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'