Till Kamppeter has proposed merging ~till-kamppeter/network-manager:master into 
network-manager:master.

Commit message:
nm.py autopkgtest: Added timers to make the main loops time out if the 
asynchronous processes do not finish.

Requested reviews:
  Network-manager (network-manager)

For more details, see:
https://code.launchpad.net/~till-kamppeter/network-manager/+git/network-manager/+merge/369586

This change avoids that in case of failure of the asynchronous operations the 
script does not get stuck in the main loop making the autopkgtest application 
killing it after hours and without clue about what went wrong. If the 
asynchronous operations do not finish withing 5 minutes the main loops which 
wait for them are stopped by timer.
This does not influence the probability of a test passing or failing due to 
tasks completing too slowly. It only improves debuggability.
-- 
Your team Network-manager is requested to review the proposed merge of 
~till-kamppeter/network-manager:master into network-manager:master.
diff --git a/debian/tests/nm.py b/debian/tests/nm.py
index 5037daa..ab3571d 100755
--- a/debian/tests/nm.py
+++ b/debian/tests/nm.py
@@ -274,8 +274,16 @@ class NetworkManagerTest(network_test_base.NetworkTestBase):
         def add_activate_cb(client, res, data):
             self.cb_conn = self.nmclient.add_and_activate_connection_finish(res)
             ml.quit()
+
+        def timeout_cb():
+            print("Main loop timed out!")
+            ml.quit()
+            return False
+
         self.nmclient.add_and_activate_connection_async(partial_conn, self.nmdev_w, ap.get_path(), None, add_activate_cb, None)
+        timeout_tag = GLib.timeout_add_seconds(300, timeout_cb)
         ml.run()
+        GLib.source_remove(timeout_tag)
         self.assertNotEqual(self.cb_conn, None)
         active_conn = self.cb_conn
         self.cb_conn = None
@@ -674,8 +682,16 @@ Logs are in '%s'. When done, exit the shell.
             def add_activate_cb(client, res, data):
                 self.cb_conn = self.nmclient.add_and_activate_connection_finish(res)
                 ml.quit()
+
+            def timeout_cb():
+                print("Main loop timed out!")
+                ml.quit()
+                return False
+
             self.nmclient.add_and_activate_connection_async(partial_conn, self.nmdev_e, None, None, add_activate_cb, None)
+            timeout_tag = GLib.timeout_add_seconds(300, timeout_cb)
             ml.run()
+            GLib.source_remove(timeout_tag)
             self.assertNotEqual(self.cb_conn, None)
             active_conn = self.cb_conn
             self.cb_conn = None
-- 
ubuntu-desktop mailing list
ubuntu-desktop@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to