[at-spi2-core: 3/5] run-tests.sh: Launch a mock org.gnome.SessionManager to control the lifetime of the daemons




commit 6ec0eb011e8b88582953a7d1da5c7ee5c1d27ba3
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Jun 9 14:41:12 2022 -0500

    run-tests.sh: Launch a mock org.gnome.SessionManager to control the lifetime of the daemons
    
    Both at-spi-bus-launcher and at-spi2-registryd will keep running
    indefinitely unless the session manager tells them that the session is
    ending.
    
    During the CI tests, the daemons are killed when the tests finish.
    They don't get a chance to exit cleanly.
    
    GCC's code coverage machinery from libgcc depends on a process exiting
    cleanly for it to be able to write out the .gcda files.  These files
    were never written for the a11y daemons because they didn't exit
    cleanly.
    
    This commit changes the test runner to launch a mock implementation of
    the org.gnome.SessionManager interface.  It does nothing but accept
    clients that register themselves, and to signal clients for session
    termination.
    
    The daemons now pick up that signal from the mock, as if it were from
    a real session, and exit cleanly.

 ci/run-tests.sh | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/ci/run-tests.sh b/ci/run-tests.sh
index f3ce5c2c..7dcbb7df 100755
--- a/ci/run-tests.sh
+++ b/ci/run-tests.sh
@@ -1,17 +1,39 @@
 #!/bin/sh
 
-set -e
+set -eu
 
-echo "About to run the tests.  First we'll launch the accessibility bus by calling GetAddress:"
+echo "About to run the tests.  First we'll launch a gnome-session DBus mock."
 
-dbus-send --print-reply --session --dest=org.a11y.Bus /org/a11y/bus org.a11y.Bus.GetAddress
+python3 -m dbusmock --session org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager &
+sleep 1
+
+gdbus call --session \
+      --dest org.gnome.SessionManager \
+      --object-path /org/gnome/SessionManager \
+      --method org.freedesktop.DBus.Mock.AddTemplate 'tests/dbusmock/mock-gnome-session.py' '{}'
+
+echo "Launching the accessibility bus by calling GetAddress:"
+
+gdbus call --session --dest org.a11y.Bus --object-path /org/a11y/bus --method org.a11y.Bus.GetAddress
 
 ps auxwww
 
+echo "Setting the mock session to the running state"
+
+gdbus call --session \
+      --dest org.gnome.SessionManager \
+      --object-path /org/gnome/SessionManager \
+      --method org.freedesktop.DBus.Mock.SetSessionRunning true
+
 echo "Now running the tests:"
 
 meson test -C _build
 
-echo "After the tests - calling GetAddress again:"
+echo "Telling the mock session to logout so the a11y daemons will exit"
+
+gdbus call --session \
+      --dest org.gnome.SessionManager \
+      --object-path /org/gnome/SessionManager \
+      --method org.gnome.SessionManager.Logout 0
 
-dbus-send --print-reply --session --dest=org.a11y.Bus /org/a11y/bus org.a11y.Bus.GetAddress
+ps auxwww


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]