diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2016-03-17 17:12:30 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2016-03-17 17:37:06 +0100 |
commit | 84c42aac1b5b59c8c59d9df4a397f45d13abfdbf (patch) | |
tree | e99f8baf00ace3c87a56f492a80c2e9c49e0a6f6 /libnm | |
parent | 01732b87f6785c634d3a91c1d1e8785b95fca8aa (diff) | |
download | NetworkManager-84c42aac1b5b59c8c59d9df4a397f45d13abfdbf.tar.gz |
test-nm-client: fix the remaining counter
We're expecting four callbacks: a client::devices change,
client::active-connections change, client::activate callback,
and a device::active-connection change.
We only hook the second one in the callback to the first one, and
only if client::active-connections is not set already. If it is
(when running slowly in valgrind), we just decrement the counter.
However, as the counter is one less than it should be, it would
underflow and we wait forever* instead.
For the value of forever=20s, given that's the timeout of the
mockup service.
Diffstat (limited to 'libnm')
-rw-r--r-- | libnm/tests/test-nm-client.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c index 9e9d480eaf..107cc58871 100644 --- a/libnm/tests/test-nm-client.c +++ b/libnm/tests/test-nm-client.c @@ -1002,9 +1002,8 @@ client_devices_changed_cb (GObject *client, g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0.1"); - if (nm_device_get_active_connection (device)) - info->remaining--; - else { + if (!nm_device_get_active_connection (device)) { + info->remaining++; g_signal_connect (device, "notify::" NM_DEVICE_ACTIVE_CONNECTION, G_CALLBACK (device_ac_changed_cb), info); } @@ -1094,8 +1093,10 @@ test_activate_virtual (void) g_signal_connect (client, "notify::" NM_CLIENT_DEVICES, G_CALLBACK (client_devices_changed_cb), &info); - /* As with test_active_connections() above, except that now we're waiting - * for NMClient:devices to change rather than NMDevice:active-connections. + /* We're expecting a client::devices change, client::activate callback, + * and a device::active-connection change. + * The client::devices callback can hook a client::active-connections + * change and bump this if the property is not yet loaded. */ info.remaining = 3; |