summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--dbus/Makefile.am4
-rw-r--r--dbus/dbus-keyring.c21
3 files changed, 29 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d497688..717ee488 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2003-03-31 Havoc Pennington <hp@redhat.com>
+ * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): allow setting
+ DBUS_TEST_HOMEDIR when tests are enabled, so we can test without
+ having a real home directory available.
+
+2003-03-31 Havoc Pennington <hp@redhat.com>
+
* bus/Makefile.am (install-data-hook): create /var/run/dbus
* bus/messagebus.in: add init script for Red Hat /etc/init.d
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index c7a93b58..9f2f2e7d 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -111,8 +111,8 @@ libdbus_1_la_LDFLAGS= -export-symbols-regex "^[^_].*"
## so if adding tests not to be run in make check, don't add them to
## TESTS
if DBUS_BUILD_TESTS
-TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_srcdir)/test/data
-TESTS=dbus-test
+TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_srcdir)/test/data DBUS_TEST_HOMEDIR=$(top_builddir)/dbus
+TESTS=dbus-test
else
TESTS=
endif
diff --git a/dbus/dbus-keyring.c b/dbus/dbus-keyring.c
index fbaf7cd2..d63bc3e8 100644
--- a/dbus/dbus-keyring.c
+++ b/dbus/dbus-keyring.c
@@ -711,6 +711,27 @@ _dbus_keyring_new_homedir (const DBusString *username,
goto failed;
}
+#ifdef DBUS_BUILD_TESTS
+ {
+ const char *override;
+
+ override = _dbus_getenv ("DBUS_TEST_HOMEDIR");
+ if (override != NULL && *override != '\0')
+ {
+ _dbus_string_set_length (&homedir, 0);
+ if (!_dbus_string_append (&homedir, override))
+ _dbus_assert_not_reached ("no memory");
+
+ _dbus_verbose ("Using fake homedir for testing: %s\n",
+ _dbus_string_get_const_data (&homedir));
+ }
+ else
+ {
+ _dbus_warn ("Using your real home directory for testing, set DBUS_TEST_HOMEDIR to avoid\n");
+ }
+ }
+#endif
+
_dbus_assert (username != NULL);
keyring = _dbus_keyring_new ();