[tracker/sam/functional-test-fixes: 2/12] functional-tests: Name all main loop timeout sources



commit 9c1c9cf263625b1f0c5ef6c35023bc9c9ced9fc6
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Jul 20 13:32:35 2014 +0100

    functional-tests: Name all main loop timeout sources
    
    This makes it easier to debug when one is double removed.
    
    The GLib.Source.set_name_by_id() function is in GLib 2.26 and later.

 tests/functional-tests/common/utils/helpers.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index e4711be..5188570 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -158,6 +158,9 @@ class Helper:
         self.timeout_id = None
         return False
 
+    def _name_source (self, source_id, name):
+        name = '%s-%s' % (self.PROCESS_NAME, name)
+        GLib.Source.set_name_by_id (source_id, name)
 
     def start (self):
         """
@@ -178,6 +181,7 @@ class Helper:
         log ('[%s] Started process %i' % (self.PROCESS_NAME, self.process.pid))
 
         self.process_watch_timeout = GLib.timeout_add (200, self._process_watch_cb)
+        self._name_source (self.process_watch_timeout, 'process-watch')
 
         self.abort_if_process_exits_with_status_0 = True
 
@@ -193,6 +197,7 @@ class Helper:
 
             GLib.idle_add (self._stop_process)
             self.timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT, self._timeout_on_idle_cb)
+            self._name_source (self.timeout_id, 'idle-timeout')
             self.loop.run ()
             if self.timeout_id is not None:
                 GLib.source_remove(self.timeout_id)
@@ -308,6 +313,8 @@ class StoreHelper (Helper):
         """
         Block until a resource matching the parameters becomes available
         """
+        self._name_source (self.graph_updated_timeout_id, 'await-change-timeout')
+
         assert (self.inserts_match_function == None)
 
         self.matched_resource_urn = None
@@ -526,6 +533,8 @@ class StoreHelper (Helper):
             raise Exception ("Multiple entries for resource %s" % uri)
 
     # FIXME: rename to get_resource_id_by_nepomuk_url !!
+
+
     def get_resource_id(self, url):
         """
         Get the internal ID for a given resource, identified by URL.
@@ -608,6 +617,7 @@ class MinerFsHelper (Helper):
                                                           path=cfg.MINERFS_OBJ_PATH,
                                                           dbus_interface=cfg.MINER_IFACE)
         self.timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT, self._timeout_on_idle_cb)
+        self._name_source (self.timeout_id, 'wait-for-idle-timeout')
 
         self.loop.run ()
 


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