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