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 24 matching lines...) Expand all Loading... |
35 # Restart the adb server with taskset to set a single CPU affinity. | 35 # Restart the adb server with taskset to set a single CPU affinity. |
36 cmd_helper.RunCmd([constants.ADB_PATH, 'kill-server']) | 36 cmd_helper.RunCmd([constants.ADB_PATH, 'kill-server']) |
37 cmd_helper.RunCmd(['taskset', '-c', '0', constants.ADB_PATH, 'start-server']) | 37 cmd_helper.RunCmd(['taskset', '-c', '0', constants.ADB_PATH, 'start-server']) |
38 cmd_helper.RunCmd(['taskset', '-c', '0', constants.ADB_PATH, 'root']) | 38 cmd_helper.RunCmd(['taskset', '-c', '0', constants.ADB_PATH, 'root']) |
39 i = 1 | 39 i = 1 |
40 while not android_commands.GetAttachedDevices(): | 40 while not android_commands.GetAttachedDevices(): |
41 time.sleep(i) | 41 time.sleep(i) |
42 i *= 2 | 42 i *= 2 |
43 if i > 10: | 43 if i > 10: |
44 break | 44 break |
45 # Reset the test port allocation. It's important to do it before starting | |
46 # to dispatch any step. | |
47 if not ports.ResetTestServerPortAllocation(): | |
48 raise Exception('Failed to reset test server port.') | |
49 | 45 |
50 forwarder.Forwarder.UseMultiprocessing() | 46 forwarder.Forwarder.UseMultiprocessing() |
51 | 47 |
52 | 48 |
53 def Setup(test_options): | 49 def Setup(test_options): |
54 """Create and return the test runner factory and tests. | 50 """Create and return the test runner factory and tests. |
55 | 51 |
56 Args: | 52 Args: |
57 test_options: A PerformanceOptions object. | 53 test_options: A PerformanceOptions object. |
58 | 54 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 flaky_steps = [] | 87 flaky_steps = [] |
92 if test_options.flaky_steps: | 88 if test_options.flaky_steps: |
93 with file(test_options.flaky_steps, 'r') as f: | 89 with file(test_options.flaky_steps, 'r') as f: |
94 flaky_steps = json.load(f) | 90 flaky_steps = json.load(f) |
95 | 91 |
96 def TestRunnerFactory(device, shard_index): | 92 def TestRunnerFactory(device, shard_index): |
97 return test_runner.TestRunner( | 93 return test_runner.TestRunner( |
98 test_options, device, tests_dict, flaky_steps) | 94 test_options, device, tests_dict, flaky_steps) |
99 | 95 |
100 return (TestRunnerFactory, sorted_test_names) | 96 return (TestRunnerFactory, sorted_test_names) |
OLD | NEW |