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