From: Simon McVittie Date: Wed, 8 Jun 2011 17:15:05 +0000 (+0100) Subject: Alter test-dbus-daemon so it tests the installed dbus-daemon by default X-Git-Tag: dbus-1.4.12~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=715fa5c0d53d8a6c471911d0376ea34ebabfd8d6;p=thirdparty%2Fdbus.git Alter test-dbus-daemon so it tests the installed dbus-daemon by default For installcheck, adjust it to use things from DESTDIR. Reviewed-by: Will Thompson Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570 --- diff --git a/test/Makefile.am b/test/Makefile.am index 8237fdef8..be594038c 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 d2d5246a9..41eddc603 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);