[gnome-software] trivial: Do not do the libsecret tests if no session D-Bus



commit f32a6c2ec08b612cd8bb8a19457cb22c5411c2ff
Author: Richard Hughes <richard hughsie com>
Date:   Thu Oct 19 21:14:52 2017 +0100

    trivial: Do not do the libsecret tests if no session D-Bus

 lib/gs-self-test.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/lib/gs-self-test.c b/lib/gs-self-test.c
index 2d74ac8..2d8b63d 100644
--- a/lib/gs-self-test.c
+++ b/lib/gs-self-test.c
@@ -593,10 +593,19 @@ static void
 gs_auth_secret_func (void)
 {
        gboolean ret;
+       g_autoptr(GDBusConnection) conn = NULL;
        g_autoptr(GError) error = NULL;
        g_autoptr(GsAuth) auth1 = NULL;
        g_autoptr(GsAuth) auth2 = NULL;
 
+       /* we not have an active session bus */
+       conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+       if (conn == NULL) {
+               g_prefix_error (&error, "no session bus available: ");
+               g_test_skip (error->message);
+               return;
+       }
+
        /* save secrets to disk */
        auth1 = gs_auth_new ("self-test");
        gs_auth_set_provider_schema (auth1, "org.gnome.Software.Dummy");


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