Index: scripts/slave/runtest.py |
diff --git a/scripts/slave/runtest.py b/scripts/slave/runtest.py |
index e5e4bf6f17a0e337a6ee387a515d0c13955719c1..3ff0f6a95ea0b6d870f1fe3c99dcf333b19edd1c 100755 |
--- a/scripts/slave/runtest.py |
+++ b/scripts/slave/runtest.py |
@@ -85,6 +85,29 @@ def get_temp_count(): |
return len(os.listdir(tempfile.gettempdir())) |
+def _DoDBusWorkaround(): |
ghost stip (do not use)
2013/10/25 18:41:27
can we just call this LaunchDBus()?
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
Sure, done.
|
+ """Works around a bug in GLib where it performs operations which |
ghost stip (do not use)
2013/10/25 18:41:27
"""Launches DBus to work around bug in GLib.
Rest
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
Done.
|
+ aren't async-signal-safe (in particular, memory allocations) between |
+ fork and exec when it spawns subprocesses. This causes threads |
+ inside Chrome's browser and utility processes to get stuck, and this |
+ harness to hang waiting for those processes, which will never |
+ terminate. This doesn't happen on users' machines, because they have |
+ an active desktop session and the DBUS_SESSION_BUS_ADDRESS |
+ environment variable set, but it does happen on the bots. See Issue |
+ 309093 for more details.""" |
+ import platform |
+ import subprocess |
+ if (platform.uname()[0].lower() == 'linux' and |
ghost stip (do not use)
2013/10/25 18:41:27
another option is to only call this in main_linux,
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
I like having this here because it should be done
|
+ 'DBUS_SESSION_BUS_ADDRESS' not in os.environ): |
+ try: |
+ dbus_output = subprocess.check_output(['dbus-launch']).split('\n') |
ghost stip (do not use)
2013/10/25 18:41:27
put a message here: 'DBUS_SESSION_BUS_ADDRESS not
ghost stip (do not use)
2013/10/25 18:41:27
I'm assuming dbus-launch daemonizes here, otherwis
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
dbus-launch is synchronous. It runs and exits with
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
Done.
|
+ for line in dbus_output: |
+ m = re.match(r"([^=]+)\=(.+)", line) |
+ if m: |
+ os.environ[m.group(1)] = m.group(2) |
ghost stip (do not use)
2013/10/25 18:41:27
output to stdout 'setting %s to %s' % (m.group(1),
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
Thanks, I had this before but took it out. Done.
|
+ except: # pylint: disable=W0702 |
+ pass |
ghost stip (do not use)
2013/10/25 18:41:27
what exception are you expecting here? if it's tha
Ken Russell (switch to Gerrit)
2013/10/25 19:07:12
subprocess.check_output raises CalledProcessError
Ken Russell (switch to Gerrit)
2013/10/25 19:12:16
Sorry, I lied, and made this catch subprocess.Call
|
+ |
def _RunGTestCommand(command, results_tracker=None, pipes=None, |
extra_env=None): |
@@ -1217,6 +1240,10 @@ def main(): |
'properties "lsan" and "lsan_run_all_tests".') |
option_parser.add_option('', '--extra-sharding-args', default='', |
help='Extra options for run_test_cases.py.') |
+ option_parser.add_option('--do-dbus-workaround', action='store_true', |
ghost stip (do not use)
2013/10/25 18:41:27
--spawn-dbus
|
+ default=False, |
+ help='Work around GLib DBus bug by ' |
+ 'manually spawning dbus-launch') |
chromium_utils.AddPropertiesOptions(option_parser) |
options, args = option_parser.parse_args() |
@@ -1234,6 +1261,9 @@ def main(): |
# Print out builder name for log_parser |
print '[Running on builder: "%s"]' % options.builder_name |
+ if options.do_dbus_workaround: |
+ _DoDBusWorkaround() |
+ |
# TODO(thakis): Simplify this once ConvertBuildDirToLegacy() ignores its |
# arguments. |
use_out = False |