blob: 0db8fd16098a411abb8ba4ad9a3dc8063b46a98f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
Fix dbus-appinfo from attempting to use the session's bus, and hanging if there
isn't one present.
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@intel.com>
From 940fa98290812789d095d93ff1c550cd86fb2428 Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xavier.claessens@collabora.co.uk>
Date: Mon, 28 Oct 2013 21:18:54 +0000
Subject: Tests: add session_bus_run() and use it where possible
This is to avoid having again the subtil bug in dbus-appinfo.c:
session_bus_down() was called before g_test_run() so the test was
running on the user's dbus session.
https://bugzilla.gnome.org/show_bug.cgi?id=697348
---
diff --git a/gio/tests/dbus-appinfo.c b/gio/tests/dbus-appinfo.c
index ca11e98..7698429 100644
--- a/gio/tests/dbus-appinfo.c
+++ b/gio/tests/dbus-appinfo.c
@@ -280,11 +280,7 @@ main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
- session_bus_up ();
-
g_test_add_func ("/appinfo/dbusappinfo", test_dbus_appinfo);
- session_bus_down ();
-
- return g_test_run ();
+ return session_bus_run ();
}
diff --git a/gio/tests/gdbus-sessionbus.c b/gio/tests/gdbus-sessionbus.c
index 68c4449..13c2edb 100644
--- a/gio/tests/gdbus-sessionbus.c
+++ b/gio/tests/gdbus-sessionbus.c
@@ -47,3 +47,14 @@ session_bus_down (void)
g_clear_object (&singleton);
}
+gint
+session_bus_run (void)
+{
+ gint ret;
+
+ session_bus_up ();
+ ret = g_test_run ();
+ session_bus_down ();
+
+ return ret;
+}
diff --git a/gio/tests/gdbus-sessionbus.h b/gio/tests/gdbus-sessionbus.h
index 7ef3abd..284cd00 100644
--- a/gio/tests/gdbus-sessionbus.h
+++ b/gio/tests/gdbus-sessionbus.h
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
void session_bus_up (void);
void session_bus_stop (void);
void session_bus_down (void);
+gint session_bus_run (void);
G_END_DECLS
|