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 <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
This commit is contained in:
Simon McVittie 2011-06-08 18:15:05 +01:00
parent a2f3b17504
commit 715fa5c0d5
2 changed files with 14 additions and 27 deletions

View file

@ -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)

View file

@ -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)
if (dbus_daemon == NULL)
dbus_daemon = g_strdup ("dbus-daemon");
if (g_getenv ("DBUS_TEST_SYSCONFDIR") != 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");
g_free (destdir);
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);