OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Generates test runner factory and tests for performance tests.""" | 5 """Generates test runner factory and tests for performance tests.""" |
6 | 6 |
7 import json | 7 import json |
8 import fnmatch | 8 import fnmatch |
9 import logging | 9 import logging |
10 import os | 10 import os |
11 import shutil | 11 import shutil |
12 | 12 |
| 13 from pylib import android_commands |
13 from pylib import constants | 14 from pylib import constants |
14 from pylib import forwarder | 15 from pylib import forwarder |
15 from pylib.device import device_list | 16 from pylib.device import device_list |
16 from pylib.device import device_utils | |
17 from pylib.perf import test_runner | 17 from pylib.perf import test_runner |
18 from pylib.utils import test_environment | 18 from pylib.utils import test_environment |
19 | 19 |
20 | 20 |
21 def _GetAllDevices(): | 21 def _GetAllDevices(): |
22 devices_path = os.path.join(os.environ.get('CHROMIUM_OUT_DIR', 'out'), | 22 devices_path = os.path.join(os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
23 device_list.LAST_DEVICES_FILENAME) | 23 device_list.LAST_DEVICES_FILENAME) |
24 try: | 24 try: |
25 devices = [device_utils.DeviceUtils(s) | 25 devices = device_list.GetPersistentDeviceList(devices_path) |
26 for s in device_list.GetPersistentDeviceList(devices_path)] | |
27 except IOError as e: | 26 except IOError as e: |
28 logging.error('Unable to find %s [%s]', devices_path, e) | 27 logging.error('Unable to find %s [%s]', devices_path, e) |
29 devices = device_utils.DeviceUtils.HealthyDevices() | 28 devices = android_commands.GetAttachedDevices() |
30 return sorted(devices) | 29 return sorted(devices) |
31 | 30 |
32 | 31 |
33 def _GetStepsDictFromSingleStep(test_options): | 32 def _GetStepsDictFromSingleStep(test_options): |
34 # Running a single command, build the tests structure. | 33 # Running a single command, build the tests structure. |
35 steps_dict = { | 34 steps_dict = { |
36 'version': 1, | 35 'version': 1, |
37 'steps': { | 36 'steps': { |
38 'single_step': { | 37 'single_step': { |
39 'device_affinity': 0, | 38 'device_affinity': 0, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if test_options.flaky_steps: | 87 if test_options.flaky_steps: |
89 with file(test_options.flaky_steps, 'r') as f: | 88 with file(test_options.flaky_steps, 'r') as f: |
90 flaky_steps = json.load(f) | 89 flaky_steps = json.load(f) |
91 | 90 |
92 def TestRunnerFactory(device, shard_index): | 91 def TestRunnerFactory(device, shard_index): |
93 return test_runner.TestRunner( | 92 return test_runner.TestRunner( |
94 test_options, device, shard_index, len(all_devices), | 93 test_options, device, shard_index, len(all_devices), |
95 steps_dict, flaky_steps) | 94 steps_dict, flaky_steps) |
96 | 95 |
97 return (TestRunnerFactory, sorted_step_names, all_devices) | 96 return (TestRunnerFactory, sorted_step_names, all_devices) |
OLD | NEW |