diff options
author | Dan Winship <danw@gnome.org> | 2014-10-10 13:44:54 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-10 13:44:54 -0400 |
commit | 60cce4004284242f0891160e21979a3027da6e0e (patch) | |
tree | a0f43e27c23b9bb5344aeef05492aa038051f834 /libnm/tests | |
parent | af8fb3da47be2545b9fc831c170441f2cdbd0f82 (diff) | |
download | NetworkManager-60cce4004284242f0891160e21979a3027da6e0e.tar.gz |
libnm: fix crash in nm_client_new_async(), add a test for it
nm_client_new_async() got broken in the NMManager split. Fix it, and
use it from one of the tests in test-nm-client to make sure it's
getting tested in the future.
Diffstat (limited to 'libnm/tests')
-rw-r--r-- | libnm/tests/test-nm-client.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c index 8f370df5de..e666551f49 100644 --- a/libnm/tests/test-nm-client.c +++ b/libnm/tests/test-nm-client.c @@ -681,9 +681,24 @@ da_devices_notify_cb (NMClient *c, } static void +new_client_cb (GObject *object, + GAsyncResult *result, + gpointer user_data) +{ + NMClient **out_client = user_data; + GError *error = NULL; + + *out_client = nm_client_new_finish (result, &error); + g_assert_no_error (error); + g_assert (*out_client != NULL); + + g_main_loop_quit (loop); +} + +static void test_devices_array (void) { - NMClient *client; + NMClient *client = NULL; DaInfo info = { loop }; char *paths[3] = { NULL, NULL, NULL }; NMDevice *device; @@ -692,8 +707,11 @@ test_devices_array (void) GVariant *ret; sinfo = nm_test_service_init (); - client = nm_client_new (NULL, &error); - g_assert_no_error (error); + + /* Make sure that we test the async codepath in at least one test... */ + nm_client_new_async (NULL, new_client_cb, &client); + g_main_loop_run (loop); + g_assert (client != NULL); /*************************************/ /* Add some devices */ |