set (DBUS_INTERNAL_LIBRARY_DEFINITIONS "-DDBUS_STATIC_BUILD")
# For now, the CMake build system doesn't support replacing the internal
# main loop with dbus-glib
-set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD -DDBUS_COMPILATION -DDBUS_TEST_USE_INTERNAL")
+set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD -DDBUS_COMPILATION")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
-I$(top_srcdir) \
$(DBUS_STATIC_BUILD_CPPFLAGS) \
$(GLIB_CFLAGS) \
- $(DBUS_GLIB_CFLAGS) \
$(NULL)
# improve backtraces from test stuff
$(AM_CPPFLAGS) \
-DDBUS_STATIC_BUILD \
-DDBUS_COMPILATION \
- -DDBUS_TEST_USE_INTERNAL \
$(NULL)
-noinst_LTLIBRARIES = libdbus-testutils-internal.la
+noinst_LTLIBRARIES = libdbus-testutils.la
libdbus_testutils_la_SOURCES = \
test-utils.c \
$(NULL)
endif
-# You can link either libdbus-testutils, dbus-glib and libdbus-1,
-# or libdbus-testutils-internal and libdbus-internal - never both in the
-# same binary.
-if DBUS_WITH_DBUS_GLIB
-noinst_LTLIBRARIES += libdbus-testutils.la
-libdbus_testutils_la_LIBADD = \
- $(top_builddir)/dbus/libdbus-1.la \
- $(GLIB_LIBS) \
- $(DBUS_GLIB_LIBS) \
- $(NULL)
-testutils_shared_if_possible_cppflags = $(AM_CPPFLAGS)
-testutils_shared_if_possible_libs = libdbus-testutils.la
-else
testutils_shared_if_possible_cppflags = $(static_cppflags)
-testutils_shared_if_possible_libs = libdbus-testutils-internal.la
-endif
+testutils_shared_if_possible_libs = libdbus-testutils.la
-libdbus_testutils_internal_la_CPPFLAGS = \
+libdbus_testutils_la_CPPFLAGS = \
$(static_cppflags) \
$(NULL)
-libdbus_testutils_internal_la_SOURCES = \
- $(libdbus_testutils_la_SOURCES) \
- $(NULL)
-libdbus_testutils_internal_la_LIBADD = \
+libdbus_testutils_la_LIBADD = \
$(top_builddir)/dbus/libdbus-internal.la \
$(NULL)
noinst_PROGRAMS= $(TEST_BINARIES)
test_service_CPPFLAGS = $(static_cppflags)
-test_service_LDADD = libdbus-testutils-internal.la
+test_service_LDADD = libdbus-testutils.la
test_names_CPPFLAGS = $(static_cppflags)
-test_names_LDADD = libdbus-testutils-internal.la
+test_names_LDADD = libdbus-testutils.la
## break_loader_CPPFLAGS = $(static_cppflags)
## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la
test_shell_service_CPPFLAGS = $(static_cppflags)
-test_shell_service_LDADD = libdbus-testutils-internal.la
+test_shell_service_LDADD = libdbus-testutils.la
test_shell_SOURCES = shell-test.c
test_shell_CPPFLAGS = $(static_cppflags)
-test_shell_LDADD = libdbus-testutils-internal.la
+test_shell_LDADD = libdbus-testutils.la
test_spawn_SOURCES = spawn-test.c
test_spawn_CPPFLAGS = $(static_cppflags)
test_spawn_LDADD = $(top_builddir)/dbus/libdbus-internal.la
test_refs_SOURCES = internals/refs.c
test_refs_CPPFLAGS = $(static_cppflags)
-test_refs_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
+test_refs_LDADD = libdbus-testutils.la $(GLIB_LIBS)
test_syslog_SOURCES = internals/syslog.c
test_syslog_CPPFLAGS = $(static_cppflags)
-test_syslog_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS)
+test_syslog_LDADD = libdbus-testutils.la $(GLIB_LIBS)
manual_dir_iter_SOURCES = manual-dir-iter.c
manual_dir_iter_CPPFLAGS = $(static_cppflags)
$(static_cppflags) \
$(NULL)
test_fdpass_LDADD = \
- libdbus-testutils-internal.la \
+ libdbus-testutils.la \
$(GLIB_LIBS) \
$(NULL)
-I$(top_srcdir) \
-DDBUS_COMPILATION \
-DDBUS_STATIC_BUILD \
- -DDBUS_TEST_USE_INTERNAL \
$(NULL)
# if assertions are enabled, improve backtraces
test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-internal.la
test_ids_LDADD=$(top_builddir)/dbus/libdbus-internal.la
-test_shutdown_LDADD=../libdbus-testutils-internal.la
-test_privserver_LDADD=../libdbus-testutils-internal.la
-test_privserver_client_LDADD=../libdbus-testutils-internal.la
-test_autolaunch_LDADD=../libdbus-testutils-internal.la
+test_shutdown_LDADD=../libdbus-testutils.la
+test_privserver_LDADD=../libdbus-testutils.la
+test_privserver_client_LDADD=../libdbus-testutils.la
+test_autolaunch_LDADD=../libdbus-testutils.la
endif
#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;
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;
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
dbus_connection_set_dispatch_status_function (connection, NULL, NULL, NULL);
}
-#ifdef DBUS_TEST_USE_INTERNAL
-
typedef struct
{
DBusLoop *loop;
_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;
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
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
DBusMessage **message_p = data;
*message_p = dbus_pending_call_steal_reply (pc);
- test_assert (*message_p != NULL);
+ _dbus_assert (*message_p != NULL);
}
#include <dbus/dbus.h>
-#ifdef DBUS_TEST_USE_INTERNAL
-
-# include <dbus/dbus-mainloop.h>
-# include <dbus/dbus-internals.h>
- typedef DBusLoop TestMainContext;
-
-#else /* !DBUS_TEST_USE_INTERNAL */
-
-# include <glib.h>
- typedef GMainContext TestMainContext;
-
-#endif /* !DBUS_TEST_USE_INTERNAL */
+#include <dbus/dbus-mainloop.h>
+#include <dbus/dbus-internals.h>
+typedef DBusLoop TestMainContext;
TestMainContext *test_main_context_get (void);
TestMainContext *test_main_context_ref (TestMainContext *ctx);