Changeset 110059 in webkit
- Timestamp:
- Mar 7, 2012 8:58:25 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r110058 r110059 1 2012-03-07 Philippe Normand <pnormand@igalia.com> 2 3 [GTK] race condition in run-gtk-tests 4 https://bugs.webkit.org/show_bug.cgi?id=80495 5 6 Reviewed by Martin Robinson. 7 8 Refactored the script to wait the a11y dbus service becomes 9 available before starting the tests. 10 11 * Scripts/run-gtk-tests: 12 (TestRunner._lookup_atspi2_binary): 13 (TestRunner): 14 (TestRunner._wait_dbus_service_and_run): 15 (TestRunner._wait_dbus_service_and_run.on_name_appeared): 16 (TestRunner._wait_dbus_service_and_run.on_name_vanished): 17 (TestRunner.run): 18 (TestRunner.run.bailout): 19 (TestRunner.run.run_for_real): 20 1 21 2012-03-07 Dinu Jacob <dinu.jacob@nokia.com> 2 22 -
trunk/Tools/Scripts/run-gtk-tests
r109722 r110059 20 20 from webkitpy.common.system.executive import Executive 21 21 import subprocess 22 import os, sys 22 import os 23 import sys 24 import time 25 from gi.repository import Gio, GLib 26 27 TIMEOUT=180 # seconds 23 28 24 29 class TestRunner: … … 49 54 build_directory = os.path.join(top_level, 'WebKitBuild', 'Debug') 50 55 56 self._a11y_registryd = None 57 self._timed_out = False 51 58 self._gtk_tools_directory = os.path.join(top_level, "Tools", "gtk") 52 59 self._programs_path = os.path.join(build_directory, "Programs") … … 73 80 paths_to_check = [ 'libexec', 74 81 'lib/at-spi2-core', 75 'lib32/at-spi2-core' 82 'lib32/at-spi2-core', 76 83 'lib64/at-spi2-core' ] 77 84 for path in paths_to_check: … … 81 88 82 89 return None 90 91 def _run_command_when_dbus_service_appears(self, service_name, handler): 92 def on_name_appeared(*args): 93 handler() 94 95 def on_name_vanished(*args): 96 pass 97 98 Gio.bus_watch_name(Gio.BusType.SESSION, service_name, 99 Gio.BusNameWatcherFlags.NONE, on_name_appeared, on_name_vanished) 100 101 102 def _check_if_tests_have_timed_out(self): 103 if time.time() - self._start_time <= TIMEOUT: 104 return False 105 sys.stdout.write("Tests timed out after %d seconds\n" % TIMEOUT) 106 sys.stdout.flush() 107 self._timed_out = True 108 return True 109 110 def _ensure_accessibility_daemon_is_running(self, jhbuild_path): 111 a11y_registryd_path = self._lookup_atspi2_binary(jhbuild_path, 'at-spi2-registryd') 112 if a11y_registryd_path: 113 try: 114 self._a11y_registryd = Executive().popen([a11y_registryd_path], env=test_env) 115 except: 116 sys.stderr.write("Failed to run the accessibility registry\n") 117 sys.stderr.flush() 118 self._a11y_registryd = None 83 119 84 120 def run(self): … … 93 129 test_env['GSETTINGS_BACKEND'] = 'memory' 94 130 95 exit_status = [0]131 failed_tests = [] 96 132 def _error_handler(error): 97 exit_status[0] = error.exit_code133 failed_tests.append(error.script_args[2]) 98 134 99 135 jhbuild_path = os.path.join(self._gtk_tools_directory, "run-with-jhbuild") 100 136 101 137 # Make sure the accessibility bus is launched. 102 a11y_bus_launched = False103 138 a11y_bus_launcher_path = self._lookup_atspi2_binary(jhbuild_path, 'at-spi-bus-launcher') 104 if a11y_bus_launcher_path:105 106 107 a11y_bus_launched = True108 except:109 sys.stderr.write("Failed to launch the accessibility bus\n")110 sys.stderr.flush()139 assert(a11y_bus_launcher_path) 140 try: 141 a11y_bus_launcher = Executive().popen([a11y_bus_launcher_path], env=test_env) 142 except: 143 sys.stderr.write("Failed to launch the accessibility bus\n") 144 sys.stderr.flush() 145 return 1 111 146 112 # Make sure the accessibility registry daemon is running. 113 a11y_registryd_running = False 114 a11y_registryd_path = self._lookup_atspi2_binary(jhbuild_path, 'at-spi2-registryd') 115 if a11y_registryd_path: 116 try: 117 a11y_registryd = Executive().popen([a11y_registryd_path], env=test_env) 118 a11y_registryd_running = True 119 except: 120 sys.stderr.write("Failed to run the accessibility registry\n") 121 sys.stderr.flush() 147 loop = GLib.MainLoop() 148 self._start_time = time.time() 122 149 123 for test in self._tests: 124 out = self._executive.run_command([jhbuild_path ,'gtester', test], env=test_env, 125 error_handler=_error_handler) 126 sys.stdout.write(out) 127 sys.stdout.flush() 150 def run_tests(): 151 self._ensure_accessibility_daemon_is_running(jhbuild_path) 128 152 129 if a11y_registryd_running: 130 a11y_registryd.kill() 131 if a11y_bus_launched: 132 a11y_bus_launcher.kill() 153 for test in self._tests: 154 out = self._executive.run_command([jhbuild_path ,'gtester', test], env=test_env, 155 error_handler=_error_handler) 156 sys.stdout.write(out) 157 sys.stdout.flush() 133 158 134 if exit_status[0]: 135 sys.stdout.write("Tests failed\n") 136 sys.stdout.flush() 159 if self._check_if_tests_have_timed_out(): 160 break 137 161 138 return exit_status[0] 162 if self._a11y_registryd: 163 self._a11y_registryd.terminate() 164 165 a11y_bus_launcher.terminate() 166 167 if failed_tests: 168 names = [os.path.basename(t) for t in failed_tests] 169 sys.stdout.write("Tests failed: %s\n" % ", ".join(names)) 170 sys.stdout.flush() 171 172 loop.quit() 173 174 self._run_command_when_dbus_service_appears("org.a11y.Bus", run_tests) 175 loop.run() 176 177 return len(failed_tests) or int(self._timed_out) 139 178 140 179 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.