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