OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import os | 6 import os |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
11 sys.path.append(os.path.join(os.path.dirname(__file__), | 11 sys.path.append(os.path.join(os.path.dirname(__file__), |
12 os.pardir, os.pardir, os.pardir, 'tools', 'telemetry')) | 12 os.pardir, os.pardir, os.pardir, 'tools', 'telemetry')) |
13 | 13 |
14 from telemetry import benchmark_runner | 14 from telemetry import benchmark_runner |
| 15 from telemetry.core import environment |
15 | 16 |
16 | 17 |
17 def _LaunchDBus(): | 18 def _LaunchDBus(): |
18 """Launches DBus to work around a bug in GLib. | 19 """Launches DBus to work around a bug in GLib. |
19 | 20 |
20 Works around a bug in GLib where it performs operations which aren't | 21 Works around a bug in GLib where it performs operations which aren't |
21 async-signal-safe (in particular, memory allocations) between fork and exec | 22 async-signal-safe (in particular, memory allocations) between fork and exec |
22 when it spawns subprocesses. This causes threads inside Chrome's browser and | 23 when it spawns subprocesses. This causes threads inside Chrome's browser and |
23 utility processes to get stuck, and this harness to hang waiting for those | 24 utility processes to get stuck, and this harness to hang waiting for those |
24 processes, which will never terminate. This doesn't happen on users' | 25 processes, which will never terminate. This doesn't happen on users' |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e) | 78 print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e) |
78 # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment | 79 # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment |
79 # variable too. Some of the bots seem to re-invoke runtest.py in a | 80 # variable too. Some of the bots seem to re-invoke runtest.py in a |
80 # way that this variable sticks around from run to run. | 81 # way that this variable sticks around from run to run. |
81 if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: | 82 if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: |
82 del os.environ['DBUS_SESSION_BUS_ADDRESS'] | 83 del os.environ['DBUS_SESSION_BUS_ADDRESS'] |
83 print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable' | 84 print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable' |
84 | 85 |
85 | 86 |
86 if __name__ == '__main__': | 87 if __name__ == '__main__': |
87 top_level_dir = os.path.dirname(os.path.realpath(__file__)) | 88 base_dir = os.path.dirname(os.path.realpath(__file__)) |
88 environment = benchmark_runner.Environment( | 89 benchmark_runner.config = environment.Environment([base_dir]) |
89 top_level_dir=top_level_dir, | |
90 benchmark_dirs=[os.path.join(top_level_dir, 'gpu_tests')]) | |
91 | 90 |
92 did_launch_dbus = _LaunchDBus() | 91 did_launch_dbus = _LaunchDBus() |
93 try: | 92 try: |
94 retcode = benchmark_runner.main(environment) | 93 retcode = benchmark_runner.main() |
95 finally: | 94 finally: |
96 if did_launch_dbus: | 95 if did_launch_dbus: |
97 _ShutdownDBus() | 96 _ShutdownDBus() |
98 | 97 |
99 sys.exit(retcode) | 98 sys.exit(retcode) |
OLD | NEW |