Skip to content
Permalink
Browse files
[GTK] run-gtk-tests should use the driver environment for checking th…
…e 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.

Canonical link: https://commits.webkit.org/179394@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
clopez committed Aug 26, 2016
1 parent e9413ef commit f3acad01560e35c560293f22bd52fce7d8477020
Showing with 48 additions and 7 deletions.
  1. +20 −0 Tools/ChangeLog
  2. +28 −7 Tools/Scripts/run-gtk-tests
@@ -1,3 +1,23 @@
2016-08-26 Carlos Alberto Lopez Perez <clopez@igalia.com>

[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 <pvollan@apple.com>

[Win] Warning fix.
@@ -153,6 +153,28 @@ class TestRunner:

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 @@ class TestRunner:
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 @@ class TestRunner:

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()

0 comments on commit f3acad0

Please sign in to comment.