| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 | 5 |
| 6 import logging | 6 import logging |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 | 8 |
| 9 from pylib import android_commands | 9 from pylib import android_commands |
| 10 from pylib.base.test_result import TestResults | 10 from pylib.base.test_result import TestResults |
| 11 from pylib.forwarder import Forwarder | 11 from pylib.forwarder import Forwarder |
| 12 | 12 |
| 13 | 13 |
| 14 # Number of times we retry a test suite in case of failure. | 14 # Number of times we retry a test suite in case of failure. |
| 15 NUM_RETRIES = 3 | 15 NUM_RETRIES = 1 |
| 16 | 16 |
| 17 | 17 |
| 18 def _ShardedTestRunnable(test): | 18 def _ShardedTestRunnable(test): |
| 19 """Standalone function needed by multiprocessing.Pool.""" | 19 """Standalone function needed by multiprocessing.Pool.""" |
| 20 log_format = '[' + test.device + '] # %(asctime)-15s: %(message)s' | 20 log_format = '[' + test.device + '] # %(asctime)-15s: %(message)s' |
| 21 if logging.getLogger().handlers: | 21 if logging.getLogger().handlers: |
| 22 logging.getLogger().handlers[0].setFormatter(logging.Formatter(log_format)) | 22 logging.getLogger().handlers[0].setFormatter(logging.Formatter(log_format)) |
| 23 else: | 23 else: |
| 24 logging.basicConfig(format=log_format) | 24 logging.basicConfig(format=log_format) |
| 25 # Handle SystemExit here since python has a bug to exit current process | 25 # Handle SystemExit here since python has a bug to exit current process |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 for t in test_results.GetAllBroken(): | 151 for t in test_results.GetAllBroken(): |
| 152 self.tests += [t.name] | 152 self.tests += [t.name] |
| 153 if not self.tests: | 153 if not self.tests: |
| 154 break | 154 break |
| 155 else: | 155 else: |
| 156 # We ran out retries, possibly out of healthy devices. | 156 # We ran out retries, possibly out of healthy devices. |
| 157 # There's no recovery at this point. | 157 # There's no recovery at this point. |
| 158 raise Exception('Unrecoverable error while retrying test runs.') | 158 raise Exception('Unrecoverable error while retrying test runs.') |
| 159 self._KillHostForwarder() | 159 self._KillHostForwarder() |
| 160 return final_results | 160 return final_results |
| OLD | NEW |