[glib] GSettings tests: reverse installed test complexity
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GSettings tests: reverse installed test complexity
- Date: Sat, 1 Jun 2013 04:06:10 +0000 (UTC)
commit e042db0f83d73801a206cbaed1a49783355e0dd5
Author: Ryan Lortie <desrt desrt ca>
Date: Fri May 31 22:33:22 2013 -0400
GSettings tests: reverse installed test complexity
Remove the complications that were introduced in an attempt to make the
gsettings and gschema-compile tests function as installed tests. These
tests are designed (in large part for gsettings and entirely for
gschema-compile) to test the in-tree tools and should not be testing the
system versions.
In the future we may want to move the use of the in-tree tools from the
gsettings testcase into the Makefile and install the resulting files,
allowing this testcase to run against those files, installed.
gio/tests/gschema-compile.c | 9 +-------
gio/tests/gsettings.c | 46 +++++++++++++++----------------------------
2 files changed, 17 insertions(+), 38 deletions(-)
---
diff --git a/gio/tests/gschema-compile.c b/gio/tests/gschema-compile.c
index b687ab4..1d3cc19 100644
--- a/gio/tests/gschema-compile.c
+++ b/gio/tests/gschema-compile.c
@@ -5,8 +5,6 @@
#include <gio/gio.h>
#include <gstdio.h>
-const gchar *glib_compile_schemas;
-
typedef struct {
const gchar *name;
const gchar *opt;
@@ -20,7 +18,7 @@ test_schema_do_compile (gpointer data)
gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL);
gchar *path = g_test_build_filename (G_TEST_DIST, "schema-tests", filename, NULL);
gchar *argv[] = {
- (gchar*)glib_compile_schemas,
+ "../glib-compile-schemas",
"--strict",
"--dry-run",
"--schema-file", path,
@@ -141,11 +139,6 @@ main (int argc, char *argv[])
setlocale (LC_ALL, "");
- if (g_getenv ("GLIB_COMPILE_SCHEMAS"))
- glib_compile_schemas = g_getenv ("GLIB_COMPILE_SCHEMAS");
- else
- glib_compile_schemas = "/usr/bin/glib-compile-schemas";
-
g_test_init (&argc, &argv, NULL);
for (i = 0; i < G_N_ELEMENTS (tests); ++i)
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index 20967f4..e5e5903 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -2245,51 +2245,37 @@ main (int argc, char *argv[])
if (!g_test_subprocess ())
{
- const gchar *glib_mkenums;
- const gchar *glib_compile_schemas;
- gchar *cmdline;
-
backend_set = g_getenv ("GSETTINGS_BACKEND") != NULL;
- g_setenv ("XDG_DATA_DIRS", g_test_get_dir (G_TEST_DIST), TRUE);
+ g_setenv ("XDG_DATA_DIRS", ".", TRUE);
g_setenv ("GSETTINGS_SCHEMA_DIR", ".", TRUE);
if (!backend_set)
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
- if (g_getenv ("GLIB_MKENUMS"))
- glib_mkenums = g_getenv ("GLIB_MKENUMS");
- else
- glib_mkenums = "glib-mkenums";
-
- cmdline = g_strdup_printf ("%s --template %s/enums.xml.template %s/testenum.h", glib_mkenums,
- g_test_get_dir (G_TEST_DIST), g_test_get_dir (G_TEST_DIST));
-
- g_assert (g_spawn_command_line_sync (cmdline, &enums, NULL, &result, NULL));
+ g_remove ("org.gtk.test.enums.xml");
+ g_assert (g_spawn_command_line_sync ("../../gobject/glib-mkenums "
+ "--template " SRCDIR "/enums.xml.template "
+ SRCDIR "/testenum.h",
+ &enums, NULL, &result, NULL));
g_assert (result == 0);
g_assert (g_file_set_contents ("org.gtk.test.enums.xml", enums, -1, NULL));
g_free (enums);
- g_free (cmdline);
-
- if (g_getenv ("GLIB_COMPILE_SCHEMAS"))
- glib_compile_schemas = g_getenv ("GLIB_COMPILE_SCHEMAS");
- else
- glib_compile_schemas = "glib-compile-schemas";
-
- cmdline = g_strdup_printf ("%s --targetdir=. --schema-file=org.gtk.test.enums.xml
--schema-file=%s/org.gtk.test.gschema.xml", glib_compile_schemas, g_test_get_dir (G_TEST_DIST));
- g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, 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 (result == 0);
- g_free (cmdline);
- g_mkdir ("schema-source", 0777);
g_remove ("schema-source/gschemas.compiled");
-
- cmdline = g_strdup_printf ("%s --targetdir=schema-source
--schema-file=%s/org.gtk.schemasourcecheck.gschema.xml", glib_compile_schemas, g_test_get_dir (G_TEST_DIST));
- g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL));
+ g_mkdir ("schema-source", 0777);
+ g_assert (g_spawn_command_line_sync ("../glib-compile-schemas --targetdir=schema-source "
+ "--schema-file=" SRCDIR "/org.gtk.schemasourcecheck.gschema.xml",
+ NULL, NULL, &result, NULL));
g_assert (result == 0);
- g_free (cmdline);
- }
+ }
g_test_add_func ("/gsettings/basic", test_basic);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]