[tracker/checkpoint: 10/17] libtracker-data, tests: Fix failing unit tests



commit e2f02d81490d60419b6ee78b70dc865e4adccc49
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Jun 24 12:59:35 2011 +0200

    libtracker-data, tests: Fix failing unit tests

 src/libtracker-data/tracker-data-backup.c   |    3 +++
 tests/libtracker-data/tracker-backup-test.c |    4 ++++
 tests/libtracker-data/tracker-db-journal.c  |    9 +++++++++
 3 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 9f38bd9..d2597ba 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -600,6 +600,9 @@ tracker_data_backup_restore (GFile                *journal,
 		g_free (tmp_stdout);
 		g_strfreev (argv);
 #else
+		/* Turn off force-reindex here, no journal to replay so it wouldn't work */
+		flags &= ~TRACKER_DB_MANAGER_FORCE_REINDEX;
+
 		g_file_copy (info->journal, info->destination,
 		             G_FILE_COPY_OVERWRITE, 
 		             NULL, NULL, NULL,
diff --git a/tests/libtracker-data/tracker-backup-test.c b/tests/libtracker-data/tracker-backup-test.c
index 6b23ba3..e806a02 100644
--- a/tests/libtracker-data/tracker-backup-test.c
+++ b/tests/libtracker-data/tracker-backup-test.c
@@ -153,6 +153,7 @@ test_backup_and_restore_helper (gboolean journal)
 	g_unlink (meta_db);
 	g_free (meta_db);
 
+#ifndef DISABLE_JOURNAL
 	if (!journal) {
 		meta_db = g_build_path (G_DIR_SEPARATOR_S, db_location, "data", "tracker-store.journal", NULL);
 		g_unlink (meta_db);
@@ -162,12 +163,15 @@ test_backup_and_restore_helper (gboolean journal)
 		g_unlink (meta_db);
 		g_free (meta_db);
 	}
+#endif /* DISABLE_JOURNAL */
 
 	meta_db = g_build_path (G_DIR_SEPARATOR_S, db_location, "data", ".meta.isrunning", NULL);
 	g_unlink (meta_db);
 	g_free (meta_db);
 
+#ifndef DISABLE_JOURNAL
 	tracker_db_journal_set_rotating (FALSE, G_MAXSIZE, NULL);
+#endif /* DISABLE_JOURNAL */
 
 	tracker_data_manager_init (TRACKER_DB_MANAGER_FORCE_REINDEX,
 	                           (const gchar **) test_schemas,
diff --git a/tests/libtracker-data/tracker-db-journal.c b/tests/libtracker-data/tracker-db-journal.c
index 2729625..6bfdf50 100644
--- a/tests/libtracker-data/tracker-db-journal.c
+++ b/tests/libtracker-data/tracker-db-journal.c
@@ -17,12 +17,16 @@
  * Boston, MA  02110-1301, USA.
  */
 
+#include <config.h>
+
 #include <glib/gstdio.h>
 
 #include <libtracker-common/tracker-crc32.h>
 
 #include <libtracker-data/tracker-db-journal.h>
 
+#ifndef DISABLE_JOURNAL
+
 static void
 test_init_and_shutdown (void)
 {
@@ -353,6 +357,8 @@ test_read_functions (void)
 	g_free (path);
 }
 
+#endif /* DISABLE_JOURNAL */
+
 int
 main (int argc, char **argv) 
 {
@@ -363,12 +369,15 @@ main (int argc, char **argv)
 	g_thread_init (NULL);
 	g_test_init (&argc, &argv, NULL);
 
+#ifndef DISABLE_JOURNAL
+	/* None of these tests make sense in case of disabled journal */
 	g_test_add_func ("/libtracker-db/tracker-db-journal/init-and-shutdown",
 	                 test_init_and_shutdown);
 	g_test_add_func ("/libtracker-db/tracker-db-journal/write-functions",
 	                 test_write_functions);
 	g_test_add_func ("/libtracker-db/tracker-db-journal/read-functions",
 	                 test_read_functions);
+#endif /* DISABLE_JOURNAL */
 
 	result = g_test_run ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]