${CMAKE_SOURCE_DIR}/../test/test-utils-glib.h
${CMAKE_SOURCE_DIR}/../test/test-utils-glib.c
)
- target_link_libraries(dbus-testutils-glib ${DBUS_INTERNAL_LIBRARIES})
+ target_link_libraries(dbus-testutils-glib dbus-testutils ${DBUS_INTERNAL_LIBRARIES})
add_definitions(
${GLIB2_DEFINITIONS}
test_marshal_SOURCES = marshal.c
test_marshal_LDADD = \
- $(top_builddir)/dbus/libdbus-1.la \
+ $(testutils_shared_if_possible_libs) \
$(GLIB_LIBS) \
$(NULL)
test_syntax_SOURCES = syntax.c
test_syntax_LDADD = \
- $(top_builddir)/dbus/libdbus-1.la \
+ $(testutils_shared_if_possible_libs) \
$(GLIB_LIBS) \
$(NULL)
#include <dbus/dbus.h>
-#include "test-utils.h"
+#include "test-utils-glib.h"
typedef struct {
DBusError e;
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
+ test_init (&argc, &argv);
g_test_add ("/corrupt/tcp", Fixture, "tcp:host=127.0.0.1", setup,
test_corrupt, teardown);
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/eavedrop/match_keyword/broadcast", Fixture, NULL,
setup, test_eavesdrop_broadcast, teardown);
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/echo/session", Fixture, NULL, setup, test_echo, teardown);
g_test_add ("/echo/limited", Fixture, &limited_config,
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/relay", Fixture, NULL, setup,
test_relay, teardown);
#include <dbus/dbus-message-internal.h>
#include <dbus/dbus-pending-call-internal.h>
#include <dbus/dbus-server-protected.h>
-#include "test-utils.h"
+#include "test-utils-glib.h"
static void
assert_no_error (const DBusError *e)
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/refs/connection", Fixture, NULL, setup_connection,
test_connection, teardown);
#include <dbus/dbus.h>
#include <dbus/dbus-sysdeps.h>
+#include "test-utils-glib.h"
+
typedef struct {
int dummy;
} Fixture;
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/syslog", Fixture, NULL, setup, test_syslog, teardown);
#include <string.h>
-#include "test-utils.h"
+#include "test-utils-glib.h"
typedef struct {
TestMainContext *ctx;
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/connect/tcp", Fixture, "tcp:host=127.0.0.1", setup,
test_connect, teardown);
#include <dbus/dbus.h>
+#include "test-utils-glib.h"
+
typedef struct {
DBusError e;
} Fixture;
char *aligned_le_blob;
char *aligned_be_blob;
- g_test_init (&argc, &argv, NULL);
+ test_init (&argc, &argv);
/* We have to pass in a buffer that's at least "default aligned",
* i.e. on GNU systems to 8 or 16. The linker may have only given
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/monitor/become", Fixture, &side_effects_config,
setup, test_become_monitor, teardown);
#include <dbus/dbus.h>
-#include "test-utils.h"
+#include "test-utils-glib.h"
/* This is basically a miniature dbus-daemon. We relay messages from the client
* on the left to the client on the right.
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/connect", Fixture, NULL, setup,
test_connect, teardown);
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/sd-activation", Fixture, NULL,
setup, test_activation, teardown);
#include <dbus/dbus.h>
+#include "test-utils-glib.h"
+
typedef struct {
DBusError e;
} Fixture;
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
+ test_init (&argc, &argv);
g_test_add ("/syntax/path", Fixture, &paths, setup, test_syntax, teardown);
g_test_add ("/syntax/interface", Fixture, &interfaces,
kill (pid, SIGTERM);
#endif
}
+
+static gboolean
+time_out (gpointer data)
+{
+ g_error ("timed out");
+ return FALSE;
+}
+
+void
+test_init (int *argcp, char ***argvp)
+{
+ g_test_init (argcp, argvp, NULL);
+ g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+
+ /* Prevent tests from hanging forever. This is intended to be long enough
+ * that any reasonable regression test on any reasonable hardware would
+ * have finished. */
+#define TIMEOUT 60
+
+ g_timeout_add_seconds (TIMEOUT, time_out, NULL);
+#ifdef G_OS_UNIX
+ /* The GLib main loop might not be running (we don't use it in every
+ * test). Die with SIGALRM shortly after if necessary. */
+ alarm (TIMEOUT + 10);
+#endif
+}
void test_kill_pid (GPid pid);
+void test_init (int *argcp, char ***argvp);
+
#endif
main (int argc,
char **argv)
{
- g_test_init (&argc, &argv, NULL);
- g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
+ test_init (&argc, &argv);
g_test_add ("/uid-permissions/uae/root", Fixture, &root_ok_config,
setup, test_uae, teardown);