| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs each test cases as a single shard, single process execution. | 6 """Runs each test cases as a single shard, single process execution. |
| 7 | 7 |
| 8 Similar to sharding_supervisor.py but finer grained. Runs multiple instances in | 8 Similar to sharding_supervisor.py but finer grained. Runs multiple instances in |
| 9 parallel. | 9 parallel. |
| 10 """ | 10 """ |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 def join(self, progress=None, timeout=None): | 274 def join(self, progress=None, timeout=None): |
| 275 """Extracts all the results from each threads unordered.""" | 275 """Extracts all the results from each threads unordered.""" |
| 276 if progress and timeout: | 276 if progress and timeout: |
| 277 while not self._tasks.join(timeout): | 277 while not self._tasks.join(timeout): |
| 278 progress.print_update() | 278 progress.print_update() |
| 279 progress.print_update() | 279 progress.print_update() |
| 280 else: | 280 else: |
| 281 self._tasks.join() | 281 self._tasks.join() |
| 282 out = [] | 282 out = [] |
| 283 # Look for exceptions. |
| 283 for w in self._workers: | 284 for w in self._workers: |
| 284 if w.exceptions: | 285 if w.exceptions: |
| 285 raise w.exceptions[0][0], w.exceptions[0][1], w.exceptions[0][2] | 286 raise w.exceptions[0][0], w.exceptions[0][1], w.exceptions[0][2] |
| 286 out.extend(w.outputs) | 287 out.extend(w.outputs) |
| 287 w.outputs = [] | 288 w.outputs = [] |
| 288 # Look for exceptions. | |
| 289 return out | 289 return out |
| 290 | 290 |
| 291 def close(self): | 291 def close(self): |
| 292 """Closes all the threads.""" | 292 """Closes all the threads.""" |
| 293 for _ in range(len(self._workers)): | 293 for _ in range(len(self._workers)): |
| 294 # Enqueueing None causes the worker to stop. | 294 # Enqueueing None causes the worker to stop. |
| 295 self._tasks.put(None) | 295 self._tasks.put(None) |
| 296 for t in self._workers: | 296 for t in self._workers: |
| 297 t.join() | 297 t.join() |
| 298 | 298 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 cmd, | 895 cmd, |
| 896 test_cases, | 896 test_cases, |
| 897 options.jobs, | 897 options.jobs, |
| 898 options.timeout, | 898 options.timeout, |
| 899 options.run_all, | 899 options.run_all, |
| 900 result_file) | 900 result_file) |
| 901 | 901 |
| 902 | 902 |
| 903 if __name__ == '__main__': | 903 if __name__ == '__main__': |
| 904 sys.exit(main(sys.argv[1:])) | 904 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |