[tracker/sam/functional-test-fixes: 12/12] WIP
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/functional-test-fixes: 12/12] WIP
- Date: Sun, 7 Dec 2014 20:55:21 +0000 (UTC)
commit 8383d0b927661e44e7d51d43622504a0bacfd293
Author: Sam Thursfield <sam afuera me uk>
Date: Wed Jul 30 10:23:33 2014 +0200
WIP
src/libtracker-miner/tracker-miner-fs.c | 20 +++++++++++++++-----
src/libtracker-miner/tracker-monitor.c | 13 +++++++++++++
src/miners/fs/tracker-main.c | 2 +-
src/miners/fs/tracker-writeback-dispatcher.c | 4 ++--
src/miners/fs/tracker-writeback-listener.c | 2 ++
tests/functional-tests/500-writeback.py | 12 ++++++------
tests/functional-tests/common/utils/helpers.py | 3 +++
.../functional-tests/common/utils/writebacktest.py | 12 +++++++++++-
tests/functional-tests/test-runner.sh | 2 +-
9 files changed, 54 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 6da1eca..99a93ed 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -45,6 +45,9 @@
#warning Tree debugging traces enabled
#endif /* CRAWLED_TREE_ENABLE_TRACE */
+
+#define EVENT_QUEUE_ENABLE_TRACE
+
/* If defined will print push/pop actions on queues */
#ifdef EVENT_QUEUE_ENABLE_TRACE
#warning Event Queue traces enabled
@@ -2121,7 +2124,9 @@ 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));
+ g_warning ("WRITEBACK: Popped %p from writeback queue (file %s)",
+ wdata,
+ wdata==NULL ? "none" : g_file_get_uri(wdata->file));
if (wdata) {
gboolean processing;
@@ -2733,12 +2738,16 @@ remove_writeback_task (TrackerMinerFS *fs,
task = tracker_task_pool_find (fs->priv->writeback_pool, file);
+ g_warning ("Remove writeback task for %p", task);
+
if (!task) {
return FALSE;
}
data = tracker_task_get_data (task);
+ g_warning ("Writeback file %s notified %i", g_file_get_uri(data->file), data->notified);
+
if (data->notified) {
tracker_task_pool_remove (fs->priv->writeback_pool, task);
tracker_task_unref (task);
@@ -2869,7 +2878,8 @@ check_item_queues (TrackerMinerFS *fs,
return TRUE;
case QUEUE_DELETED:
if (tracker_task_pool_find (fs->priv->writeback_pool, file)) {
- /* Cancel writeback operations on a deleted file */
+ g_debug (" File %s was deleted, cancelling writeback operation on deleted file %s",
+ g_file_get_uri(file));
cancel_writeback_task (fs, file);
}
@@ -2895,9 +2905,8 @@ check_item_queues (TrackerMinerFS *fs,
return TRUE;
case QUEUE_MOVED:
if (tracker_task_pool_find (fs->priv->writeback_pool, file)) {
- /* If the origin file is also being written back,
- * cancel it as this is an external operation.
- */
+ g_debug (" File %s was moved, cancelling writeback operation",
+ g_file_get_uri(file));
cancel_writeback_task (fs, file);
}
@@ -2999,6 +3008,7 @@ file_notifier_file_updated (TrackerFileNotifier *notifier,
*/
if (!attributes_only &&
remove_writeback_task (fs, file)) {
+ g_debug ("file_updated: ignoring %s because it was in the writeback queue",
g_file_get_uri(file));
item_queue_handlers_set_up (fs);
return;
}
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 96d9aa8..bfb8883 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -17,6 +17,19 @@
* Boston, MA 02110-1301, USA.
*/
+/*
+Here's a rough overview of how TrackerMonitor works!
+
+TrackerMonitor extends the GFileMonitor object provided by GIO. File monitoring is implemented differently
for each platform, and GIO abstracts several of these. The events it outputs are quite low-level and some
work needs to be done in order to achieve simple, accurate signals.
+
+A TrackerMonitor object is
+This is what TrackerMonitor provides.
+
+Notes:
+
+- I should make a plantUML diagram
+*/
+
#include "config.h"
#include <stdlib.h>
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index f428b5d..23e492f 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -102,7 +102,7 @@ static void
sanity_check_option_values (TrackerConfig *config)
{
g_message ("General options:");
- g_message (" Verbosity ............................ %d",
+ g_warning (" Verbosity ............................ %d",
tracker_config_get_verbosity (config));
g_message (" Sched Idle ........................... %d",
tracker_config_get_sched_idle (config));
diff --git a/src/miners/fs/tracker-writeback-dispatcher.c b/src/miners/fs/tracker-writeback-dispatcher.c
index 9a875a6..77b6e47 100644
--- a/src/miners/fs/tracker-writeback-dispatcher.c
+++ b/src/miners/fs/tracker-writeback-dispatcher.c
@@ -271,7 +271,7 @@ retry_idle (gpointer user_data)
{
WritebackFileData *data = user_data;
- g_warning ("retry_idle: running tracker_miner_fs_writeback_file(%s)", data->file);
+ g_warning ("retry_idle: running tracker_miner_fs_writeback_file(%s)", g_file_get_uri(data->file));
tracker_miner_fs_writeback_file (data->fs,
data->file,
@@ -306,7 +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);
+ g_warning ("writeback_file_finished: tracker_miner_fs_writeback_notify(%s, error %s)",
g_file_get_uri(data->file), error ? error->message : "None");
tracker_miner_fs_writeback_notify (data->fs, data->file, error);
writeback_file_data_free (data);
}
diff --git a/src/miners/fs/tracker-writeback-listener.c b/src/miners/fs/tracker-writeback-listener.c
index 2de1fca..b869bb6 100644
--- a/src/miners/fs/tracker-writeback-listener.c
+++ b/src/miners/fs/tracker-writeback-listener.c
@@ -150,6 +150,8 @@ writeback_listener_finalize (GObject *object)
{
TrackerWritebackListenerPrivate *priv = TRACKER_WRITEBACK_LISTENER_GET_PRIVATE (object);
+ g_warning ("!!!WRITEBACK_LISTENER_FINALIZE!!");
+
if (priv->connection && priv->d_signal) {
g_dbus_connection_signal_unsubscribe (priv->d_connection, priv->d_signal);
}
diff --git a/tests/functional-tests/500-writeback.py b/tests/functional-tests/500-writeback.py
index 1b90cc8..2d6659a 100755
--- a/tests/functional-tests/500-writeback.py
+++ b/tests/functional-tests/500-writeback.py
@@ -80,10 +80,9 @@ class WritebackBasicDataTest (CommonTrackerWritebackTest):
"""
self.__clean_property (prop, filename)
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)
+ results = get_tracker_extract_output (filename, mimetype)
keyDict = expectedKey or prop
self.assertIn (TEST_VALUE, results[keyDict])
self.__clean_property (prop, filename, False)
@@ -123,10 +122,11 @@ class WritebackBasicDataTest (CommonTrackerWritebackTest):
# 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")
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 8279c6d..15bf18e 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -190,6 +190,9 @@ class Helper:
self.abort_if_process_exits_with_status_0 = False
+ #raw_input ('%s process is %i; press ENTER to continue' %
+ # (self.PROCESS_NAME, self.process.pid))
+
def stop (self):
if self.available:
# It should step out of this loop when the miner disappear from the bus
diff --git a/tests/functional-tests/common/utils/writebacktest.py
b/tests/functional-tests/common/utils/writebacktest.py
index ff7f7fa..e716395 100644
--- a/tests/functional-tests/common/utils/writebacktest.py
+++ b/tests/functional-tests/common/utils/writebacktest.py
@@ -79,6 +79,16 @@ class CommonTrackerWritebackTest (ut.TestCase):
self.system.tracker_writeback_testing_start (CONF_OPTIONS)
+ def cb(*args):
+ print 'Received WRiteback signal, args' + str(args)
+ self.system.store.bus.add_signal_receiver (
+ cb, signal_name = 'Writeback', path = cfg.TRACKER_OBJ_PATH,
+ dbus_interface = cfg.RESOURCES_IFACE)
+
+ # FIXME: seems that if the miner-fs starts but crashes in this
+ # function no error is raised and the function carries on waiting
+ # for the resource until it gives up. Misleading!
+
def await_resource_extraction(url):
# Make sure a resource has been crawled by the FS miner and by
# tracker-extract. The extractor adds nie:contentCreated for
@@ -92,7 +102,7 @@ class CommonTrackerWritebackTest (ut.TestCase):
# Returns when ready
log ("Ready to go!")
-
+
@classmethod
def tearDownClass (self):
#print "Stopping the daemon in test mode (Doing nothing now)"
diff --git a/tests/functional-tests/test-runner.sh b/tests/functional-tests/test-runner.sh
index 24c0e42..73d119c 100755
--- a/tests/functional-tests/test-runner.sh
+++ b/tests/functional-tests/test-runner.sh
@@ -36,4 +36,4 @@ else
kill $DBUS_SESSION_BUS_PID
fi ;
-rm -R $TEMP_DIR
+#rm -R $TEMP_DIR
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]