| OLD | NEW |
| 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """A Thread object for running the test shell and processing URLs from a | 5 """A Thread object for running the test shell and processing URLs from a |
| 6 shared queue. | 6 shared queue. |
| 7 | 7 |
| 8 Each thread runs a separate instance of the test_shell binary and validates | 8 Each thread runs a separate instance of the test_shell binary and validates |
| 9 the output. When there are no more URLs to process in the shared queue, the | 9 the output. When there are no more URLs to process in the shared queue, the |
| 10 thread exits. | 10 thread exits. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 # Don't add any more failures if we already have a crash or timeout, so | 95 # Don't add any more failures if we already have a crash or timeout, so |
| 96 # we don't double-report those tests. | 96 # we don't double-report those tests. |
| 97 if not crash_or_timeout: | 97 if not crash_or_timeout: |
| 98 failures.extend(new_failures) | 98 failures.extend(new_failures) |
| 99 | 99 |
| 100 return failures | 100 return failures |
| 101 | 101 |
| 102 | 102 |
| 103 def StartTestShell(command, args): | 103 def StartTestShell(command, args): |
| 104 """Returns the process for a new test_shell started in layout-tests mode.""" | 104 """Returns the process for a new test_shell started in layout-tests mode.""" |
| 105 cmd = command + ['--layout-tests'] + args | 105 cmd = [] |
| 106 # Hook for injecting valgrind or other runtime instrumentation, |
| 107 # used by e.g. tools/valgrind/valgrind_tests.py. |
| 108 wrapper = os.environ["BROWSER_WRAPPER"] |
| 109 if wrapper != None: |
| 110 cmd += [wrapper] |
| 111 cmd += command + ['--layout-tests'] + args |
| 106 return subprocess.Popen(cmd, | 112 return subprocess.Popen(cmd, |
| 107 stdin=subprocess.PIPE, | 113 stdin=subprocess.PIPE, |
| 108 stdout=subprocess.PIPE, | 114 stdout=subprocess.PIPE, |
| 109 stderr=subprocess.STDOUT) | 115 stderr=subprocess.STDOUT) |
| 110 | 116 |
| 111 | 117 |
| 112 class SingleTestThread(threading.Thread): | 118 class SingleTestThread(threading.Thread): |
| 113 """Thread wrapper for running a single test file.""" | 119 """Thread wrapper for running a single test file.""" |
| 114 def __init__(self, test_shell_command, shell_args, test_uri, filename, | 120 def __init__(self, test_shell_command, shell_args, test_uri, filename, |
| 115 test_types, test_args, target): | 121 test_types, test_args, target): |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 self._shell_args) | 335 self._shell_args) |
| 330 | 336 |
| 331 def _KillTestShell(self): | 337 def _KillTestShell(self): |
| 332 """Kill the test shell process if it's running.""" | 338 """Kill the test shell process if it's running.""" |
| 333 if self._test_shell_proc: | 339 if self._test_shell_proc: |
| 334 self._test_shell_proc.stdin.close() | 340 self._test_shell_proc.stdin.close() |
| 335 self._test_shell_proc.stdout.close() | 341 self._test_shell_proc.stdout.close() |
| 336 if self._test_shell_proc.stderr: | 342 if self._test_shell_proc.stderr: |
| 337 self._test_shell_proc.stderr.close() | 343 self._test_shell_proc.stderr.close() |
| 338 self._test_shell_proc = None | 344 self._test_shell_proc = None |
| OLD | NEW |