Title: [205017] trunk/Tools
Revision
205017
Author
[email protected]
Date
2016-08-26 09:36:29 -0700 (Fri, 26 Aug 2016)

Log Message

[GTK] run-gtk-tests should use the driver environment for checking the accessibility bus
https://bugs.webkit.org/show_bug.cgi?id=161149

Reviewed by Carlos Garcia Campos.

Add a new function for waiting for the accesibility bus. It sets
the test environment variables before starting the GLib mainloop.
And restores the previous environment after it has finished.
It also adds a timeout (5 seconds) to abort in case it has not
been able to detect the accesibility bus before the timeout expires.

* Scripts/run-gtk-tests:
(TestRunner):
(TestRunner._wait_for_accessibility_bus):
(TestRunner._wait_for_accessibility_bus.timeout_accessibility_bus):
(TestRunner._start_accessibility_daemons):
(TestRunner._get_tests_from_google_test_suite): Run this command also with the driver test environment.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (205016 => 205017)


--- trunk/Tools/ChangeLog	2016-08-26 16:35:26 UTC (rev 205016)
+++ trunk/Tools/ChangeLog	2016-08-26 16:36:29 UTC (rev 205017)
@@ -1,3 +1,23 @@
+2016-08-26  Carlos Alberto Lopez Perez  <[email protected]>
+
+        [GTK] run-gtk-tests should use the driver environment for checking the accessibility bus
+        https://bugs.webkit.org/show_bug.cgi?id=161149
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add a new function for waiting for the accesibility bus. It sets
+        the test environment variables before starting the GLib mainloop.
+        And restores the previous environment after it has finished.
+        It also adds a timeout (5 seconds) to abort in case it has not
+        been able to detect the accesibility bus before the timeout expires.
+
+        * Scripts/run-gtk-tests:
+        (TestRunner):
+        (TestRunner._wait_for_accessibility_bus):
+        (TestRunner._wait_for_accessibility_bus.timeout_accessibility_bus):
+        (TestRunner._start_accessibility_daemons):
+        (TestRunner._get_tests_from_google_test_suite): Run this command also with the driver test environment.
+
 2016-08-26  Per Arne Vollan  <[email protected]>
 
         [Win] Warning fix.

Modified: trunk/Tools/Scripts/run-gtk-tests (205016 => 205017)


--- trunk/Tools/Scripts/run-gtk-tests	2016-08-26 16:35:26 UTC (rev 205016)
+++ trunk/Tools/Scripts/run-gtk-tests	2016-08-26 16:36:29 UTC (rev 205017)
@@ -153,6 +153,28 @@
 
         return None
 
+    def _wait_for_accessibility_bus(self):
+        def timeout_accessibility_bus():
+            self._accessibility_bus_found = False
+            sys.stderr.write("Timeout waiting for the accesibility bus.\n")
+            sys.stderr.flush()
+            loop.quit()
+        # Backup current environment, and temporally set the test one.
+        oldenv = dict(os.environ)
+        os.environ.clear()
+        os.environ.update(self._test_env)
+        # We spin a main loop until the bus name appears on DBus.
+        self._accessibility_bus_found = True
+        loop = GLib.MainLoop()
+        Gio.bus_watch_name(Gio.BusType.SESSION, 'org.a11y.Bus', Gio.BusNameWatcherFlags.NONE,
+                           lambda *args: loop.quit(), None)
+        GLib.timeout_add_seconds(5, timeout_accessibility_bus)
+        loop.run()
+        # Restore previous environment.
+        os.environ.clear()
+        os.environ.update(oldenv)
+        return self._accessibility_bus_found
+
     def _start_accessibility_daemons(self):
         spi_bus_launcher_path = self._lookup_atspi2_binary('at-spi-bus-launcher')
         spi_registryd_path = self._lookup_atspi2_binary('at-spi2-registryd')
@@ -166,12 +188,11 @@
             sys.stderr.flush()
             return False
 
-        # We need to wait until the SPI bus is launched before trying to start the SPI
-        # registry, so we spin a main loop until the bus name appears on DBus.
-        loop = GLib.MainLoop()
-        Gio.bus_watch_name(Gio.BusType.SESSION, 'org.a11y.Bus', Gio.BusNameWatcherFlags.NONE,
-                           lambda *args: loop.quit(), None)
-        loop.run()
+        # We need to wait until the SPI bus is launched before trying to start the SPI registry.
+        if not self._wait_for_accessibility_bus():
+            sys.stderr.write("Failed checking the accessibility bus within D-Bus\n")
+            sys.stderr.flush()
+            return False
 
         try:
             self._spi_registryd = subprocess.Popen([spi_registryd_path], env=self._test_env)
@@ -330,7 +351,7 @@
 
     def _get_tests_from_google_test_suite(self, test_program):
         try:
-            output = subprocess.check_output([test_program, '--gtest_list_tests'])
+            output = subprocess.check_output([test_program, '--gtest_list_tests'], env=self._test_env)
         except subprocess.CalledProcessError:
             sys.stderr.write("ERROR: could not list available tests for binary %s.\n" % (test_program))
             sys.stderr.flush()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to