diff options
Diffstat (limited to 'gio')
-rw-r--r-- | gio/tests/Makefile.am | 8 | ||||
-rw-r--r-- | gio/tests/gschema-compile.c | 78 | ||||
-rw-r--r-- | gio/tests/gsettings.c | 6 |
3 files changed, 59 insertions, 33 deletions
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am index 73941f61b..4f38a84d9 100644 --- a/gio/tests/Makefile.am +++ b/gio/tests/Makefile.am @@ -176,10 +176,4 @@ DISTCLEANFILES = \ de/LC_MESSAGES/test.mo \ test.mo \ gsettings.store \ - gschemas.compiled \ - schema-tests/bad-type/gschemas.compiled \ - schema-tests/incomplete-list/gschemas.compiled \ - schema-tests/missing-quotes/gschemas.compiled \ - schema-tests/no-default/gschemas.compiled \ - schema-tests/wrong-category/gschemas.compiled \ - schema-tests/overflow/gschemas.compiled + gschemas.compiled diff --git a/gio/tests/gschema-compile.c b/gio/tests/gschema-compile.c index 0069630db..b848986b7 100644 --- a/gio/tests/gschema-compile.c +++ b/gio/tests/gschema-compile.c @@ -8,13 +8,18 @@ static void test_no_default (void) { - g_remove ("schema-tests/no-default/gschemas.compiled"); + g_remove ("gschemas.compiled"); if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { - gchar *argv[] = { "../gschema-compile", "./schema-tests/no-default/", NULL }; - gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + gchar *argv[] = { + "../gschema-compile", + SRCDIR "/schema-tests/no-default/", + "--targetdir=.", + NULL + }; + gchar *envp[] = { NULL }; + execve (argv[0], argv, envp); } g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*<default> is required in <key>*"); @@ -23,13 +28,18 @@ test_no_default (void) static void test_missing_quotes (void) { - g_remove ("schema-tests/missing-quotes/gschemas.compiled"); + g_remove ("gschemas.compiled"); if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { - gchar *argv[] = { "../gschema-compile", "./schema-tests/missing-quotes/", NULL }; - gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + gchar *argv[] = { + "../gschema-compile", + SRCDIR "/schema-tests/missing-quotes/", + "--targetdir=.", + NULL + }; + gchar *envp[] = { NULL }; + execve (argv[0], argv, envp); } g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*unknown keyword*"); @@ -38,13 +48,18 @@ test_missing_quotes (void) static void test_incomplete_list (void) { - g_remove ("schema-tests/incomplete-list/gschemas.compiled"); + g_remove ("gschemas.compiled"); if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { - gchar *argv[] = { "../gschema-compile", "./schema-tests/incomplete-list/", NULL }; - gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + gchar *argv[] = { + "../gschema-compile", + SRCDIR "/schema-tests/incomplete-list/", + "--targetdir=.", + NULL + }; + gchar *envp[] = { NULL }; + execve (argv[0], argv, envp); } g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*to follow array element*"); @@ -53,13 +68,18 @@ test_incomplete_list (void) static void test_wrong_category (void) { - g_remove ("schema-tests/wrong-category/gschemas.compiled"); + g_remove ("gschemas.compiled"); if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { - gchar *argv[] = { "../gschema-compile", "./schema-tests/wrong-category/", NULL }; - gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + gchar *argv[] = { + "../gschema-compile", + SRCDIR "/schema-tests/wrong-category/", + "--targetdir=.", + NULL + }; + gchar *envp[] = { NULL }; + execve (argv[0], argv, envp); } g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*attribute 'l10n' invalid*"); @@ -68,13 +88,18 @@ test_wrong_category (void) static void test_bad_type (void) { - g_remove ("schema-tests/bad-type/gschemas.compiled"); + g_remove ("gschemas.compiled"); if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { - gchar *argv[] = { "../gschema-compile", "./schema-tests/bad-type/", NULL }; - gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + gchar *argv[] = { + "../gschema-compile", + SRCDIR "/schema-tests/bad-type/", + "--targetdir=.", + NULL + }; + gchar *envp[] = { NULL }; + execve (argv[0], argv, envp); } g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*invalid GVariant type string*"); @@ -83,13 +108,18 @@ test_bad_type (void) static void test_overflow (void) { - g_remove ("schema-tests/overflow/gschemas.compiled"); + g_remove ("gschemas.compiled"); if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) { - gchar *argv[] = { "../gschema-compile", "./schema-tests/overflow/", NULL }; - gchar *envp[] = { NULL }; - execve (argv[0], argv, envp); + gchar *argv[] = { + "../gschema-compile", + SRCDIR "/schema-tests/overflow/", + "--targetdir=.", + NULL + }; + gchar *envp[] = { NULL }; + execve (argv[0], argv, envp); } g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*out of range*"); diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c index ef0ba06f0..33b8f677f 100644 --- a/gio/tests/gsettings.c +++ b/gio/tests/gsettings.c @@ -1065,11 +1065,13 @@ main (int argc, char *argv[]) g_setenv ("GSETTINGS_SCHEMA_DIR", ".", TRUE); g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); - g_remove ("./store"); - g_type_init (); g_test_init (&argc, &argv, NULL); + g_remove ("gschemas.compiled"); + g_assert (g_spawn_command_line_sync ("../gschema-compile --targetdir=. " SRCDIR, + NULL, NULL, NULL, NULL)); + g_test_add_func ("/gsettings/basic", test_basic); g_test_add_func ("/gsettings/no-schema", test_no_schema); g_test_add_func ("/gsettings/unknown-key", test_unknown_key); |