[libsoup/gnome-2-30] sniffing-test: be robust against slightly-broken jhbuild configs



commit 50edc38eece29f9be02b8d0296197adde99092de
Author: Dan Winship <danw gnome org>
Date:   Mon Jun 7 20:17:36 2010 +0200

    sniffing-test: be robust against slightly-broken jhbuild configs
    
    previously if you jhbuilt glib and libsoup, but not shared-mime-info,
    then this test would fail. Fix that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=612706

 tests/sniffing-test.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/tests/sniffing-test.c b/tests/sniffing-test.c
index b2296be..1bab24c 100644
--- a/tests/sniffing-test.c
+++ b/tests/sniffing-test.c
@@ -445,6 +445,24 @@ test_disabled (const char *path)
 	g_main_loop_unref (loop);
 }
 
+/* Fix up XDG_DATA_DIRS for jhbuild runs so that it still works even
+ * if you didn't install shared-mime-info.
+ */
+static void
+fixup_xdg_dirs (void)
+{
+	const char *xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
+	char *new_data_dirs;
+
+	if (xdg_data_dirs &&
+	    !g_str_has_prefix (xdg_data_dirs, "/usr/share") &&
+	    !strstr (xdg_data_dirs, ":/usr/share")) {
+		new_data_dirs = g_strdup_printf ("%s:/usr/share", xdg_data_dirs);
+		g_setenv ("XDG_DATA_DIRS", new_data_dirs, TRUE);
+		g_free (new_data_dirs);
+	}
+}
+
 int
 main (int argc, char **argv)
 {
@@ -452,6 +470,8 @@ main (int argc, char **argv)
 
 	test_init (argc, argv, NULL);
 
+	fixup_xdg_dirs ();
+
 	server = soup_test_server_new (TRUE);
 	soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
 	base_uri = soup_uri_new ("http://127.0.0.1/";);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]