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



commit d83b09702fd7f139fd4385903da34dc6f62cb321
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 |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 1d6b98a..1cee3b1 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -127,6 +127,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):
         """
@@ -147,6 +150,7 @@ class Helper:
 
         # Run the loop until the bus name appears, or the process dies.
         self.process_watch_timeout = GLib.timeout_add (200, self._process_watch_cb)
+        self._name_source (self.process_watch_timeout, 'process-watch')
 
         self.loop.run ()
 
@@ -157,6 +161,7 @@ class Helper:
             # It should step out of this loop when the miner disappear from the bus
             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)
@@ -321,6 +326,7 @@ class StoreHelper (Helper):
         if not existing_match:
             self.graph_updated_timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT,
                                                                       self._graph_updated_timeout_cb)
+            GLib.Source.set_name_by_id (self.graph_updated_timeout_id, 'await-insert-graph-updated-timeout')
             self.inserts_match_function = match_cb
 
             # Run the event loop until the correct notification arrives
@@ -366,6 +372,7 @@ class StoreHelper (Helper):
         if not existing_match:
             self.graph_updated_timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT,
                                                                       self._graph_updated_timeout_cb)
+            GLib.Source.set_name_by_id (self.graph_updated_timeout_id, 'await-removal-graph-updated-timeout')
             self.deletes_match_function = match_cb
 
             # Run the event loop until the correct notification arrives
@@ -515,6 +522,7 @@ class MinerFsHelper (Helper):
 
         # It should step out of this loop after progress changes to "Idle"
         self.timeout_id = GLib.timeout_add_seconds (REASONABLE_TIMEOUT, self._timeout_on_idle_cb)
+        self._name_source (self.timeout_id, 'initial-idle-timeout')
         self.loop.run ()
         if self.timeout_id is not None:
             GLib.source_remove (self.timeout_id)
@@ -547,6 +555,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]