Changeset 205017 in webkit


Ignore:
Timestamp:
Aug 26, 2016, 9:36:29 AM (9 years ago)
Author:
clopez@igalia.com
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.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r205016 r205017  
     12016-08-26  Carlos Alberto Lopez Perez  <clopez@igalia.com>
     2
     3        [GTK] run-gtk-tests should use the driver environment for checking the accessibility bus
     4        https://bugs.webkit.org/show_bug.cgi?id=161149
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Add a new function for waiting for the accesibility bus. It sets
     9        the test environment variables before starting the GLib mainloop.
     10        And restores the previous environment after it has finished.
     11        It also adds a timeout (5 seconds) to abort in case it has not
     12        been able to detect the accesibility bus before the timeout expires.
     13
     14        * Scripts/run-gtk-tests:
     15        (TestRunner):
     16        (TestRunner._wait_for_accessibility_bus):
     17        (TestRunner._wait_for_accessibility_bus.timeout_accessibility_bus):
     18        (TestRunner._start_accessibility_daemons):
     19        (TestRunner._get_tests_from_google_test_suite): Run this command also with the driver test environment.
     20
    1212016-08-26  Per Arne Vollan  <pvollan@apple.com>
    222
  • trunk/Tools/Scripts/run-gtk-tests

    r205014 r205017  
    154154        return None
    155155
     156    def _wait_for_accessibility_bus(self):
     157        def timeout_accessibility_bus():
     158            self._accessibility_bus_found = False
     159            sys.stderr.write("Timeout waiting for the accesibility bus.\n")
     160            sys.stderr.flush()
     161            loop.quit()
     162        # Backup current environment, and temporally set the test one.
     163        oldenv = dict(os.environ)
     164        os.environ.clear()
     165        os.environ.update(self._test_env)
     166        # We spin a main loop until the bus name appears on DBus.
     167        self._accessibility_bus_found = True
     168        loop = GLib.MainLoop()
     169        Gio.bus_watch_name(Gio.BusType.SESSION, 'org.a11y.Bus', Gio.BusNameWatcherFlags.NONE,
     170                           lambda *args: loop.quit(), None)
     171        GLib.timeout_add_seconds(5, timeout_accessibility_bus)
     172        loop.run()
     173        # Restore previous environment.
     174        os.environ.clear()
     175        os.environ.update(oldenv)
     176        return self._accessibility_bus_found
     177
    156178    def _start_accessibility_daemons(self):
    157179        spi_bus_launcher_path = self._lookup_atspi2_binary('at-spi-bus-launcher')
     
    167189            return False
    168190
    169         # We need to wait until the SPI bus is launched before trying to start the SPI
    170         # registry, so we spin a main loop until the bus name appears on DBus.
    171         loop = GLib.MainLoop()
    172         Gio.bus_watch_name(Gio.BusType.SESSION, 'org.a11y.Bus', Gio.BusNameWatcherFlags.NONE,
    173                            lambda *args: loop.quit(), None)
    174         loop.run()
     191        # We need to wait until the SPI bus is launched before trying to start the SPI registry.
     192        if not self._wait_for_accessibility_bus():
     193            sys.stderr.write("Failed checking the accessibility bus within D-Bus\n")
     194            sys.stderr.flush()
     195            return False
    175196
    176197        try:
     
    331352    def _get_tests_from_google_test_suite(self, test_program):
    332353        try:
    333             output = subprocess.check_output([test_program, '--gtest_list_tests'])
     354            output = subprocess.check_output([test_program, '--gtest_list_tests'], env=self._test_env)
    334355        except subprocess.CalledProcessError:
    335356            sys.stderr.write("ERROR: could not list available tests for binary %s.\n" % (test_program))
Note: See TracChangeset for help on using the changeset viewer.