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 | |
10 import os | 9 import os |
11 import psutil | |
12 import signal | |
13 import shutil | 10 import shutil |
14 import time | |
15 | 11 |
16 from pylib import constants | 12 from pylib import constants |
17 from pylib import forwarder | 13 from pylib import forwarder |
| 14 from pylib.perf import test_runner |
18 from pylib.utils import test_environment | 15 from pylib.utils import test_environment |
19 | 16 |
20 import test_runner | |
21 | |
22 | 17 |
23 def Setup(test_options): | 18 def Setup(test_options): |
24 """Create and return the test runner factory and tests. | 19 """Create and return the test runner factory and tests. |
25 | 20 |
26 Args: | 21 Args: |
27 test_options: A PerformanceOptions object. | 22 test_options: A PerformanceOptions object. |
28 | 23 |
29 Returns: | 24 Returns: |
30 A tuple of (TestRunnerFactory, tests). | 25 A tuple of (TestRunnerFactory, tests). |
31 """ | 26 """ |
(...skipping 25 matching lines...) Expand all Loading... |
57 sorted_test_names = fnmatch.filter(sorted_test_names, | 52 sorted_test_names = fnmatch.filter(sorted_test_names, |
58 test_options.test_filter) | 53 test_options.test_filter) |
59 tests_dict = dict((k, v) for k, v in tests_dict.iteritems() | 54 tests_dict = dict((k, v) for k, v in tests_dict.iteritems() |
60 if k in sorted_test_names) | 55 if k in sorted_test_names) |
61 | 56 |
62 flaky_steps = [] | 57 flaky_steps = [] |
63 if test_options.flaky_steps: | 58 if test_options.flaky_steps: |
64 with file(test_options.flaky_steps, 'r') as f: | 59 with file(test_options.flaky_steps, 'r') as f: |
65 flaky_steps = json.load(f) | 60 flaky_steps = json.load(f) |
66 | 61 |
67 def TestRunnerFactory(device, shard_index): | 62 def TestRunnerFactory(device, _shard_index): |
68 return test_runner.TestRunner( | 63 return test_runner.TestRunner( |
69 test_options, device, tests_dict, flaky_steps) | 64 test_options, device, tests_dict, flaky_steps) |
70 | 65 |
71 return (TestRunnerFactory, sorted_test_names) | 66 return (TestRunnerFactory, sorted_test_names) |
OLD | NEW |