[tracker: 15/21] tests/libtracker-miner: Fix memory leaks
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 15/21] tests/libtracker-miner: Fix memory leaks
- Date: Sun, 17 Feb 2019 20:44:09 +0000 (UTC)
commit 6f01baa55c4d999048ce3729085d52dbc4422049
Author: Andrea Azzarone <andrea azzarone canonical com>
Date: Wed Jan 23 19:33:33 2019 +0000
tests/libtracker-miner: Fix memory leaks
tests/libtracker-miner/tracker-miner-fs-test.c | 376 +++++++++++++++++++------
1 file changed, 296 insertions(+), 80 deletions(-)
---
diff --git a/tests/libtracker-miner/tracker-miner-fs-test.c b/tests/libtracker-miner/tracker-miner-fs-test.c
index 17769f37d..c57579b27 100644
--- a/tests/libtracker-miner/tracker-miner-fs-test.c
+++ b/tests/libtracker-miner/tracker-miner-fs-test.c
@@ -45,11 +45,12 @@ test_miner_process_file (TrackerMinerFS *miner,
info = g_file_query_info (file, "standard::*,time::*", 0, NULL, &error);
g_assert_no_error (error);
- if (g_strcmp0 (tracker_miner_fs_get_urn (miner, file),
- tracker_miner_fs_query_urn (miner, file)) != 0) {
+ urn = tracker_miner_fs_query_urn (miner, file);
+ if (g_strcmp0 (tracker_miner_fs_get_urn (miner, file), urn) != 0) {
g_critical ("File %s did not get up to date URN",
g_file_get_uri (file));
}
+ g_free (urn);
resource = tracker_resource_new (tracker_miner_fs_get_urn (miner, file));
@@ -81,6 +82,7 @@ test_miner_process_file (TrackerMinerFS *miner,
tracker_miner_fs_notify_finish (miner, task, sparql, NULL);
g_object_unref (resource);
g_free (sparql);
+ g_object_unref (info);
return TRUE;
}
@@ -412,6 +414,8 @@ static void
test_recursive_indexing (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "recursive/1/2");
@@ -427,7 +431,8 @@ test_recursive_indexing (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/2,"
@@ -435,12 +440,15 @@ test_recursive_indexing (TrackerMinerFSTestFixture *fixture,
"recursive/1/a,"
"recursive/1/b,"
"recursive/1/empty");
+ g_free (content);
}
static void
test_non_recursive_indexing (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "non-recursive");
CREATE_FOLDER (fixture, "non-recursive/1");
CREATE_FOLDER (fixture, "non-recursive/1/2");
@@ -455,17 +463,21 @@ test_non_recursive_indexing (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/1,"
"non-recursive/a,"
"non-recursive/empty");
+ g_free (content);
}
static void
test_separate_recursive_and_non_recursive (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "recursive/1/2");
@@ -487,7 +499,8 @@ test_separate_recursive_and_non_recursive (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/1,"
"non-recursive/a,"
@@ -496,12 +509,15 @@ test_separate_recursive_and_non_recursive (TrackerMinerFSTestFixture *fixture,
"recursive/1/2,"
"recursive/1/b,"
"recursive/a");
+ g_free (content);
}
static void
test_recursive_in_non_recursive (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "non-recursive");
CREATE_FOLDER (fixture, "non-recursive/1");
CREATE_FOLDER (fixture, "non-recursive/1/recursive");
@@ -521,7 +537,8 @@ test_recursive_in_non_recursive (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/1,"
"non-recursive/1/recursive,"
@@ -529,12 +546,15 @@ test_recursive_in_non_recursive (TrackerMinerFSTestFixture *fixture,
"non-recursive/1/recursive/2/d,"
"non-recursive/1/recursive/c,"
"non-recursive/a");
+ g_free (content);
}
static void
test_non_recursive_in_recursive (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "recursive/1/non-recursive");
@@ -554,7 +574,8 @@ test_non_recursive_in_recursive (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/b,"
@@ -562,12 +583,15 @@ test_non_recursive_in_recursive (TrackerMinerFSTestFixture *fixture,
"recursive/1/non-recursive/2,"
"recursive/1/non-recursive/c,"
"recursive/a");
+ g_free (content);
}
static void
test_empty_root (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "empty");
fixture_add_indexed_folder (fixture, "empty",
@@ -578,13 +602,17 @@ test_empty_root (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==, "empty");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "empty");
+ g_free (content);
}
static void
test_missing_root (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
fixture_add_indexed_folder (fixture, "missing",
TRACKER_DIRECTORY_FLAG_CHECK_MTIME |
TRACKER_DIRECTORY_FLAG_RECURSE);
@@ -593,7 +621,9 @@ test_missing_root (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==, "");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "");
+ g_free (content);
}
static void
@@ -601,6 +631,7 @@ test_skip_hidden_files (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
@@ -620,15 +651,19 @@ test_skip_hidden_files (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1");
+ g_free (content);
}
static void
test_index_hidden_files (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "recursive/1/.hidden");
@@ -644,13 +679,15 @@ test_index_hidden_files (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/.hidden-file,"
"recursive/1,"
"recursive/1/.hidden,"
"recursive/1/.hidden/2,"
"recursive/1/.hidden/2/a");
+ g_free (content);
}
static void
@@ -658,6 +695,7 @@ test_file_filter_default_accept (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/aa");
@@ -681,12 +719,14 @@ test_file_filter_default_accept (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/aa,"
"recursive/aa/b2,"
"recursive/bb,"
"recursive/bb/bb");
+ g_free (content);
}
static void
@@ -694,6 +734,7 @@ test_file_filter_default_deny (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/aa");
@@ -717,12 +758,14 @@ test_file_filter_default_deny (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/aa,"
"recursive/aa/a1,"
"recursive/bb,"
"recursive/bb/ab");
+ g_free (content);
}
static void
@@ -730,6 +773,7 @@ test_directory_filter_default_accept (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/aa");
@@ -753,11 +797,13 @@ test_directory_filter_default_accept (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/bb,"
"recursive/bb/ab,"
"recursive/bb/bb");
+ g_free (content);
}
static void
@@ -765,6 +811,7 @@ test_directory_filter_default_deny (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/aa");
@@ -791,11 +838,13 @@ test_directory_filter_default_deny (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/aa,"
"recursive/aa/a1,"
"recursive/aa/b2");
+ g_free (content);
}
static void
@@ -803,6 +852,7 @@ test_content_filter_default_accept (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/aa");
@@ -828,12 +878,14 @@ test_content_filter_default_accept (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/aa,"
"recursive/bb,"
"recursive/bb/ab,"
"recursive/bb/bb");
+ g_free (content);
}
static void
@@ -841,6 +893,7 @@ test_content_filter_default_deny (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/aa");
@@ -867,7 +920,8 @@ test_content_filter_default_deny (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/aa,"
"recursive/aa/a1,"
@@ -875,6 +929,7 @@ test_content_filter_default_deny (TrackerMinerFSTestFixture *fixture,
"recursive/aa/b2,"
"recursive/allow,"
"recursive/bb");
+ g_free (content);
}
static void
@@ -882,6 +937,7 @@ test_content_filter_on_parent_root (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
TrackerIndexingTree *indexing_tree;
+ gchar *content;
CREATE_FOLDER (fixture, "non-recursive");
CREATE_FOLDER (fixture, "non-recursive/recursive");
@@ -909,12 +965,14 @@ test_content_filter_on_parent_root (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/recursive,"
"non-recursive/recursive/a,"
"non-recursive/recursive/a/d,"
"non-recursive/recursive/c");
+ g_free (content);
/* Check it is ok after the content is already indexed. All
* files should stay and no events should be generated as
@@ -936,12 +994,14 @@ test_content_filter_on_parent_root (TrackerMinerFSTestFixture *fixture,
test_miner_reset_counters ((TestMiner *) fixture->miner);
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/recursive,"
"non-recursive/recursive/a,"
"non-recursive/recursive/a/d,"
"non-recursive/recursive/c");
+ g_free (content);
g_assert_cmpint (((TestMiner *) fixture->miner)->n_events, ==, 0);
}
@@ -950,6 +1010,8 @@ static void
test_non_monitored_create (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -962,9 +1024,11 @@ test_non_monitored_create (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
fixture_remove_indexed_folder (fixture, "recursive");
@@ -978,18 +1042,22 @@ test_non_monitored_create (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a,"
"recursive/b,"
"recursive/new,"
"recursive/new/c");
+ g_free (content);
}
static void
test_non_monitored_update (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1002,9 +1070,11 @@ test_non_monitored_update (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
fixture_remove_indexed_folder (fixture, "recursive");
test_miner_reset_counters ((TestMiner *) fixture->miner);
@@ -1022,15 +1092,19 @@ test_non_monitored_update (TrackerMinerFSTestFixture *fixture,
g_assert_cmpint (((TestMiner *) fixture->miner)->n_process_file, >=, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
test_non_monitored_delete (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "recursive/1/2");
@@ -1049,7 +1123,8 @@ test_non_monitored_delete (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/2,"
@@ -1057,6 +1132,7 @@ test_non_monitored_delete (TrackerMinerFSTestFixture *fixture,
"recursive/1/2/3/c,"
"recursive/1/2/b,"
"recursive/a");
+ g_free (content);
fixture_remove_indexed_folder (fixture, "recursive");
@@ -1070,15 +1146,19 @@ test_non_monitored_delete (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1");
+ g_free (content);
}
static void
test_non_monitored_move (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "non-recursive");
@@ -1103,7 +1183,8 @@ test_non_monitored_move (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/2,"
"recursive,"
@@ -1111,6 +1192,7 @@ test_non_monitored_move (TrackerMinerFSTestFixture *fixture,
"recursive/1/b,"
"recursive/a,"
"recursive/d");
+ g_free (content);
fixture_remove_indexed_folder (fixture, "recursive");
fixture_remove_indexed_folder (fixture, "non-recursive");
@@ -1130,19 +1212,23 @@ test_non_monitored_move (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/3,"
"non-recursive/e,"
"recursive,"
"recursive/4,"
"recursive/4/c");
+ g_free (content);
}
static void
test_monitored_create (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1155,9 +1241,11 @@ test_monitored_create (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
CREATE_FOLDER (fixture, "recursive/new");
CREATE_UPDATE_FILE (fixture, "recursive/b");
@@ -1165,18 +1253,22 @@ test_monitored_create (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a,"
"recursive/b,"
"recursive/new,"
"recursive/new/c");
+ g_free (content);
}
static void
test_monitored_update (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1189,9 +1281,11 @@ test_monitored_update (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
test_miner_reset_counters ((TestMiner *) fixture->miner);
@@ -1201,15 +1295,18 @@ test_monitored_update (TrackerMinerFSTestFixture *fixture,
g_assert_cmpint (((TestMiner *) fixture->miner)->n_process_file, ==, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
test_monitored_delete (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
gint n_tries = 0;
CREATE_FOLDER (fixture, "recursive");
@@ -1230,7 +1327,8 @@ test_monitored_delete (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/2,"
@@ -1238,6 +1336,7 @@ test_monitored_delete (TrackerMinerFSTestFixture *fixture,
"recursive/1/2/3/c,"
"recursive/1/2/b,"
"recursive/a");
+ g_free (content);
DELETE_FOLDER (fixture, "recursive/1/2");
@@ -1251,24 +1350,29 @@ test_monitored_delete (TrackerMinerFSTestFixture *fixture,
n_tries++;
}
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/a");
+ g_free (content);
DELETE_FILE (fixture, "recursive/a");
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1");
+ g_free (content);
}
static void
test_monitored_move (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
gint n_tries = 0;
CREATE_FOLDER (fixture, "recursive");
@@ -1295,7 +1399,8 @@ test_monitored_move (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/2,"
"recursive,"
@@ -1303,6 +1408,7 @@ test_monitored_move (TrackerMinerFSTestFixture *fixture,
"recursive/1/b,"
"recursive/a,"
"recursive/d");
+ g_free (content);
MOVE_FILE (fixture, "recursive/a", "non-recursive/e");
MOVE_FILE (fixture, "recursive/1", "non-recursive/3");
@@ -1315,19 +1421,23 @@ test_monitored_move (TrackerMinerFSTestFixture *fixture,
n_tries++;
}
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"non-recursive,"
"non-recursive/3,"
"non-recursive/e,"
"recursive,"
"recursive/4,"
"recursive/4/c");
+ g_free (content);
}
static void
test_monitored_atomic_replace (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1341,23 +1451,29 @@ test_monitored_atomic_replace (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
UPDATE_FILE_ATOMIC (fixture, "recursive/a", "recursive/b");
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
test_changes_after_no_mtime_check (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "recursive/1");
CREATE_FOLDER (fixture, "recursive/1/2");
@@ -1374,12 +1490,14 @@ test_changes_after_no_mtime_check (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/2,"
"recursive/1/2/b,"
"recursive/a");
+ g_free (content);
fixture_remove_indexed_folder (fixture, "recursive");
@@ -1392,12 +1510,14 @@ test_changes_after_no_mtime_check (TrackerMinerFSTestFixture *fixture,
TRACKER_DIRECTORY_FLAG_RECURSE);
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/2,"
"recursive/1/2/b,"
"recursive/a");
+ g_free (content);
CREATE_UPDATE_FILE (fixture, "recursive/1/3/c");
CREATE_UPDATE_FILE (fixture, "recursive/1/2");
@@ -1406,7 +1526,8 @@ test_changes_after_no_mtime_check (TrackerMinerFSTestFixture *fixture,
while (!fixture_query_exists (fixture, "recursive/c"))
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/1,"
"recursive/1/2,"
@@ -1415,12 +1536,15 @@ test_changes_after_no_mtime_check (TrackerMinerFSTestFixture *fixture,
"recursive/1/3/c,"
"recursive/a,"
"recursive/c");
+ g_free (content);
}
static void
test_event_queue_create_and_update (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
fixture_add_indexed_folder (fixture, "recursive",
@@ -1432,7 +1556,9 @@ test_event_queue_create_and_update (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==, "recursive");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "recursive");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1441,23 +1567,28 @@ test_event_queue_create_and_update (TrackerMinerFSTestFixture *fixture,
UPDATE_FILE_ATOMIC (fixture, "recursive/a", "recursive/b");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
- "recursive");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "recursive");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
g_assert_cmpint (((TestMiner *) fixture->miner)->n_process_file, ==, 1);
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
test_event_queue_create_and_delete (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
fixture_add_indexed_folder (fixture, "recursive",
@@ -1469,7 +1600,9 @@ test_event_queue_create_and_delete (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==, "recursive");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "recursive");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1489,6 +1622,8 @@ static void
test_event_queue_create_and_move (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
fixture_add_indexed_folder (fixture, "recursive",
@@ -1500,7 +1635,9 @@ test_event_queue_create_and_move (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==, "recursive");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "recursive");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1509,22 +1646,27 @@ test_event_queue_create_and_move (TrackerMinerFSTestFixture *fixture,
MOVE_FILE (fixture, "recursive/a", "recursive/b");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
- "recursive");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "recursive");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/b");
+ g_free (content);
}
static void
test_event_queue_update_and_update (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1537,9 +1679,11 @@ test_event_queue_update_and_update (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
test_miner_reset_counters ((TestMiner *) fixture->miner);
@@ -1550,9 +1694,11 @@ test_event_queue_update_and_update (TrackerMinerFSTestFixture *fixture,
MOVE_FILE (fixture, "b", "recursive/a");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
@@ -1560,15 +1706,19 @@ test_event_queue_update_and_update (TrackerMinerFSTestFixture *fixture,
/* Coalescing desirable, but not mandatory */
g_assert_cmpint (((TestMiner *) fixture->miner)->n_process_file, >=, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
test_event_queue_update_and_delete (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1581,9 +1731,11 @@ test_event_queue_update_and_delete (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1592,22 +1744,27 @@ test_event_queue_update_and_delete (TrackerMinerFSTestFixture *fixture,
DELETE_FILE (fixture, "recursive/a");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
- "recursive");
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==, "recursive");
+ g_free (content);
}
static void
test_event_queue_update_and_move (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1620,9 +1777,11 @@ test_event_queue_update_and_move (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1632,23 +1791,29 @@ test_event_queue_update_and_move (TrackerMinerFSTestFixture *fixture,
MOVE_FILE (fixture, "recursive/a", "recursive/b");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/b");
+ g_free (content);
}
static void
test_event_queue_delete_and_create (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1661,9 +1826,11 @@ test_event_queue_delete_and_create (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1672,23 +1839,29 @@ test_event_queue_delete_and_create (TrackerMinerFSTestFixture *fixture,
CREATE_UPDATE_FILE (fixture, "recursive/a");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
test_event_queue_move_and_update (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1701,9 +1874,11 @@ test_event_queue_move_and_update (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1714,24 +1889,30 @@ test_event_queue_move_and_update (TrackerMinerFSTestFixture *fixture,
UPDATE_FILE_ATOMIC (fixture, "recursive/b", "c");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
g_assert_cmpint (((TestMiner *) fixture->miner)->n_process_file, ==, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/b");
+ g_free (content);
}
static void
test_event_queue_move_and_create_origin (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1744,9 +1925,11 @@ test_event_queue_move_and_create_origin (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1755,24 +1938,30 @@ test_event_queue_move_and_create_origin (TrackerMinerFSTestFixture *fixture,
CREATE_UPDATE_FILE (fixture, "recursive/a");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a,"
"recursive/b");
+ g_free (content);
}
static void
test_event_queue_move_and_delete (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1785,9 +1974,11 @@ test_event_queue_move_and_delete (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1796,22 +1987,28 @@ test_event_queue_move_and_delete (TrackerMinerFSTestFixture *fixture,
DELETE_FILE (fixture, "recursive/b");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive");
+ g_free (content);
}
static void
test_event_queue_move_and_move (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1824,9 +2021,11 @@ test_event_queue_move_and_move (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1835,23 +2034,29 @@ test_event_queue_move_and_move (TrackerMinerFSTestFixture *fixture,
MOVE_FILE (fixture, "recursive/b", "recursive/c");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/c");
+ g_free (content);
}
static void
test_event_queue_move_and_move_back (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
+ gchar *content;
+
CREATE_FOLDER (fixture, "recursive");
CREATE_UPDATE_FILE (fixture, "recursive/a");
@@ -1864,9 +2069,11 @@ test_event_queue_move_and_move_back (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_pause (TRACKER_MINER (fixture->miner));
@@ -1875,17 +2082,21 @@ test_event_queue_move_and_move_back (TrackerMinerFSTestFixture *fixture,
MOVE_FILE (fixture, "recursive/b", "recursive/a");
fixture_iterate_filter (fixture, 1);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
tracker_miner_resume (TRACKER_MINER (fixture->miner));
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
}
static void
@@ -1893,6 +2104,7 @@ test_api_check_file (TrackerMinerFSTestFixture *fixture,
gconstpointer data)
{
GFile *file;
+ gchar *content;
CREATE_FOLDER (fixture, "recursive");
CREATE_FOLDER (fixture, "not-indexed");
@@ -1909,9 +2121,11 @@ test_api_check_file (TrackerMinerFSTestFixture *fixture,
fixture_iterate (fixture);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"recursive,"
"recursive/a");
+ g_free (content);
test_miner_reset_counters ((TestMiner *) fixture->miner);
@@ -1931,10 +2145,12 @@ test_api_check_file (TrackerMinerFSTestFixture *fixture,
g_assert_cmpint (((TestMiner *) fixture->miner)->n_process_file, ==, 2);
- g_assert_cmpstr (fixture_get_content (fixture), ==,
+ content = fixture_get_content (fixture);
+ g_assert_cmpstr (content, ==,
"not-indexed/b,"
"recursive,"
"recursive/a");
+ g_free (content);
}
gint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]