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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 # TODO(rnephew): Delete this when recipes change to pass file path. | 21 # TODO(rnephew): Delete this when recipes change to pass file path. |
22 if not devices_path: | 22 if not devices_path: |
23 logging.warning('Known devices file path not being passed. For device ' | 23 logging.warning('Known devices file path not being passed. For device ' |
24 'affinity to work properly, it must be passed.') | 24 'affinity to work properly, it must be passed.') |
25 devices_path = os.path.join(os.environ.get('CHROMIUM_OUT_DIR', 'out'), | 25 devices_path = os.path.join(os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
26 device_list.LAST_DEVICES_FILENAME) | 26 device_list.LAST_DEVICES_FILENAME) |
27 try: | 27 try: |
28 if devices_path: | 28 if devices_path: |
29 devices = [device_utils.DeviceUtils(s) | 29 devices = [device_utils.DeviceUtils(s) |
30 for s in device_list.GetPersistentDeviceList(devices_path)] | 30 for s in device_list.GetPersistentDeviceList(devices_path)] |
| 31 if not devices and active_devices: |
| 32 logging.warning('%s is empty. Falling back to active devices.', |
| 33 devices_path) |
| 34 devices = active_devices |
31 else: | 35 else: |
32 logging.warning('Known devices file path not being passed. For device ' | 36 logging.warning('Known devices file path not being passed. For device ' |
33 'affinity to work properly, it must be passed.') | 37 'affinity to work properly, it must be passed.') |
34 devices = active_devices | 38 devices = active_devices |
35 except IOError as e: | 39 except IOError as e: |
36 logging.error('Unable to find %s [%s]', devices_path, e) | 40 logging.error('Unable to find %s [%s]', devices_path, e) |
37 devices = active_devices | 41 devices = active_devices |
38 return sorted(devices) | 42 return sorted(devices) |
39 | 43 |
40 | 44 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if test_options.flaky_steps: | 100 if test_options.flaky_steps: |
97 with file(test_options.flaky_steps, 'r') as f: | 101 with file(test_options.flaky_steps, 'r') as f: |
98 flaky_steps = json.load(f) | 102 flaky_steps = json.load(f) |
99 | 103 |
100 def TestRunnerFactory(device, shard_index): | 104 def TestRunnerFactory(device, shard_index): |
101 return test_runner.TestRunner( | 105 return test_runner.TestRunner( |
102 test_options, device, shard_index, len(all_devices), | 106 test_options, device, shard_index, len(all_devices), |
103 steps_dict, flaky_steps) | 107 steps_dict, flaky_steps) |
104 | 108 |
105 return (TestRunnerFactory, sorted_step_names, all_devices) | 109 return (TestRunnerFactory, sorted_step_names, all_devices) |
OLD | NEW |