summaryrefslogtreecommitdiff
path: root/tests/engine.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-19 10:47:50 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-19 10:49:29 -0400
commitbc02d65a6c8defcee64022ba2f9a2607495281f7 (patch)
tree055e6f5de2037cab0cf590b07398367f3fb912ad /tests/engine.c
parentd4cad3d9f47939491af91dc44348cd283e8eb9b8 (diff)
downloaddconf-bc02d65a6c8defcee64022ba2f9a2607495281f7.tar.gz
engine: improve robustness of profile parsing
Checking for 'u' or 's' is really insanely silly from a robustness standpoint. Ensure that we properly have "user-db:" or "system-db:" and that a non-empty database name is given, warning if not. This was specifically causing annoying problems with the profile file that gdm was installing, so add a copy of that file to our testcases.
Diffstat (limited to 'tests/engine.c')
-rw-r--r--tests/engine.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/engine.c b/tests/engine.c
index 5d22f27..20c050f 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -161,6 +161,18 @@ test_profile_parser (void)
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*WARNING*: unknown dconf database*unknown dconf database*");
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
+ {
+ g_log_set_always_fatal (G_LOG_LEVEL_ERROR);
+
+ sources = dconf_engine_profile_open (SRCDIR "/profile/gdm", &n_sources);
+ g_assert_cmpint (n_sources, ==, 0);
+ g_assert (sources == NULL);
+ exit (0);
+ }
+ g_test_trap_assert_passed ();
+ g_test_trap_assert_stderr ("*WARNING*: unknown dconf database*unknown dconf database*");
+
test_five_times (SRCDIR "/profile/empty-profile", 0);
test_five_times (SRCDIR "/profile/test-profile", 1, "test");
test_five_times (SRCDIR "/profile/colourful", 4,