[tracker] libtracker-miner: Use test location for password provider config and don't abort
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Use test location for password provider config and don't abort
- Date: Fri, 3 Jun 2011 12:57:48 +0000 (UTC)
commit 641a6b484716a2b0da9c80a77f4e694bab6523c4
Author: Martyn Russell <martyn lanedo com>
Date: Fri Jun 3 12:42:30 2011 +0100
libtracker-miner: Use test location for password provider config and don't abort
Previously we aborted on any warning or worse, to counter this (given
we don't expect the file to exist when running the tests initially),
we set up a gtest log handler function.
.../tracker-password-provider-test.c | 27 ++++++++++++++++++-
1 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/tests/libtracker-miner/tracker-password-provider-test.c b/tests/libtracker-miner/tracker-password-provider-test.c
index 122ba52..3c58b26 100644
--- a/tests/libtracker-miner/tracker-password-provider-test.c
+++ b/tests/libtracker-miner/tracker-password-provider-test.c
@@ -88,25 +88,48 @@ test_password_provider_getting (void)
g_assert_cmpint (success, ==, TRUE);
}
+static gboolean
+test_log_failure_cb (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ /* Don't abort, we expect failure */
+ return FALSE;
+}
+
int
main (int argc, char **argv)
{
+ const gchar *current_dir;
+ gint retval;
+
g_type_init ();
g_thread_init (NULL);
g_test_init (&argc, &argv, NULL);
- g_test_message ("Testing password provider");
+ /* Set test environment up */
+ current_dir = g_get_current_dir ();
+ g_setenv ("XDG_CONFIG_HOME", current_dir, TRUE);
g_test_add_func ("/libtracker-miner/tracker-password-provider/setting",
test_password_provider_setting);
g_test_add_func ("/libtracker-miner/tracker-password-provider/getting",
test_password_provider_getting);
+ g_test_log_set_fatal_handler (test_log_failure_cb, NULL);
provider = tracker_password_provider_get ();
+ g_print ("Not aborting here because we expect no filename to exist yet\n");
g_assert (provider);
/* g_object_unref (provider); */
- return g_test_run ();
+ retval = g_test_run ();
+
+ /* clean up */
+ g_print ("Removing temporary data\n");
+ g_spawn_command_line_sync ("rm -R tracker/", NULL, NULL, NULL, NULL);
+
+ return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]