diff options
| author | Till Kamppeter <till.kamppeter@gmail.com> | 2019-07-15 14:28:16 +0200 |
|---|---|---|
| committer | Till Kamppeter <till.kamppeter@gmail.com> | 2019-07-15 14:28:16 +0200 |
| commit | a76f039b26099081a07a2b3a76e96c49c3599bc4 (patch) | |
| tree | 2dc34ca7bf14d8aa700245ad328c552fe4ea6b5b | |
| parent | 40a02f6911c35bc60260f9a8cbe0edf4763cef69 (diff) | |
nm.py autopkgtest: Improved timers of the main loops further.
| -rwxr-xr-x | debian/tests/nm.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/debian/tests/nm.py b/debian/tests/nm.py index 8316e087..d9b58b70 100755 --- a/debian/tests/nm.py +++ b/debian/tests/nm.py @@ -277,21 +277,25 @@ class NetworkManagerTest(network_test_base.NetworkTestBase): if (self.timeout_tag > 0): GLib.source_remove(self.timeout_tag) self.timeout_tag = 0 - if (not self.cancel.is_cancelled()): + try: self.cb_conn = \ self.nmclient.add_and_activate_connection_finish(res) + except gi.repository.GLib.Error as e: + # Check if the error is "Operation was cancelled" + if (e.domain != "g-io-error-quark" or e.code != 19): + self.fail("add_and_activate_connection failed: %s (%s, %d)" % + (e.message, e.domain, e.code)) ml.quit() def timeout_cb(): - self.cancel.cancel() self.timeout_tag = -1 + self.cancel.cancel() ml.quit() return GLib.SOURCE_REMOVE self.nmclient.add_and_activate_connection_async(partial_conn, self.nmdev_w, ap.get_path(), self.cancel, add_activate_cb, None) self.timeout_tag = GLib.timeout_add_seconds(300, timeout_cb) ml.run() - self.cancel.reset() if (self.timeout_tag < 0): self.timeout_tag = 0 self.fail('Main loop for adding connection timed out!') @@ -696,21 +700,25 @@ Logs are in '%s'. When done, exit the shell. if (self.timeout_tag > 0): GLib.source_remove(self.timeout_tag) self.timeout_tag = 0 - if (not self.cancel.is_cancelled()): + try: self.cb_conn = \ self.nmclient.add_and_activate_connection_finish(res) + except gi.repository.GLib.Error as e: + # Check if the error is "Operation was cancelled" + if (e.domain != "g-io-error-quark" or e.code != 19): + self.fail("add_and_activate_connection failed: %s (%s, %d)" % + (e.message, e.domain, e.code)) ml.quit() def timeout_cb(): - self.cancel.cancel() self.timeout_tag = -1 + self.cancel.cancel() ml.quit() return GLib.SOURCE_REMOVE self.nmclient.add_and_activate_connection_async(partial_conn, self.nmdev_e, None, self.cancel, add_activate_cb, None) self.timeout_tag = GLib.timeout_add_seconds(300, timeout_cb) ml.run() - self.cancel.reset() if (self.timeout_tag < 0): self.timeout_tag = 0 self.fail('Main loop for adding connection timed out!') |