From 1c59fd4ea8a6b48d9e35c688ccd503b59b64e072 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 8 Jun 2011 18:15:05 +0100 Subject: [PATCH 2/2] Alter test-dbus-daemon so it tests the installed dbus-daemon by default For installcheck, adjust it to use things from DESTDIR. --- test/Makefile.am | 12 ++---------- test/dbus-daemon.c | 29 ++++++++++++----------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 8237fde..be59403 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -78,20 +78,15 @@ testexec_PROGRAMS = installable_tests = \ test-corrupt \ + test-dbus-daemon \ test-loopback \ test-relay \ $(NULL) -modular_tests = \ - test-dbus-daemon - installcheck_tests = installcheck_environment = \ DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT) \ - DBUS_TEST_DATA=@abs_top_builddir@/test/data \ - DBUS_TEST_USE_INSTALLED=1 \ - DBUS_TEST_SYSCONFDIR=$(sysconfdir) \ - DESTDIR=$(DESTDIR) + DBUS_TEST_SYSCONFDIR=$(DESTDIR)$(sysconfdir) TESTS_ENVIRONMENT = \ DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \ @@ -126,11 +121,8 @@ test_dbus_daemon_LDADD = $(top_builddir)/dbus/libdbus-1.la \ $(DBUS_GLIB_LIBS) if DBUS_ENABLE_MODULAR_TESTS -noinst_PROGRAMS += $(modular_tests) -TESTS += $(modular_tests) TESTS += $(installable_tests) installcheck_tests += $(installable_tests) -installcheck_tests += $(modular_tests) if DBUS_ENABLE_INSTALLED_TESTS testexec_PROGRAMS += $(installable_tests) diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index d2d5246..41eddc6 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -82,7 +82,7 @@ spawn_dbus_daemon (gchar *binary, g_spawn_async_with_pipes (NULL, /* working directory */ argv, NULL, /* envp */ - G_SPAWN_DO_NOT_REAP_CHILD, + G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, /* child_setup */ NULL, /* user data */ daemon_pid, @@ -178,31 +178,26 @@ setup (Fixture *f, f->ge = NULL; dbus_error_init (&f->e); - g_assert (g_getenv ("DBUS_TEST_DAEMON") != NULL); - dbus_daemon = g_strdup (g_getenv ("DBUS_TEST_DAEMON")); - if (g_getenv ("DBUS_TEST_USE_INSTALLED") != NULL) - { - /* we strdup this because it might be clobbered by a subsequent - * g_getenv */ - gchar *destdir = g_strdup (g_getenv ("DESTDIR")); - - if (destdir != NULL && *destdir != '\0') - config = g_strdup_printf ("--config-file=%s%s/dbus-1/session.conf", - destdir, g_getenv ("DBUS_TEST_SYSCONFDIR")); - else - config = g_strdup ("--session"); + if (dbus_daemon == NULL) + dbus_daemon = g_strdup ("dbus-daemon"); - g_free (destdir); + if (g_getenv ("DBUS_TEST_SYSCONFDIR") != NULL) + { + config = g_strdup_printf ("--config-file=%s/dbus-1/session.conf", + g_getenv ("DBUS_TEST_SYSCONFDIR")); } - else + else if (g_getenv ("DBUS_TEST_DATA") != NULL) { - g_assert (g_getenv ("DBUS_TEST_DATA") != NULL); config = g_strdup_printf ( "--config-file=%s/valid-config-files/session.conf", g_getenv ("DBUS_TEST_DATA")); } + else + { + config = g_strdup ("--session"); + } address = spawn_dbus_daemon (dbus_daemon, config, &f->daemon_pid); -- 1.7.5.3