| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import fnmatch | 5 import fnmatch |
| 6 import imp | 6 import imp |
| 7 import logging | 7 import logging |
| 8 import signal | 8 import signal |
| 9 import thread | 9 import thread |
| 10 import threading | 10 import threading |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 class TestsTerminated(Exception): | 86 class TestsTerminated(Exception): |
| 87 pass | 87 pass |
| 88 | 88 |
| 89 def stop_tests(_signum, _frame): | 89 def stop_tests(_signum, _frame): |
| 90 logging.critical('Received SIGTERM. Stopping test execution.') | 90 logging.critical('Received SIGTERM. Stopping test execution.') |
| 91 exit_now.set() | 91 exit_now.set() |
| 92 raise TestsTerminated() | 92 raise TestsTerminated() |
| 93 | 93 |
| 94 try: | 94 try: |
| 95 with signal_handler.SignalHandler(signal.SIGTERM, stop_tests): | 95 with signal_handler.AddSignalHandler(signal.SIGTERM, stop_tests): |
| 96 tries = 0 | 96 tries = 0 |
| 97 results = [] | 97 results = [] |
| 98 while tries < self._env.max_tries and tests: | 98 while tries < self._env.max_tries and tests: |
| 99 logging.info('STARTING TRY #%d/%d', tries + 1, self._env.max_tries) | 99 logging.info('STARTING TRY #%d/%d', tries + 1, self._env.max_tries) |
| 100 logging.info('Will run %d tests on %d devices: %s', | 100 logging.info('Will run %d tests on %d devices: %s', |
| 101 len(tests), len(self._env.devices), | 101 len(tests), len(self._env.devices), |
| 102 ', '.join(str(d) for d in self._env.devices)) | 102 ', '.join(str(d) for d in self._env.devices)) |
| 103 for t in tests: | 103 for t in tests: |
| 104 logging.debug(' %s', t) | 104 logging.debug(' %s', t) |
| 105 | 105 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 def _RunTest(self, device, test): | 188 def _RunTest(self, device, test): |
| 189 raise NotImplementedError | 189 raise NotImplementedError |
| 190 | 190 |
| 191 def _ShouldShard(self): | 191 def _ShouldShard(self): |
| 192 raise NotImplementedError | 192 raise NotImplementedError |
| 193 | 193 |
| 194 | 194 |
| 195 class NoTestsError(Exception): | 195 class NoTestsError(Exception): |
| 196 """Error for when no tests are found.""" | 196 """Error for when no tests are found.""" |
| OLD | NEW |