[tracker/sam/functional-test-fixes: 11/12] WIP
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/functional-test-fixes: 11/12] WIP
- Date: Sun, 7 Dec 2014 20:55:16 +0000 (UTC)
commit 4e3e70b58ad41d9fffbca9d5417bc25f20d509d7
Author: Sam Thursfield <sam afuera me uk>
Date: Sun Jul 27 17:35:01 2014 +0200
WIP
src/libtracker-miner/tracker-miner-fs.c | 5 +-
src/miners/fs/tracker-writeback-dispatcher.c | 5 +-
src/miners/fs/tracker-writeback-listener.c | 6 +-
src/tracker-store/tracker-resources.vala | 8 ++-
src/tracker-writeback/tracker-writeback.c | 5 +
tests/functional-tests/500-writeback.py | 110 ++++++++++----------
tests/functional-tests/common/utils/helpers.py | 1 +
.../functional-tests/common/utils/writebacktest.py | 3 +-
8 files changed, 83 insertions(+), 60 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index ec16669..6da1eca 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2121,6 +2121,7 @@ item_queue_get_next_file (TrackerMinerFS *fs,
/* Writeback items first */
wdata = tracker_priority_queue_pop (fs->priv->items_writeback,
&priority);
+ g_warning ("WRITEBACK: Popped %p from writeback queue (file %s)", wdata, g_file_get_uri(wdata->file));
if (wdata) {
gboolean processing;
@@ -2861,7 +2862,7 @@ check_item_queues (TrackerMinerFS *fs,
/* No consecutive writebacks for the same file */
if (tracker_priority_queue_find (fs->priv->items_writeback, NULL,
writeback_files_equal, file)) {
- g_debug (" Found previous unhandled WRITEBACK event");
+ g_warning (" Found previous unhandled WRITEBACK event");
return FALSE;
}
@@ -3487,7 +3488,7 @@ tracker_miner_fs_writeback_file (TrackerMinerFS *fs,
uri = g_file_get_uri (file);
- g_debug ("Performing write-back:'%s' (requested by application)", uri);
+ g_warning ("Performing write-back:'%s' (requested by application)", uri);
trace_eq_push_tail ("WRITEBACK", file, "Requested by application");
diff --git a/src/miners/fs/tracker-writeback-dispatcher.c b/src/miners/fs/tracker-writeback-dispatcher.c
index 1d7a1e2..9a875a6 100644
--- a/src/miners/fs/tracker-writeback-dispatcher.c
+++ b/src/miners/fs/tracker-writeback-dispatcher.c
@@ -271,6 +271,8 @@ retry_idle (gpointer user_data)
{
WritebackFileData *data = user_data;
+ g_warning ("retry_idle: running tracker_miner_fs_writeback_file(%s)", data->file);
+
tracker_miner_fs_writeback_file (data->fs,
data->file,
data->rdf_types,
@@ -304,6 +306,7 @@ writeback_file_finished (GObject *source_object,
data->retries++;
} else {
+ g_warning ("writeback_file_finished: tracker_miner_fs_writeback_notify(%s, error %s)",
data->file, error->message);
tracker_miner_fs_writeback_notify (data->fs, data->file, error);
writeback_file_data_free (data);
}
@@ -352,7 +355,7 @@ writeback_dispatcher_writeback_file (TrackerMinerFS *fs,
priv = TRACKER_WRITEBACK_DISPATCHER_GET_PRIVATE (self);
uri = g_file_get_uri (file);
- g_debug ("Performing write-back for '%s'", uri);
+ g_warning ("writeback_dispatcher_writeback_file: Performing write-back for '%s'", uri);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("(sasaas)"));
diff --git a/src/miners/fs/tracker-writeback-listener.c b/src/miners/fs/tracker-writeback-listener.c
index c7849b5..2de1fca 100644
--- a/src/miners/fs/tracker-writeback-listener.c
+++ b/src/miners/fs/tracker-writeback-listener.c
@@ -320,7 +320,7 @@ sparql_query_cb (GObject *object,
g_object_unref (cursor);
} else {
- g_message (" No files qualify for updates (%s)", error->message);
+ g_warning (" writeback-listener: No files qualify for updates (%s)", error->message);
g_error_free (error);
}
@@ -393,7 +393,7 @@ rdf_types_to_uris_cb (GObject *object,
trouble:
if (error) {
- g_message (" No files qualify for updates (%s)", error->message);
+ g_message (" writeback-listener: No files qualify for updates (%s)", error->message);
g_error_free (error);
}
query_data_free (data);
@@ -474,6 +474,8 @@ on_writeback_cb (GDBusConnection *connection,
TrackerWritebackListener *self = TRACKER_WRITEBACK_LISTENER (user_data);
DelayedLoopData *data = g_new (DelayedLoopData, 1);
+ g_warning ("on_writeback_cb(%s)", g_variant_print(parameters, FALSE));
+
data->self = g_object_ref (self);
g_variant_get (parameters, "(a{iai})", &data->iter1);
diff --git a/src/tracker-store/tracker-resources.vala b/src/tracker-store/tracker-resources.vala
index f0c57b6..019348b 100644
--- a/src/tracker-store/tracker-resources.vala
+++ b/src/tracker-store/tracker-resources.vala
@@ -228,12 +228,16 @@ public class Tracker.Resources : Object {
emit_graph_updated (cl);
}
+ warning ("on_emit_signals");
+
/* Reset counter */
Tracker.Events.get_total (true);
/* Writeback feature */
var writebacks = Tracker.Writeback.get_ready ();
+ warning ("%u writebacks", writebacks.size());
+
if (writebacks != null) {
var builder = new VariantBuilder ((VariantType) "a{iai}");
@@ -255,7 +259,9 @@ public class Tracker.Resources : Object {
builder.close ();
}
- writeback (builder.end ());
+ var sparams = builder.end();
+ warning ("Emitting writeback for %s", sparams.print(false));
+ writeback (sparams);
}
Tracker.Writeback.reset_ready ();
diff --git a/src/tracker-writeback/tracker-writeback.c b/src/tracker-writeback/tracker-writeback.c
index 0eb7b8d..f0447e4 100644
--- a/src/tracker-writeback/tracker-writeback.c
+++ b/src/tracker-writeback/tracker-writeback.c
@@ -527,12 +527,17 @@ handle_method_call_perform_writeback (TrackerController *controller,
GStrv rdf_types;
gchar *rdf_type = NULL;
GList *writeback_handlers = NULL;
+ gchar *args_debug;
priv = controller->priv;
results = g_ptr_array_new_with_free_func ((GDestroyNotify) g_strfreev);
g_variant_get (parameters, "(&sasaas)", &subject, &iter1, &iter2);
+ args_debug = g_variant_print(parameters, FALSE);
+ g_debug ("PerformWriteback(%s)", args_debug);
+ g_free (args_debug);
+
rdf_types_array = g_array_new (TRUE, TRUE, sizeof (gchar *));
while (g_variant_iter_loop (iter1, "&s", &rdf_type)) {
g_array_append_val (rdf_types_array, rdf_type);
diff --git a/tests/functional-tests/500-writeback.py b/tests/functional-tests/500-writeback.py
index cdd2b06..1b90cc8 100755
--- a/tests/functional-tests/500-writeback.py
+++ b/tests/functional-tests/500-writeback.py
@@ -29,7 +29,6 @@ from common.utils.writebacktest import CommonTrackerWritebackTest as CommonTrack
import unittest2 as ut
from common.utils.expectedFailure import expectedFailureBug
-REASONABLE_TIMEOUT = 5 # Seconds we wait for tracker-writeback to do the work
class WritebackBasicDataTest (CommonTrackerWritebackTest):
"""
@@ -83,8 +82,8 @@ class WritebackBasicDataTest (CommonTrackerWritebackTest):
self.tracker.update (SPARQL_TMPL % (prop, TEST_VALUE, filename))
self.wait_for_file_change(filename_real, initial_mtime)
-
results = get_tracker_extract_output (filename, mimetype)
+
keyDict = expectedKey or prop
self.assertIn (TEST_VALUE, results[keyDict])
self.__clean_property (prop, filename, False)
@@ -112,73 +111,78 @@ class WritebackBasicDataTest (CommonTrackerWritebackTest):
}
"""
- self.tracker.update (SPARQL_TMPL % (filename))
+ # FIXME: filename is actually a URI! :(
+ filename_real = filename[len('file://'):]
+ initial_mtime = os.stat(filename_real).st_mtime
- time.sleep (REASONABLE_TIMEOUT)
+ self.tracker.update (SPARQL_TMPL % (filename))
+ self.wait_for_file_change(filename_real, initial_mtime)
results = get_tracker_extract_output (filename, mimetype)
self.assertIn ("testTag", results ["nao:hasTag"])
# JPEG test
- def test_001_jpeg_title (self):
- #FILENAME = "test-writeback-monitored/writeback-test-1.jpeg"
- self.__writeback_test (self.get_test_filename_jpeg (), "image/jpeg", "nie:title")
-
+# def test_001_jpeg_title (self):
+# #FILENAME = "test-writeback-monitored/writeback-test-1.jpeg"
+# self.__writeback_test (self.get_test_filename_jpeg (), "image/jpeg", "nie:title")
+#
def test_002_jpeg_description (self):
#FILENAME = "test-writeback-monitored/writeback-test-1.jpeg"
self.__writeback_test (self.get_test_filename_jpeg (), "image/jpeg", "nie:description")
+ # This test fails but only if the first two tests run ... it's as if
+ # the writeback process gets tired after 2 works ...
def test_003_jpeg_keyword (self):
#FILENAME = "test-writeback-monitored/writeback-test-1.jpeg"
self.__writeback_test (self.get_test_filename_jpeg (), "image/jpeg",
"nie:keyword", "nao:hasTag")
- def test_004_jpeg_hasTag (self):
- #FILENAME = "test-writeback-monitored/writeback-test-1.jpeg"
- self.__writeback_hasTag_test (self.get_test_filename_jpeg (), "image/jpeg")
-
-
- # TIFF tests
- def test_011_tiff_title (self):
- #FILANAME = "test-writeback-monitored/writeback-test-2.tif"
- self.__writeback_test (self.get_test_filename_tiff (), "image/tiff", "nie:title")
-
- def test_012_tiff_description (self):
- FILENAME = "test-writeback-monitored/writeback-test-2.tif"
- self.__writeback_test (self.get_test_filename_tiff (), "image/tiff", "nie:description")
-
- def test_013_tiff_keyword (self):
- FILENAME = "test-writeback-monitored/writeback-test-2.tif"
- self.__writeback_test (self.get_test_filename_tiff (), "image/tiff",
- "nie:keyword", "nao:hasTag")
-
- def test_014_tiff_hasTag (self):
- FILENAME = "test-writeback-monitored/writeback-test-2.tif"
- self.__writeback_hasTag_test (self.get_test_filename_tiff (), "image/tiff")
-
-
-
- # PNG tests
- @expectedFailureBug ("NB#185070")
- def test_021_png_title (self):
- FILENAME = "test-writeback-monitored/writeback-test-4.png"
- self.__writeback_test (self.get_test_filaname_png (), "image/png", "nie:title")
-
- @expectedFailureBug ("NB#185070")
- def test_022_png_description (self):
- FILENAME = "test-writeback-monitored/writeback-test-4.png"
- self.__writeback_test (self.get_test_filaname_png (), "image/png", "nie:description")
-
- @expectedFailureBug ("NB#185070")
- def test_023_png_keyword (self):
- FILENAME = "test-writeback-monitored/writeback-test-4.png"
- self.__writeback_test (self.get_test_filaname_png (), "image/png", "nie:keyword",
"nao:hasTag:prefLabel")
-
- @expectedFailureBug("NB#185070")
- def test_024_png_hasTag (self):
- FILENAME = "test-writeback-monitored/writeback-test-4.png"
- self.__writeback_hasTag_test (self.get_test_filaname_png (), "image/png")
+# def test_004_jpeg_hasTag (self):
+# #FILENAME = "test-writeback-monitored/writeback-test-1.jpeg"
+# self.__writeback_hasTag_test (self.get_test_filename_jpeg (), "image/jpeg")
+#
+#
+# # TIFF tests
+# def test_011_tiff_title (self):
+# #FILANAME = "test-writeback-monitored/writeback-test-2.tif"
+# self.__writeback_test (self.get_test_filename_tiff (), "image/tiff", "nie:title")
+#
+# def test_012_tiff_description (self):
+# FILENAME = "test-writeback-monitored/writeback-test-2.tif"
+# self.__writeback_test (self.get_test_filename_tiff (), "image/tiff", "nie:description")
+#
+# def test_013_tiff_keyword (self):
+# FILENAME = "test-writeback-monitored/writeback-test-2.tif"
+# self.__writeback_test (self.get_test_filename_tiff (), "image/tiff",
+# "nie:keyword", "nao:hasTag")
+#
+# def test_014_tiff_hasTag (self):
+# FILENAME = "test-writeback-monitored/writeback-test-2.tif"
+# self.__writeback_hasTag_test (self.get_test_filename_tiff (), "image/tiff")
+#
+#
+#
+# # PNG tests
+# @expectedFailureBug ("NB#185070")
+# def test_021_png_title (self):
+# FILENAME = "test-writeback-monitored/writeback-test-4.png"
+# self.__writeback_test (self.get_test_filaname_png (), "image/png", "nie:title")
+#
+# @expectedFailureBug ("NB#185070")
+# def test_022_png_description (self):
+# FILENAME = "test-writeback-monitored/writeback-test-4.png"
+# self.__writeback_test (self.get_test_filaname_png (), "image/png", "nie:description")
+#
+# @expectedFailureBug ("NB#185070")
+# def test_023_png_keyword (self):
+# FILENAME = "test-writeback-monitored/writeback-test-4.png"
+# self.__writeback_test (self.get_test_filaname_png (), "image/png", "nie:keyword",
"nao:hasTag:prefLabel")
+#
+# @expectedFailureBug("NB#185070")
+# def test_024_png_hasTag (self):
+# FILENAME = "test-writeback-monitored/writeback-test-4.png"
+# self.__writeback_hasTag_test (self.get_test_filaname_png (), "image/png")
if __name__ == "__main__":
ut.main ()
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 5188570..8279c6d 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -637,3 +637,4 @@ class WritebackHelper (Helper):
PROCESS_NAME = 'tracker-writeback'
PROCESS_PATH = os.path.join (cfg.EXEC_PREFIX, 'tracker-writeback')
BUS_NAME = cfg.WRITEBACK_BUSNAME
+ FLAGS = ['--verbosity=3']
diff --git a/tests/functional-tests/common/utils/writebacktest.py
b/tests/functional-tests/common/utils/writebacktest.py
index ce6f2c7..ff7f7fa 100644
--- a/tests/functional-tests/common/utils/writebacktest.py
+++ b/tests/functional-tests/common/utils/writebacktest.py
@@ -44,6 +44,7 @@ CONF_OPTIONS = {
}
}
+WRITEBACK_TIME_LIMIT_SECONDS = 5
def uri (filename):
return "file://" + os.path.join (WRITEBACK_TMP_DIR, filename)
@@ -115,7 +116,7 @@ class CommonTrackerWritebackTest (ut.TestCase):
def wait_for_file_change (self, filename, initial_mtime):
start = time.time()
- while time.time() < start + 5:
+ while time.time() < start + WRITEBACK_TIME_LIMIT_SECONDS:
mtime = os.stat(filename).st_mtime
if mtime > initial_mtime:
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]