summaryrefslogtreecommitdiff
path: root/bus/test-main.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-14 16:53:23 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-04-27 16:28:36 +0100
commite4abc1d1a5657256bc1632477096bf86b08beff8 (patch)
tree0ff6b6e8ea122c2a270da8c3977a6a4ce4d1bb82 /bus/test-main.c
parent614ea05b182b3cd142c6ad9da43e65a7113a0ea4 (diff)
downloaddbus-e4abc1d1a5657256bc1632477096bf86b08beff8.tar.gz
Don't report file descriptors as "leaked" if they were already open
This is necessary to run the regression tests under valgrind (if telling it to output to a dedicated fd), gdb, fakeroot etc. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35173 Reviewed-by: Colin Walters <walters@verbum.org>
Diffstat (limited to 'bus/test-main.c')
-rw-r--r--bus/test-main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bus/test-main.c b/bus/test-main.c
index cab75306..a8039d51 100644
--- a/bus/test-main.c
+++ b/bus/test-main.c
@@ -54,6 +54,8 @@ check_memleaks (const char *name)
}
#endif /* DBUS_BUILD_TESTS */
+static DBusInitialFDs *initial_fds = NULL;
+
static void
test_pre_hook (void)
{
@@ -62,16 +64,21 @@ test_pre_hook (void)
&& (!bus_selinux_pre_init ()
|| !bus_selinux_full_init ()))
die ("could not init selinux support");
+
+ initial_fds = _dbus_check_fdleaks_enter ();
}
static char *progname = "";
+
static void
test_post_hook (void)
{
if (_dbus_getenv ("DBUS_TEST_SELINUX"))
bus_selinux_shutdown ();
check_memleaks (progname);
- _dbus_check_fdleaks();
+
+ _dbus_check_fdleaks_leave (initial_fds);
+ initial_fds = NULL;
}
int