| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 collections | 5 import collections |
| 6 import contextlib | 6 import contextlib |
| 7 import io | 7 import io |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 except IOError as e: | 418 except IOError as e: |
| 419 logging.error('Unable to find %s [%s]', devices_path, e) | 419 logging.error('Unable to find %s [%s]', devices_path, e) |
| 420 devices = active_devices | 420 devices = active_devices |
| 421 return sorted(devices) | 421 return sorted(devices) |
| 422 | 422 |
| 423 #override | 423 #override |
| 424 def RunTests(self): | 424 def RunTests(self): |
| 425 # Affinitize the tests. | 425 # Affinitize the tests. |
| 426 if self._test_instance.trace_output: | 426 if self._test_instance.trace_output: |
| 427 assert not trace_event.trace_is_enabled(), 'Tracing already running.' | 427 assert not trace_event.trace_is_enabled(), 'Tracing already running.' |
| 428 trace_event.trace_enable(self._test_instance.trace_output) | 428 trace_event.trace_enable(self._test_instance.trace_output + '.json') |
| 429 self._SplitTestsByAffinity() | 429 self._SplitTestsByAffinity() |
| 430 if not self._test_buckets and not self._no_device_tests: | 430 if not self._test_buckets and not self._no_device_tests: |
| 431 raise local_device_test_run.NoTestsError() | 431 raise local_device_test_run.NoTestsError() |
| 432 | 432 |
| 433 def run_no_devices_tests(): | 433 def run_no_devices_tests(): |
| 434 if not self._no_device_tests: | 434 if not self._no_device_tests: |
| 435 return [] | 435 return [] |
| 436 s = HostTestShard(self._env, self._test_instance, self._no_device_tests, | 436 s = HostTestShard(self._env, self._test_instance, self._no_device_tests, |
| 437 retries=3, timeout=self._timeout) | 437 retries=3, timeout=self._timeout) |
| 438 return [s.RunTestsOnShard()] | 438 return [s.RunTestsOnShard()] |
| (...skipping 20 matching lines...) Expand all Loading... |
| 459 device_indices = range(min(len(self._devices), len(self._test_buckets))) | 459 device_indices = range(min(len(self._devices), len(self._test_buckets))) |
| 460 shards = parallelizer.Parallelizer(device_indices).pMap( | 460 shards = parallelizer.Parallelizer(device_indices).pMap( |
| 461 device_shard_helper) | 461 device_shard_helper) |
| 462 return [x for x in shards.pGet(self._timeout) if x is not None] | 462 return [x for x in shards.pGet(self._timeout) if x is not None] |
| 463 | 463 |
| 464 host_test_results, device_test_results = reraiser_thread.RunAsync( | 464 host_test_results, device_test_results = reraiser_thread.RunAsync( |
| 465 [run_no_devices_tests, run_devices_tests]) | 465 [run_no_devices_tests, run_devices_tests]) |
| 466 if self._test_instance.trace_output: | 466 if self._test_instance.trace_output: |
| 467 assert trace_event.trace_is_enabled(), 'Tracing not running.' | 467 assert trace_event.trace_is_enabled(), 'Tracing not running.' |
| 468 trace_event.trace_disable() | 468 trace_event.trace_disable() |
| 469 local_device_test_run.LocalDeviceTestRun._JsonToTrace( |
| 470 self._test_instance.trace_output + '.json', |
| 471 self._test_instance.trace_output) |
| 469 return host_test_results + device_test_results | 472 return host_test_results + device_test_results |
| 470 | 473 |
| 471 # override | 474 # override |
| 472 def TestPackage(self): | 475 def TestPackage(self): |
| 473 return 'perf' | 476 return 'perf' |
| 474 | 477 |
| 475 # override | 478 # override |
| 476 def _CreateShards(self, _tests): | 479 def _CreateShards(self, _tests): |
| 477 raise NotImplementedError | 480 raise NotImplementedError |
| 478 | 481 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 # override | 534 # override |
| 532 def _RunTest(self, _device, _test): | 535 def _RunTest(self, _device, _test): |
| 533 raise NotImplementedError | 536 raise NotImplementedError |
| 534 | 537 |
| 535 | 538 |
| 536 class TestDictVersionError(Exception): | 539 class TestDictVersionError(Exception): |
| 537 pass | 540 pass |
| 538 | 541 |
| 539 class PerfTestRunGetStepsError(Exception): | 542 class PerfTestRunGetStepsError(Exception): |
| 540 pass | 543 pass |
| OLD | NEW |