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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 A tuple of (TestRunnerFactory, tests, devices). | 65 A tuple of (TestRunnerFactory, tests, devices). |
66 """ | 66 """ |
67 # TODO(bulach): remove this once the bot side lands. BUG=318369 | 67 # TODO(bulach): remove this once the bot side lands. BUG=318369 |
68 constants.SetBuildType('Release') | 68 constants.SetBuildType('Release') |
69 if os.path.exists(constants.PERF_OUTPUT_DIR): | 69 if os.path.exists(constants.PERF_OUTPUT_DIR): |
70 shutil.rmtree(constants.PERF_OUTPUT_DIR) | 70 shutil.rmtree(constants.PERF_OUTPUT_DIR) |
71 os.makedirs(constants.PERF_OUTPUT_DIR) | 71 os.makedirs(constants.PERF_OUTPUT_DIR) |
72 | 72 |
73 # Before running the tests, kill any leftover server. | 73 # Before running the tests, kill any leftover server. |
74 test_environment.CleanupLeftoverProcesses() | 74 test_environment.CleanupLeftoverProcesses() |
75 forwarder.Forwarder.UseMultiprocessing() | |
76 | 75 |
77 # We want to keep device affinity, so return all devices ever seen. | 76 # We want to keep device affinity, so return all devices ever seen. |
78 all_devices = _GetAllDevices() | 77 all_devices = _GetAllDevices() |
79 | 78 |
80 steps_dict = _GetStepsDict(test_options) | 79 steps_dict = _GetStepsDict(test_options) |
81 sorted_step_names = sorted(steps_dict['steps'].keys()) | 80 sorted_step_names = sorted(steps_dict['steps'].keys()) |
82 | 81 |
83 if test_options.test_filter: | 82 if test_options.test_filter: |
84 sorted_step_names = fnmatch.filter(sorted_step_names, | 83 sorted_step_names = fnmatch.filter(sorted_step_names, |
85 test_options.test_filter) | 84 test_options.test_filter) |
86 | 85 |
87 flaky_steps = [] | 86 flaky_steps = [] |
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 |