summaryrefslogtreecommitdiff
path: root/tests
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
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')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/engine.c12
-rw-r--r--tests/profile/gdm2
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1f15f83..fc77755 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -86,6 +86,7 @@ EXTRA_DIST += \
profile/colourful \
profile/dos \
profile/empty-profile \
+ profile/gdm \
profile/many-sources \
profile/no-newline-longline \
profile/test-profile \
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,
diff --git a/tests/profile/gdm b/tests/profile/gdm
new file mode 100644
index 0000000..d5a90e5
--- /dev/null
+++ b/tests/profile/gdm
@@ -0,0 +1,2 @@
+user
+gdm