OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This script runs unit tests of the code in the perf directory. | 6 """This script runs unit tests of the code in the perf directory. |
7 | 7 |
8 This script DOES NOT run benchmarks. run_benchmark does that. | 8 This script DOES NOT run benchmarks. run_benchmark does that. |
9 """ | 9 """ |
10 | 10 |
11 import os | 11 import os |
| 12 import subprocess |
12 import sys | 13 import sys |
13 | 14 |
14 sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'telemetry')) | |
15 | |
16 from telemetry.unittest import gtest_progress_reporter | |
17 from telemetry.unittest import run_tests | |
18 | |
19 | 15 |
20 if __name__ == '__main__': | 16 if __name__ == '__main__': |
21 base_dir = os.path.dirname(os.path.realpath(__file__)) | 17 perf_dir = os.path.dirname(os.path.realpath(__file__)) |
22 progress_reporters = [ | 18 telemetry_dir = os.path.realpath(os.path.join(perf_dir, '..', 'telemetry')) |
23 gtest_progress_reporter.GTestProgressReporter(sys.stdout)] | 19 |
24 run_tests.config = run_tests.Config(base_dir, [base_dir], progress_reporters) | 20 env = os.environ.copy() |
25 sys.exit(run_tests.RunTestsCommand.main()) | 21 if 'PYTHONPATH' in env: |
| 22 env['PYTHONPATH'] = env['PYTHONPATH'] + os.pathsep + telemetry_dir |
| 23 else: |
| 24 env['PYTHONPATH'] = telemetry_dir |
| 25 |
| 26 path_to_run_tests = os.path.join(telemetry_dir, 'telemetry', 'unittest', |
| 27 'run_tests.py') |
| 28 argv = ['--top-level-dir', perf_dir] + sys.argv[1:] |
| 29 sys.exit(subprocess.call([sys.executable, path_to_run_tests] + argv, |
| 30 env=env)) |
OLD | NEW |