summaryrefslogtreecommitdiff
path: root/test/test-utils.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-20 15:07:23 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-20 20:49:32 +0000
commitdbd731491b19df3df4edf597ea7b646b76576b07 (patch)
treeb5f27c92a88500182ad4b60885c2f0fdd458dafd /test/test-utils.c
parent267c69ac90d6c8e8ef4b8a80e669db16febb2b55 (diff)
downloaddbus-dbd731491b19df3df4edf597ea7b646b76576b07.tar.gz
tests: always use libdbus-internal for main loop, never dbus-glib
This gets rid of a potential circular dependency, which is annoying when bootstrapping. It is nice to have the regression tests use the shared libdbus, but we're about to make it possible to do that anyway, even though some of them use internal symbols. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83115 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Diffstat (limited to 'test/test-utils.c')
-rw-r--r--test/test-utils.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/test/test-utils.c b/test/test-utils.c
index 9686a9a8..cb6cf1fb 100644
--- a/test/test-utils.c
+++ b/test/test-utils.c
@@ -1,21 +1,6 @@
#include <config.h>
#include "test-utils.h"
-#ifndef DBUS_TEST_USE_INTERNAL
-# include <dbus/dbus.h>
-# include <dbus/dbus-glib-lowlevel.h>
-#endif
-
-#ifdef DBUS_TEST_USE_INTERNAL
-# define test_assert(x) _dbus_assert(x)
-#elif defined(g_assert_true)
-# define test_assert(x) g_assert_true(x)
-#else
-# define test_assert(x) g_assert(x)
-#endif
-
-#ifdef DBUS_TEST_USE_INTERNAL
-
typedef struct
{
DBusLoop *loop;
@@ -112,13 +97,10 @@ cdata_new (DBusLoop *loop,
return cd;
}
-#endif /* DBUS_TEST_USE_INTERNAL */
-
dbus_bool_t
test_connection_setup (TestMainContext *ctx,
DBusConnection *connection)
{
-#ifdef DBUS_TEST_USE_INTERNAL
DBusLoop *loop = ctx;
CData *cd;
@@ -167,12 +149,6 @@ test_connection_setup (TestMainContext *ctx,
dbus_connection_set_timeout_functions (connection, NULL, NULL, NULL, NULL, NULL);
return FALSE;
-#else /* !DBUS_TEST_USE_INTERNAL */
-
- dbus_connection_setup_with_g_main (connection, ctx);
- return TRUE;
-
-#endif /* !DBUS_TEST_USE_INTERNAL */
}
static void
@@ -203,8 +179,6 @@ test_connection_shutdown (TestMainContext *ctx,
dbus_connection_set_dispatch_status_function (connection, NULL, NULL, NULL);
}
-#ifdef DBUS_TEST_USE_INTERNAL
-
typedef struct
{
DBusLoop *loop;
@@ -286,13 +260,10 @@ remove_server_timeout (DBusTimeout *timeout,
_dbus_loop_remove_timeout (context->loop, timeout);
}
-#endif /* DBUS_TEST_USE_INTERNAL */
-
dbus_bool_t
test_server_setup (TestMainContext *ctx,
DBusServer *server)
{
-#ifdef DBUS_TEST_USE_INTERNAL
DBusLoop *loop = ctx;
ServerData *sd;
@@ -331,13 +302,6 @@ test_server_setup (TestMainContext *ctx,
test_server_shutdown (loop, server);
return FALSE;
-
-#else /* !DBUS_TEST_USE_INTERNAL */
-
- dbus_server_setup_with_g_main (server, ctx);
- return TRUE;
-
-#endif /* !DBUS_TEST_USE_INTERNAL */
}
void
@@ -362,41 +326,24 @@ test_server_shutdown (TestMainContext *ctx,
TestMainContext *
test_main_context_get (void)
{
-#ifdef DBUS_TEST_USE_INTERNAL
return _dbus_loop_new ();
-#else
- /* I suspect dbus-glib relies the default main context in some places */
- return g_main_context_ref (g_main_context_default ());
-#endif
}
TestMainContext *
test_main_context_ref (TestMainContext *ctx)
{
-#ifdef DBUS_TEST_USE_INTERNAL
return _dbus_loop_ref (ctx);
-#else
- return g_main_context_ref (ctx);
-#endif
}
void test_main_context_unref (TestMainContext *ctx)
{
-#ifdef DBUS_TEST_USE_INTERNAL
_dbus_loop_unref (ctx);
-#else
- g_main_context_unref (ctx);
-#endif
}
void test_main_context_iterate (TestMainContext *ctx,
dbus_bool_t may_block)
{
-#ifdef DBUS_TEST_USE_INTERNAL
_dbus_loop_iterate (ctx, may_block);
-#else
- g_main_context_iteration (ctx, may_block);
-#endif
}
void
@@ -406,5 +353,5 @@ test_pending_call_store_reply (DBusPendingCall *pc,
DBusMessage **message_p = data;
*message_p = dbus_pending_call_steal_reply (pc);
- test_assert (*message_p != NULL);
+ _dbus_assert (*message_p != NULL);
}