| 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 io | 5 import io |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import pickle | 9 import pickle |
| 10 import shutil | 10 import shutil |
| 11 import tempfile | 11 import tempfile |
| 12 import time | 12 import time |
| 13 import zipfile | 13 import zipfile |
| 14 | 14 |
| 15 from devil.android import battery_utils | 15 from devil.android import battery_utils |
| 16 from devil.android import device_blacklist | |
| 17 from devil.android import device_errors | 16 from devil.android import device_errors |
| 18 from devil.android import device_list | 17 from devil.android import device_list |
| 19 from devil.android import device_utils | 18 from devil.android import device_utils |
| 20 from devil.android import forwarder | 19 from devil.android import forwarder |
| 21 from devil.android.tools import device_recovery | 20 from devil.android.tools import device_recovery |
| 22 from devil.android.tools import device_status | 21 from devil.android.tools import device_status |
| 23 from devil.utils import cmd_helper | 22 from devil.utils import cmd_helper |
| 24 from devil.utils import parallelizer | 23 from devil.utils import parallelizer |
| 25 from pylib import constants | 24 from pylib import constants |
| 26 from pylib.base import base_test_result | 25 from pylib.base import base_test_result |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 devices = active_devices | 288 devices = active_devices |
| 290 return sorted(devices) | 289 return sorted(devices) |
| 291 | 290 |
| 292 #override | 291 #override |
| 293 def RunTests(self): | 292 def RunTests(self): |
| 294 # Affinitize the tests. | 293 # Affinitize the tests. |
| 295 self._SplitTestsByAffinity() | 294 self._SplitTestsByAffinity() |
| 296 if not self._test_buckets: | 295 if not self._test_buckets: |
| 297 raise local_device_test_run.NoTestsError() | 296 raise local_device_test_run.NoTestsError() |
| 298 | 297 |
| 299 blacklist = (device_blacklist.Blacklist(self._env.blacklist) | |
| 300 if self._env.blacklist | |
| 301 else None) | |
| 302 | |
| 303 def run_perf_tests(shard_id): | 298 def run_perf_tests(shard_id): |
| 304 if device_status.IsBlacklisted(str(self._devices[shard_id]), blacklist): | 299 if device_status.IsBlacklisted( |
| 300 str(self._devices[shard_id]), self._env.blacklist): |
| 305 logging.warning('Device %s is not active. Will not create shard %s.', | 301 logging.warning('Device %s is not active. Will not create shard %s.', |
| 306 str(self._devices[shard_id]), shard_id) | 302 str(self._devices[shard_id]), shard_id) |
| 307 return [] | 303 return [] |
| 308 s = TestShard(self._env, self._test_instance, self._devices[shard_id], | 304 s = TestShard(self._env, self._test_instance, self._devices[shard_id], |
| 309 shard_id, self._test_buckets[shard_id], | 305 shard_id, self._test_buckets[shard_id], |
| 310 retries=self._env.max_tries, timeout=self._timeout) | 306 retries=self._env.max_tries, timeout=self._timeout) |
| 311 return s.RunTestsOnShard() | 307 return s.RunTestsOnShard() |
| 312 | 308 |
| 313 device_indices = range(min(len(self._devices), len(self._test_buckets))) | 309 device_indices = range(min(len(self._devices), len(self._test_buckets))) |
| 314 shards = parallelizer.Parallelizer(device_indices).pMap(run_perf_tests) | 310 shards = parallelizer.Parallelizer(device_indices).pMap(run_perf_tests) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 # override | 373 # override |
| 378 def _RunTest(self, _device, _test): | 374 def _RunTest(self, _device, _test): |
| 379 raise NotImplementedError | 375 raise NotImplementedError |
| 380 | 376 |
| 381 | 377 |
| 382 class TestDictVersionError(Exception): | 378 class TestDictVersionError(Exception): |
| 383 pass | 379 pass |
| 384 | 380 |
| 385 class PerfTestRunGetStepsError(Exception): | 381 class PerfTestRunGetStepsError(Exception): |
| 386 pass | 382 pass |
| OLD | NEW |