[patch][core] Fix test_default_session_servicedirs on Unix
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue May 22 05:33:49 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
bus/config-parser.c r1.50 reordered the expected order of service directories
on Unix (breaking the test), apparently in the interests of simplifying the
Unix vs Windows #ifdefs. This patch reverts the re-ordering to make the test
pass again.
Also, r1.50 added some calls to _dbus_string_free for a DBusString
that's only initialized on Windows (well, strictly speaking: when
$CommonProgramFiles is in the environment). Rather than making the
_dbus_string_free conditional, I've just moved the initialization of the
DBusString outside the Windows-specific code.
Finally, I've ensured that the Windows-specific code is only run if, in
fact, running Windows (and not if a Unix user happens to have
$CommonProgramFiles in their environment for some reason).
make check and make distcheck now pass on Unix - Ralf, could you check
that I haven't broken the tests on Windows?
Regards,
Simon
Index: bus/config-parser.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/config-parser.c,v
retrieving revision 1.50
diff -u -u -r1.50 config-parser.c
- --- bus/config-parser.c 17 May 2007 11:47:48 -0000 1.50
+++ bus/config-parser.c 22 May 2007 12:31:01 -0000
@@ -3077,12 +3077,14 @@
static const char *test_service_dir_matches[] =
{
- - DBUS_DATADIR"/dbus-1/services",
#ifdef DBUS_UNIX
"/testusr/testlocal/testshare/dbus-1/services",
"/testusr/testshare/dbus-1/services",
- - "/testhome/foo/.testlocal/testshare/dbus-1/services",
- -#endif
+#endif
+ DBUS_DATADIR"/dbus-1/services",
+#ifdef DBUS_UNIX
+ "/testhome/foo/.testlocal/testshare/dbus-1/services",
+#endif
NULL
};
@@ -3095,12 +3097,15 @@
const char *common_progs;
int i;
+ /* On Unix we don't actually use this variable, but it's easier to handle the
+ * deallocation if we always allocate it, whether needed or not */
+ if (!_dbus_string_init (&progs))
+ _dbus_assert_not_reached ("OOM allocating progs");
+
common_progs = _dbus_getenv ("CommonProgramFiles");
+#ifndef DBUS_UNIX
if (common_progs)
{
- - if (!_dbus_string_init (&progs))
- - return FALSE;
- -
if (!_dbus_string_append (&progs, common_progs))
{
_dbus_string_free (&progs);
@@ -3114,6 +3119,7 @@
}
test_service_dir_matches[1] = _dbus_string_get_const_data(&progs);
}
+#endif
dirs = NULL;
printf ("Testing retrieving the default session service directories\n");
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net
iD8DBQFGUuMtWSc8zVUw7HYRAnANAJ9aov4/6214warcc9csTaorif2UBACbBnUl
a3jnpfBM1MmYkncGXBeWnC8=
=Pqeh
-----END PGP SIGNATURE-----
More information about the dbus
mailing list