[glib] gsettings test: fix srcdir != builddir



commit 5c4f3f4dab47059c81855c383176ab4d88be1a18
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Nov 11 23:17:32 2013 -0500

    gsettings test: fix srcdir != builddir
    
    Just copy the schemas to the builddir and compile them in place instead
    of trying to mess around with creating the compiled file in a different
    dir.  This solves issues in the summary/description testcase when
    GSettings expects the usual situation of having the .xml files present
    in the same directory.

 gio/tests/Makefile.am |    1 +
 gio/tests/gsettings.c |   10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index 89a7cbd..5ac09d1 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -324,6 +324,7 @@ dist_uninstalled_test_data += \
        enums.xml.template
 # Generated while running the testcase itself...
 CLEANFILES += \
+       org.gtk.test.gschema.xml        \
        org.gtk.test.enums.xml          \
        gsettings.store                 \
        gschemas.compiled               \
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index ab54ad4..18156d6 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -2340,7 +2340,6 @@ test_read_descriptions (void)
   GSettingsSchema *schema;
   GSettingsSchemaKey *key;
   GSettings *settings;
-  const gchar *str;
 
   settings = g_settings_new ("org.gtk.test");
   g_object_get (settings, "settings-schema", &schema, NULL);
@@ -2386,6 +2385,7 @@ test_extended_schema (void)
 int
 main (int argc, char *argv[])
 {
+  gchar *schema_text;
   gchar *enums;
   gint result;
 
@@ -2412,11 +2412,11 @@ main (int argc, char *argv[])
       g_assert (g_file_set_contents ("org.gtk.test.enums.xml", enums, -1, NULL));
       g_free (enums);
 
+      g_assert (g_file_get_contents (SRCDIR "/org.gtk.test.gschema.xml", &schema_text, NULL, NULL));
+      g_assert (g_file_set_contents ("org.gtk.test.gschema.xml", schema_text, -1, NULL));
+
       g_remove ("gschemas.compiled");
-      g_assert (g_spawn_command_line_sync ("../glib-compile-schemas --targetdir=. "
-                                           "--schema-file=org.gtk.test.enums.xml "
-                                           "--schema-file=" SRCDIR "/org.gtk.test.gschema.xml",
-                                           NULL, NULL, &result, NULL));
+      g_assert (g_spawn_command_line_sync ("../glib-compile-schemas .", NULL, NULL, &result, NULL));
       g_assert (result == 0);
 
       g_remove ("schema-source/gschemas.compiled");


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