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



commit 73134b4b199b60c15b0440766b551d62f445608d
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 ab91c0a..6bb200a 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)
@@ -357,6 +362,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
@@ -402,6 +408,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
@@ -551,6 +558,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)
@@ -583,6 +591,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]