Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 import math | 30 import math |
| 31 import threading | 31 import threading |
| 32 import time | 32 import time |
| 33 | 33 |
| 34 from webkitpy.common import message_pool | 34 from webkitpy.common import message_pool |
| 35 from webkitpy.layout_tests.controllers import single_test_runner | 35 from webkitpy.layout_tests.controllers import single_test_runner |
| 36 from webkitpy.layout_tests.models.test_run_results import TestRunResults | 36 from webkitpy.layout_tests.models.test_run_results import TestRunResults |
| 37 from webkitpy.layout_tests.models import test_expectations | 37 from webkitpy.layout_tests.models import test_expectations |
| 38 from webkitpy.layout_tests.models import test_failures | 38 from webkitpy.layout_tests.models import test_failures |
| 39 from webkitpy.layout_tests.models import test_results | 39 from webkitpy.layout_tests.models import test_results |
| 40 from webkitpy.layout_tests.port import driver | |
| 40 from webkitpy.tool import grammar | 41 from webkitpy.tool import grammar |
| 41 | 42 |
| 42 | 43 |
| 43 _log = logging.getLogger(__name__) | 44 _log = logging.getLogger(__name__) |
| 44 | 45 |
| 45 | 46 |
| 46 TestExpectations = test_expectations.TestExpectations | 47 TestExpectations = test_expectations.TestExpectations |
| 47 | 48 |
| 48 # Export this so callers don't need to know about message pools. | 49 # Export this so callers don't need to know about message pools. |
| 49 WorkerException = message_pool.WorkerException | 50 WorkerException = message_pool.WorkerException |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 self._host = self._caller.host | 232 self._host = self._caller.host |
| 232 self._filesystem = self._host.filesystem | 233 self._filesystem = self._host.filesystem |
| 233 self._port = self._host.port_factory.get(self._options.platform, self._o ptions) | 234 self._port = self._host.port_factory.get(self._options.platform, self._o ptions) |
| 234 | 235 |
| 235 self._batch_count = 0 | 236 self._batch_count = 0 |
| 236 self._batch_size = self._options.batch_size or 0 | 237 self._batch_size = self._options.batch_size or 0 |
| 237 | 238 |
| 238 def handle(self, name, source, test_list_name, test_inputs): | 239 def handle(self, name, source, test_list_name, test_inputs): |
| 239 assert name == 'test_list' | 240 assert name == 'test_list' |
| 240 for i, test_input in enumerate(test_inputs): | 241 for i, test_input in enumerate(test_inputs): |
| 241 device_offline = self._run_test(test_input, test_list_name) | 242 try: |
| 242 if device_offline: | 243 device_offline = self._run_test(test_input, test_list_name) |
| 243 self._caller.post('device_offline', test_list_name, test_inputs[ i + 1:]) | 244 # FIXME: Do we need both the DriverOutput.device_offline and the exception? |
| 245 if device_offline: | |
|
Peter Beverloo
2013/10/15 16:40:08
nit: throw a DeviceOffline exception to avoid code
| |
| 246 self._caller.post('device_offline', test_list_name, test_inp uts[i + 1:]) | |
| 247 self._caller.stop_running() | |
| 248 return | |
| 249 except driver.DeviceOffline as e: | |
| 250 _log.error('Device offline: %s' % repr(e)) | |
| 251 self._caller.post('device_offline', test_list_name, test_inputs[ i:]) | |
| 244 self._caller.stop_running() | 252 self._caller.stop_running() |
| 245 return | 253 return |
| 246 | 254 |
| 247 self._caller.post('finished_test_list', test_list_name) | 255 self._caller.post('finished_test_list', test_list_name) |
| 248 | 256 |
| 249 def _update_test_input(self, test_input): | 257 def _update_test_input(self, test_input): |
| 250 if test_input.reference_files is None: | 258 if test_input.reference_files is None: |
| 251 # Lazy initialization. | 259 # Lazy initialization. |
| 252 test_input.reference_files = self._port.reference_files(test_input.t est_name) | 260 test_input.reference_files = self._port.reference_files(test_input.t est_name) |
| 253 if test_input.reference_files: | 261 if test_input.reference_files: |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 def split_at(seq, index): | 490 def split_at(seq, index): |
| 483 return (seq[:index], seq[index:]) | 491 return (seq[:index], seq[index:]) |
| 484 | 492 |
| 485 num_old_per_new = divide_and_round_up(len(old_shards), max_new_shards) | 493 num_old_per_new = divide_and_round_up(len(old_shards), max_new_shards) |
| 486 new_shards = [] | 494 new_shards = [] |
| 487 remaining_shards = old_shards | 495 remaining_shards = old_shards |
| 488 while remaining_shards: | 496 while remaining_shards: |
| 489 some_shards, remaining_shards = split_at(remaining_shards, num_old_p er_new) | 497 some_shards, remaining_shards = split_at(remaining_shards, num_old_p er_new) |
| 490 new_shards.append(TestShard('%s_%d' % (shard_name_prefix, len(new_sh ards) + 1), extract_and_flatten(some_shards))) | 498 new_shards.append(TestShard('%s_%d' % (shard_name_prefix, len(new_sh ards) + 1), extract_and_flatten(some_shards))) |
| 491 return new_shards | 499 return new_shards |
| OLD | NEW |