summary refs log tree commit diff
path: root/src/libnm-client-impl/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnm-client-impl/tests')
-rw-r--r--src/libnm-client-impl/tests/test-libnm.c28
-rw-r--r--src/libnm-client-impl/tests/test-nm-client.c255
-rw-r--r--src/libnm-client-impl/tests/test-remote-settings-client.c44
-rw-r--r--src/libnm-client-impl/tests/test-secret-agent.c128
4 files changed, 268 insertions, 187 deletions
diff --git a/src/libnm-client-impl/tests/test-libnm.c b/src/libnm-client-impl/tests/test-libnm.c
index 29ffde97..0f600a4a 100644
--- a/src/libnm-client-impl/tests/test-libnm.c
+++ b/src/libnm-client-impl/tests/test-libnm.c
@@ -2280,18 +2280,18 @@ typedef struct {
 #define READ_VPN_DETAIL_DATA(...) ((ReadVpnDetailData[]){__VA_ARGS__})
 
 static gboolean
-_do_read_vpn_details_impl1(const char *             file,
+_do_read_vpn_details_impl1(const char              *file,
                            int                      line,
                            int                      memfd,
-                           char *                   mem,
+                           char                    *mem,
                            gsize                    len,
                            const ReadVpnDetailData *expected_data,
                            guint                    expected_data_len,
                            const ReadVpnDetailData *expected_secrets,
                            guint                    expected_secrets_len)
 {
-    gssize             written;
-    off_t              lseeked;
+    gssize                         written;
+    off_t                          lseeked;
     gs_unref_hashtable GHashTable *data    = NULL;
     gs_unref_hashtable GHashTable *secrets = NULL;
 
@@ -2312,11 +2312,11 @@ _do_read_vpn_details_impl1(const char *             file,
 #define _assert_hash(hash, expected, expected_len)                                            \
     G_STMT_START                                                                              \
     {                                                                                         \
-        GHashTable *             _hash         = (hash);                                      \
+        GHashTable              *_hash         = (hash);                                      \
         guint                    _expected_len = (expected_len);                              \
         const ReadVpnDetailData *_expected     = (expected);                                  \
         GHashTableIter           _iter;                                                       \
-        const char *             _k, *_v;                                                     \
+        const char              *_k, *_v;                                                     \
         guint                    _i;                                                          \
                                                                                               \
         g_assert(_hash);                                                                      \
@@ -2759,7 +2759,7 @@ test_types(void)
     for (i_type = 0; i_type < G_N_ELEMENTS(get_type_fcns); i_type++) {
         nm_auto_unref_gtypeclass GObjectClass *klass_unref = NULL;
         GType                                  gtype       = (get_type_fcns[i_type])();
-        GObjectClass *                         klass;
+        GObjectClass                          *klass;
 
         g_assert(g_str_has_prefix(g_type_name(gtype), "NM"));
 
@@ -2803,16 +2803,16 @@ test_types(void)
 static void
 test_nml_dbus_meta(void)
 {
-    const NMLDBusMetaIface *   meta_iface;
+    const NMLDBusMetaIface    *meta_iface;
     const NMLDBusMetaProperty *meta_property;
     guint                      prop_idx;
     gsize                      i, j;
     guint                      l, m;
 
     for (i = 0; i < G_N_ELEMENTS(_nml_dbus_meta_ifaces); i++) {
-        const NMLDBusMetaIface * mif                       = _nml_dbus_meta_ifaces[i];
+        const NMLDBusMetaIface                *mif         = _nml_dbus_meta_ifaces[i];
         nm_auto_unref_gtypeclass GObjectClass *klass_unref = NULL;
-        GObjectClass *                         klass;
+        GObjectClass                          *klass;
         GType                                  gtype;
 
 #define COMMON_PREFIX "org.freedesktop.NetworkManager"
@@ -3004,7 +3004,7 @@ test_nml_dbus_meta(void)
 check_dbus_properties:
         for (l = 0; l < mif->n_dbus_properties; l++) {
             const NMLDBusMetaProperty *mpr               = &mif->dbus_properties[l];
-            gs_free char *             obj_property_name = NULL;
+            gs_free char              *obj_property_name = NULL;
             const struct {
                 const char *dbus_type;
                 GType       default_gtype;
@@ -3218,7 +3218,7 @@ static void
 test_dbus_meta_types(void)
 {
     struct list_data {
-        const char *            dbus_iface_name;
+        const char             *dbus_iface_name;
         GType                   gtype;
         NMLDBusMetaInteracePrio interface_prio;
     } list[] = {
@@ -3464,8 +3464,8 @@ test_nm_auth_permissions(void)
     for (i = 1; i < NM_CLIENT_PERMISSION_LAST; i++) {
         NMClientPermission a   = nm_auth_permission_sorted[i - 1];
         NMClientPermission b   = nm_auth_permission_sorted[i];
-        const char *       s_a = nm_auth_permission_names_by_idx[a - 1];
-        const char *       s_b = nm_auth_permission_names_by_idx[b - 1];
+        const char        *s_a = nm_auth_permission_names_by_idx[a - 1];
+        const char        *s_b = nm_auth_permission_names_by_idx[b - 1];
 
         g_assert_cmpstr(s_a, <, s_b);
         g_assert(a != b);
diff --git a/src/libnm-client-impl/tests/test-nm-client.c b/src/libnm-client-impl/tests/test-nm-client.c
index a3fc5847..a43e98cd 100644
--- a/src/libnm-client-impl/tests/test-nm-client.c
+++ b/src/libnm-client-impl/tests/test-nm-client.c
@@ -28,9 +28,9 @@ loop_quit(gpointer user_data)
 static void
 devices_notify_cb(NMClient *c, GParamSpec *pspec, gpointer user_data)
 {
-    gboolean *       notified = user_data;
+    gboolean        *notified = user_data;
     const GPtrArray *devices;
-    NMDevice *       device;
+    NMDevice        *device;
 
     devices = nm_client_get_devices(c);
     g_assert(devices);
@@ -46,12 +46,12 @@ devices_notify_cb(NMClient *c, GParamSpec *pspec, gpointer user_data)
 static void
 test_device_added(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    const GPtrArray *         devices;
-    NMDevice *                device;
-    gboolean                  notified = FALSE;
-    GError *                  error    = NULL;
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    const GPtrArray                               *devices;
+    NMDevice                                      *device;
+    gboolean                                       notified = FALSE;
+    GError                                        *error    = NULL;
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -113,9 +113,9 @@ device_sai_added_cb(NMClient *c, NMDevice *device, gpointer user_data)
 static void
 devices_sai_notify_cb(NMClient *c, GParamSpec *pspec, gpointer user_data)
 {
-    guint *          result = user_data;
+    guint           *result = user_data;
     const GPtrArray *devices;
-    NMDevice *       device;
+    NMDevice        *device;
 
     g_assert_cmpstr(pspec->name, ==, "devices");
 
@@ -134,11 +134,11 @@ devices_sai_notify_cb(NMClient *c, GParamSpec *pspec, gpointer user_data)
 static void
 test_device_added_signal_after_init(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    const GPtrArray *         devices;
-    NMDevice *                device;
-    guint                     result = 0;
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    const GPtrArray                               *devices;
+    NMDevice                                      *device;
+    guint                                          result = 0;
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -187,7 +187,7 @@ static const char *expected_bssid = "66:55:44:33:22:11";
 typedef struct {
     GMainLoop *loop;
     gboolean   found;
-    char *     ap_path;
+    char      *ap_path;
     gboolean   signaled;
     gboolean   notified;
     guint      quit_id;
@@ -229,7 +229,7 @@ static void
 wifi_ap_add_notify_cb(NMDeviceWifi *w, GParamSpec *pspec, WifiApInfo *info)
 {
     const GPtrArray *aps;
-    NMAccessPoint *  ap;
+    NMAccessPoint   *ap;
 
     aps = nm_device_wifi_get_access_points(w);
     g_assert(aps);
@@ -269,13 +269,13 @@ wifi_ap_remove_notify_cb(NMDeviceWifi *w, GParamSpec *pspec, WifiApInfo *info)
 static void
 test_wifi_ap_added_removed(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    NMDeviceWifi *            wifi;
-    WifiApInfo                info = {gl.loop, FALSE, FALSE, 0, 0};
-    GVariant *                ret;
-    GError *                  error         = NULL;
-    gs_free char *            expected_path = NULL;
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    NMDeviceWifi                                  *wifi;
+    WifiApInfo                                     info = {gl.loop, FALSE, FALSE, 0, 0};
+    GVariant                                      *ret;
+    GError                                        *error         = NULL;
+    gs_free char                                  *expected_path = NULL;
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -391,9 +391,9 @@ static void
 da_devices_notify_cb(NMClient *c, GParamSpec *pspec, DaInfo *info)
 {
     const GPtrArray *devices;
-    NMDevice *       device;
+    NMDevice        *device;
     guint            i;
-    const char *     iface;
+    const char      *iface;
 
     devices = nm_client_get_devices(c);
     g_assert(devices);
@@ -413,13 +413,13 @@ da_devices_notify_cb(NMClient *c, GParamSpec *pspec, DaInfo *info)
 static void
 test_devices_array(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    DaInfo                    info                       = {gl.loop};
-    NMDevice *                wlan0, *eth0, *eth1, *device;
-    const GPtrArray *         devices;
-    GError *                  error = NULL;
-    GVariant *                ret;
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    DaInfo                                         info   = {gl.loop};
+    NMDevice                                      *wlan0, *eth0, *eth1, *device;
+    const GPtrArray                               *devices;
+    GError                                        *error = NULL;
+    GVariant                                      *ret;
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -502,12 +502,12 @@ nm_running_changed(GObject *client, GParamSpec *pspec, gpointer user_data)
 static void
 test_client_nm_running(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client1                    = NULL;
-    gs_unref_object NMClient *client2                    = NULL;
-    guint                     quit_id;
-    int                       running_changed = 0;
-    GError *                  error           = NULL;
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo   = NULL;
+    gs_unref_object NMClient                      *client1 = NULL;
+    gs_unref_object NMClient                      *client2 = NULL;
+    guint                                          quit_id;
+    int                                            running_changed = 0;
+    GError                                        *error           = NULL;
 
     client1 = nmtstc_client_new(TRUE);
 
@@ -560,7 +560,7 @@ test_client_nm_running(void)
 }
 
 typedef struct {
-    GMainLoop *         loop;
+    GMainLoop          *loop;
     NMActiveConnection *ac;
 
     int remaining;
@@ -572,8 +572,8 @@ typedef struct {
 static void
 assert_ac_and_device(NMClient *client)
 {
-    const GPtrArray *   devices, *acs, *ac_devices;
-    NMDevice *          device, *ac_device;
+    const GPtrArray    *devices, *acs, *ac_devices;
+    NMDevice           *device, *ac_device;
     NMActiveConnection *ac, *device_ac;
 
     acs = nm_client_get_active_connections(client);
@@ -614,9 +614,9 @@ assert_ac_and_device(NMClient *client)
 static void
 add_and_activate_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 {
-    NMClient *  client = NM_CLIENT(object);
+    NMClient   *client = NM_CLIENT(object);
     TestACInfo *info   = user_data;
-    GError *    error  = NULL;
+    GError     *error  = NULL;
 
     info->ac = nm_client_add_and_activate_connection_finish(client, result, &error);
     g_assert_no_error(error);
@@ -632,7 +632,7 @@ add_and_activate_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 static void
 client_acs_changed_cb(GObject *client, GParamSpec *pspec, gpointer user_data)
 {
-    TestACInfo *     info = user_data;
+    TestACInfo      *info = user_data;
     const GPtrArray *acs;
 
     acs = nm_client_get_active_connections(NM_CLIENT(client));
@@ -659,11 +659,11 @@ device_ac_changed_cb(GObject *device, GParamSpec *pspec, gpointer user_data)
 static void
 test_active_connections(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    NMDevice *                device;
-    NMConnection *            conn;
-    TestACInfo                info = {gl.loop, NULL, 0};
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    NMDevice                                      *device;
+    NMConnection                                  *conn;
+    TestACInfo                                     info = {gl.loop, NULL, 0};
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -719,9 +719,9 @@ test_active_connections(void)
 static void
 client_devices_changed_cb(GObject *client, GParamSpec *pspec, gpointer user_data)
 {
-    TestACInfo *     info = user_data;
+    TestACInfo      *info = user_data;
     const GPtrArray *devices;
-    NMDevice *       device;
+    NMDevice        *device;
 
     devices = nm_client_get_devices(NM_CLIENT(client));
     g_assert(devices != NULL);
@@ -755,7 +755,7 @@ client_devices_changed_cb(GObject *client, GParamSpec *pspec, gpointer user_data
 }
 
 typedef struct {
-    GMainLoop *         loop;
+    GMainLoop          *loop;
     NMRemoteConnection *remote;
 } TestConnectionInfo;
 
@@ -763,7 +763,7 @@ static void
 add_connection_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 {
     TestConnectionInfo *info  = user_data;
-    GError *            error = NULL;
+    GError             *error = NULL;
 
     info->remote = nm_client_add_connection_finish(NM_CLIENT(object), result, &error);
     g_assert_no_error(error);
@@ -773,9 +773,9 @@ add_connection_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 static void
 activate_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 {
-    NMClient *  client = NM_CLIENT(object);
+    NMClient   *client = NM_CLIENT(object);
     TestACInfo *info   = user_data;
-    GError *    error  = NULL;
+    GError     *error  = NULL;
 
     info->ac = nm_client_activate_connection_finish(client, result, &error);
     g_assert_no_error(error);
@@ -789,15 +789,45 @@ activate_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 }
 
 static void
+_dev_eth0_1_state_changed_cb(NMDevice           *device,
+                             NMDeviceState       new_state,
+                             NMDeviceState       old_state,
+                             NMDeviceStateReason reason,
+                             int                *p_count_call)
+{
+    const GPtrArray *arr;
+
+    g_assert(p_count_call);
+    g_assert_cmpint(*p_count_call, ==, 0);
+
+    (*p_count_call)++;
+
+    g_assert(NM_IS_DEVICE_VLAN(device));
+
+    g_assert_cmpint(old_state, >=, NM_DEVICE_STATE_PREPARE);
+    g_assert_cmpint(old_state, <=, NM_DEVICE_STATE_ACTIVATED);
+    g_assert_cmpint(new_state, ==, NM_DEVICE_STATE_UNKNOWN);
+
+    arr = nm_device_get_available_connections(device);
+    g_assert(arr);
+    g_assert_cmpint(arr->len, ==, 0);
+
+    g_assert(!nm_device_get_active_connection(device));
+}
+
+static void
 test_activate_virtual(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    NMConnection *            conn;
-    NMSettingConnection *     s_con;
-    NMSettingVlan *           s_vlan;
-    TestACInfo                info      = {gl.loop, NULL, 0};
-    TestConnectionInfo        conn_info = {gl.loop, NULL};
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    NMConnection                                  *conn;
+    NMSettingConnection                           *s_con;
+    NMSettingVlan                                 *s_vlan;
+    TestACInfo                                     info      = {gl.loop, NULL, 0};
+    TestConnectionInfo                             conn_info = {gl.loop, NULL};
+
+    if (nmtst_test_skip_slow())
+        return;
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -847,23 +877,74 @@ test_activate_virtual(void)
         g_object_remove_weak_pointer(G_OBJECT(info.device), (gpointer *) &info.device);
         nm_clear_g_signal_handler(info.device, &info.ac_signal_id);
     }
+
+    if (nmtst_get_rand_bool()) {
+        /* OK, enough for this run. Let's see whether we can tear down
+         * successfully at this point. */
+        return;
+    }
+
+    {
+        NMDevice           *dev_eth0_1;
+        NMActiveConnection *ac;
+        const GPtrArray    *arr;
+        gulong              sig_id;
+        int                 call_count = 0;
+        gboolean            take_ref   = nmtst_get_rand_bool();
+
+        /* ensure we got all the necessary events in place. */
+        nmtst_main_loop_run(gl.loop, 50);
+
+        dev_eth0_1 = nm_client_get_device_by_iface(client, "eth0.1");
+        g_assert(NM_IS_DEVICE_VLAN(dev_eth0_1));
+        if (take_ref)
+            g_object_ref(dev_eth0_1);
+
+        arr = nm_device_get_available_connections(dev_eth0_1);
+        g_assert(arr);
+        g_assert_cmpint(arr->len, ==, 1);
+
+        ac = nm_device_get_active_connection(dev_eth0_1);
+        g_assert(NM_IS_ACTIVE_CONNECTION(ac));
+
+        sig_id = g_signal_connect(dev_eth0_1,
+                                  "state-changed",
+                                  G_CALLBACK(_dev_eth0_1_state_changed_cb),
+                                  &call_count);
+
+        g_clear_object(&client);
+
+        g_assert_cmpint(call_count, ==, 1);
+
+        if (take_ref) {
+            arr = nm_device_get_available_connections(dev_eth0_1);
+            g_assert(arr);
+            g_assert_cmpint(arr->len, ==, 0);
+
+            g_assert(!nm_device_get_active_connection(dev_eth0_1));
+
+            nm_clear_g_signal_handler(dev_eth0_1, &sig_id);
+
+            g_object_unref(dev_eth0_1);
+        }
+    }
 }
 
 static void
 test_device_connection_compatibility(void)
 {
-    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo = NULL;
-    gs_unref_object NMClient *client                     = NULL;
-    gs_unref_object NMConnection *conn                   = NULL;
-    NMDevice *                    device1;
-    NMDevice *                    device2;
-    NMSettingWired *              s_wired;
-    GError *                      error           = NULL;
-    const char *                  subchannels[]   = {"0.0.8000", "0.0.8001", "0.0.8002", NULL};
-    const char *                  subchannels_2[] = {"0.0.8000", "0.0.8001", NULL};
-    const char *                  subchannels_x[] = {"0.0.8000", "0.0.8001", "0.0.800X", NULL};
-    const char *                  hw_addr1        = "52:54:00:ab:db:23";
-    const char *                  hw_addr2        = "52:54:00:ab:db:24";
+    nmtstc_auto_service_cleanup NMTstcServiceInfo *sinfo  = NULL;
+    gs_unref_object NMClient                      *client = NULL;
+    gs_unref_object NMConnection                  *conn   = NULL;
+    NMDevice                                      *device1;
+    NMDevice                                      *device2;
+    NMSettingWired                                *s_wired;
+    GError                                        *error = NULL;
+    const char *subchannels[]   = {"0.0.8000", "0.0.8001", "0.0.8002", NULL};
+    const char *subchannels_2[] = {"0.0.8000", "0.0.8001", NULL};
+    const char *subchannels_x[] = {"0.0.8000", "0.0.8001", "0.0.800X", NULL};
+    const char *hw_addr1        = "52:54:00:ab:db:23";
+    const char *hw_addr2        = "52:54:00:ab:db:24";
 
     sinfo = nmtstc_service_init();
     if (!nmtstc_service_available(sinfo))
@@ -927,7 +1008,7 @@ static gboolean
 _test_connection_invalid_find_connections(gpointer element, gpointer needle, gpointer user_data)
 {
     NMRemoteConnection *con  = NM_REMOTE_CONNECTION(element);
-    const char *        path = needle;
+    const char         *path = needle;
 
     g_assert(NM_IS_REMOTE_CONNECTION(con));
     g_assert(path && *path);
@@ -950,17 +1031,17 @@ test_connection_invalid(void)
 {
     NMTSTC_SERVICE_INFO_SETUP(my_sinfo);
     gs_unref_object NMConnection *connection = NULL;
-    NMSettingConnection *         s_con;
-    gs_unref_object NMClient *client = NULL;
-    const GPtrArray *         connections;
-    gs_free char *            path0 = NULL;
-    gs_free char *            path1 = NULL;
-    gs_free char *            path2 = NULL;
-    gs_free char *            path3 = NULL;
-    gs_free char *            uuid2 = NULL;
-    gsize                     n_found;
-    gssize                    idx[4];
-    gs_unref_variant GVariant *variant = NULL;
+    NMSettingConnection          *s_con;
+    gs_unref_object NMClient     *client = NULL;
+    const GPtrArray              *connections;
+    gs_free char                 *path0 = NULL;
+    gs_free char                 *path1 = NULL;
+    gs_free char                 *path2 = NULL;
+    gs_free char                 *path3 = NULL;
+    gs_free char                 *uuid2 = NULL;
+    gsize                         n_found;
+    gssize                        idx[4];
+    gs_unref_variant GVariant    *variant = NULL;
 
     g_assert(g_main_loop_get_context(gl.loop)
              == (g_main_context_get_thread_default() ?: g_main_context_default()));
diff --git a/src/libnm-client-impl/tests/test-remote-settings-client.c b/src/libnm-client-impl/tests/test-remote-settings-client.c
index e5415f54..7e4872e9 100644
--- a/src/libnm-client-impl/tests/test-remote-settings-client.c
+++ b/src/libnm-client-impl/tests/test-remote-settings-client.c
@@ -13,9 +13,9 @@
 #include "libnm-client-test/nm-test-libnm-utils.h"
 
 static struct {
-    NMTstcServiceInfo * sinfo;
-    NMClient *          client;
-    GDBusConnection *   bus;
+    NMTstcServiceInfo  *sinfo;
+    NMClient           *client;
+    GDBusConnection    *bus;
     NMRemoteConnection *remote;
 } gl = {};
 
@@ -25,7 +25,7 @@ static void
 add_cb(GObject *s, GAsyncResult *result, gpointer user_data)
 {
     gboolean *done  = user_data;
-    GError *  error = NULL;
+    GError   *error = NULL;
 
     gl.remote = nm_client_add_connection_finish(gl.client, result, &error);
     g_assert_no_error(error);
@@ -72,7 +72,7 @@ test_add_connection(void)
 static void
 set_visible_cb(GObject *proxy, GAsyncResult *result, gpointer user_data)
 {
-    GError *  error = NULL;
+    GError   *error = NULL;
     GVariant *ret;
 
     ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), result, &error);
@@ -95,8 +95,8 @@ connection_removed_cb(NMClient *s, NMRemoteConnection *connection, gboolean *don
 }
 
 static void
-invis_has_settings_cb(NMSetting *   setting,
-                      const char *  key,
+invis_has_settings_cb(NMSetting    *setting,
+                      const char   *key,
                       const GValue *value,
                       GParamFlags   flags,
                       gpointer      user_data)
@@ -109,10 +109,10 @@ test_make_invisible(void)
 {
     const GPtrArray *conns;
     int              i;
-    GDBusProxy *     proxy;
+    GDBusProxy      *proxy;
     gboolean         visible_changed = FALSE, connection_removed = FALSE;
     gboolean         has_settings = FALSE;
-    char *           path;
+    char            *path;
 
     if (!nmtstc_service_available(gl.sinfo))
         return;
@@ -193,9 +193,9 @@ test_make_visible(void)
 {
     const GPtrArray *conns;
     int              i;
-    GDBusProxy *     proxy;
+    GDBusProxy      *proxy;
     gboolean         found = FALSE;
-    char *           path;
+    char            *path;
     NMRemoteConnection *new = NULL;
 
     if (!nmtstc_service_available(gl.sinfo))
@@ -261,7 +261,7 @@ test_make_visible(void)
 static void
 deleted_cb(GObject *proxy, GAsyncResult *result, gpointer user_data)
 {
-    GError *  error = NULL;
+    GError   *error = NULL;
     GVariant *ret;
 
     ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), result, &error);
@@ -280,11 +280,11 @@ static void
 test_remove_connection(void)
 {
     NMRemoteConnection *connection;
-    const GPtrArray *   conns;
+    const GPtrArray    *conns;
     int                 i;
-    GDBusProxy *        proxy;
+    GDBusProxy         *proxy;
     gboolean            done = FALSE;
-    char *              path;
+    char               *path;
 
     if (!nmtstc_service_available(gl.sinfo))
         return;
@@ -334,8 +334,8 @@ test_remove_connection(void)
 static void
 add_remove_cb(GObject *s, GAsyncResult *result, gpointer user_data)
 {
-    NMRemoteConnection *connection;
-    gboolean *          done    = user_data;
+    NMRemoteConnection   *connection;
+    gboolean             *done  = user_data;
     gs_free_error GError *error = NULL;
 
     connection = nm_client_add_connection_finish(gl.client, result, &error);
@@ -348,8 +348,8 @@ add_remove_cb(GObject *s, GAsyncResult *result, gpointer user_data)
 static void
 test_add_remove_connection(void)
 {
-    gs_unref_variant GVariant *ret           = NULL;
-    GError *                   error         = NULL;
+    gs_unref_variant GVariant    *ret        = NULL;
+    GError                       *error      = NULL;
     gs_unref_object NMConnection *connection = NULL;
     gboolean                      done       = FALSE;
 
@@ -382,7 +382,7 @@ test_add_remove_connection(void)
 static void
 add_bad_cb(GObject *s, GAsyncResult *result, gpointer user_data)
 {
-    gboolean *    done          = user_data;
+    gboolean             *done  = user_data;
     gs_free_error GError *error = NULL;
 
     gl.remote = nm_client_add_connection_finish(gl.client, result, &error);
@@ -418,7 +418,7 @@ test_add_bad_connection(void)
 static void
 save_hostname_cb(GObject *s, GAsyncResult *result, gpointer user_data)
 {
-    gboolean *    done          = user_data;
+    gboolean             *done  = user_data;
     gs_free_error GError *error = NULL;
 
     nm_client_save_hostname_finish(gl.client, result, &error);
@@ -432,7 +432,7 @@ test_save_hostname(void)
 {
     gint64   until_ts;
     gboolean done  = FALSE;
-    GError * error = NULL;
+    GError  *error = NULL;
 
     if (!nmtstc_service_available(gl.sinfo))
         return;
diff --git a/src/libnm-client-impl/tests/test-secret-agent.c b/src/libnm-client-impl/tests/test-secret-agent.c
index 8f758f3d..1fffb556 100644
--- a/src/libnm-client-impl/tests/test-secret-agent.c
+++ b/src/libnm-client-impl/tests/test-secret-agent.c
@@ -29,20 +29,20 @@ GType test_secret_agent_get_type(void);
 G_DEFINE_TYPE(TestSecretAgent, test_secret_agent, NM_TYPE_SECRET_AGENT_OLD)
 
 static void
-test_secret_agent_get_secrets(NMSecretAgentOld *             agent,
-                              NMConnection *                 connection,
-                              const char *                   connection_path,
-                              const char *                   setting_name,
-                              const char **                  hints,
+test_secret_agent_get_secrets(NMSecretAgentOld              *agent,
+                              NMConnection                  *connection,
+                              const char                    *connection_path,
+                              const char                    *setting_name,
+                              const char                   **hints,
                               NMSecretAgentGetSecretsFlags   flags,
                               NMSecretAgentOldGetSecretsFunc callback,
                               gpointer                       callback_data)
 {
     NMSettingWirelessSecurity *s_wsec;
-    GVariant *                 secrets = NULL;
+    GVariant                  *secrets = NULL;
     GVariantBuilder            secrets_builder, setting_builder;
-    char *                     secret = NULL;
-    GError *                   error  = NULL;
+    char                      *secret = NULL;
+    GError                    *error  = NULL;
 
     g_assert_cmpstr(setting_name, ==, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
 
@@ -91,16 +91,16 @@ done:
 
 static void
 test_secret_agent_cancel_get_secrets(NMSecretAgentOld *agent,
-                                     const char *      connection_path,
-                                     const char *      setting_name)
+                                     const char       *connection_path,
+                                     const char       *setting_name)
 {
     g_assert_not_reached();
 }
 
 static void
-test_secret_agent_save_secrets(NMSecretAgentOld *              agent,
-                               NMConnection *                  connection,
-                               const char *                    connection_path,
+test_secret_agent_save_secrets(NMSecretAgentOld               *agent,
+                               NMConnection                   *connection,
+                               const char                     *connection_path,
                                NMSecretAgentOldSaveSecretsFunc callback,
                                gpointer                        callback_data)
 {
@@ -108,9 +108,9 @@ test_secret_agent_save_secrets(NMSecretAgentOld *              agent,
 }
 
 static void
-test_secret_agent_delete_secrets(NMSecretAgentOld *                agent,
-                                 NMConnection *                    connection,
-                                 const char *                      connection_path,
+test_secret_agent_delete_secrets(NMSecretAgentOld                 *agent,
+                                 NMConnection                     *connection,
+                                 const char                       *connection_path,
                                  NMSecretAgentOldDeleteSecretsFunc callback,
                                  gpointer                          callback_data)
 {
@@ -136,7 +136,7 @@ test_secret_agent_new(gboolean auto_register)
 static void
 test_secret_agent_class_init(TestSecretAgentClass *klass)
 {
-    GObjectClass *         object_class = G_OBJECT_CLASS(klass);
+    GObjectClass          *object_class = G_OBJECT_CLASS(klass);
     NMSecretAgentOldClass *agent_class  = NM_SECRET_AGENT_OLD_CLASS(klass);
 
     agent_class->get_secrets        = test_secret_agent_get_secrets;
@@ -163,14 +163,14 @@ test_secret_agent_class_init(TestSecretAgentClass *klass)
 
 typedef struct {
     NMTstcServiceInfo *sinfo;
-    NMClient *         client;
+    NMClient          *client;
 
     NMSecretAgentOld *agent;
-    NMDevice *        device;
-    NMConnection *    connection;
+    NMDevice         *device;
+    NMConnection     *connection;
 
     GMainLoop *loop;
-    GSource *  timeout_source;
+    GSource   *timeout_source;
 
     char *ifname;
     char *con_id;
@@ -182,8 +182,8 @@ static void
 connection_added_cb(GObject *s, GAsyncResult *result, gpointer user_data)
 {
     TestSecretAgentData *sadata = user_data;
-    NMRemoteConnection * connection;
-    GError *             error = NULL;
+    NMRemoteConnection  *connection;
+    GError              *error = NULL;
 
     connection = nm_client_add_connection_finish(sadata->client, result, &error);
 
@@ -198,7 +198,7 @@ static void
 register_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 {
     TestSecretAgentData *sadata = user_data;
-    GError *             error  = NULL;
+    GError              *error  = NULL;
 
     nm_secret_agent_old_register_finish(sadata->agent, result, &error);
     g_assert_no_error(error);
@@ -212,14 +212,14 @@ register_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 static void
 test_setup(TestSecretAgentData *sadata, gconstpointer test_data)
 {
-    static int           static_counter = 0;
-    const int            counter        = static_counter++;
-    const char *         create_agent   = test_data;
-    NMConnection *       connection;
-    NMSettingConnection *s_con;
-    NMSettingWireless *  s_wireless;
-    GBytes *             ssid;
-    NMSetting *          s_wsec;
+    static int            static_counter = 0;
+    const int             counter        = static_counter++;
+    const char           *create_agent   = test_data;
+    NMConnection         *connection;
+    NMSettingConnection  *s_con;
+    NMSettingWireless    *s_wireless;
+    GBytes               *ssid;
+    NMSetting            *s_wsec;
     gs_free_error GError *error = NULL;
 
     sadata->sinfo = nmtstc_service_init();
@@ -296,8 +296,8 @@ test_setup(TestSecretAgentData *sadata, gconstpointer test_data)
 static void
 test_cleanup(TestSecretAgentData *sadata, gconstpointer test_data)
 {
-    GVariant *                  ret;
-    GError *                    error        = NULL;
+    GVariant                   *ret;
+    GError                     *error        = NULL;
     NMTstContextBusyWatcherData watcher_data = {};
 
     g_assert(nm_g_main_context_is_thread_default(NULL));
@@ -358,8 +358,8 @@ test_cleanup(TestSecretAgentData *sadata, gconstpointer test_data)
 static void
 connection_activated_none_cb(GObject *c, GAsyncResult *result, gpointer user_data)
 {
-    TestSecretAgentData *sadata = user_data;
-    gs_free_error GError *error = NULL;
+    TestSecretAgentData  *sadata = user_data;
+    gs_free_error GError *error  = NULL;
 
     nm_client_activate_connection_finish(sadata->client, result, &error);
     g_assert_error(error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
@@ -387,10 +387,10 @@ test_secret_agent_none(TestSecretAgentData *sadata, gconstpointer test_data)
 
 static char *
 secrets_requested_no_secrets_cb(TestSecretAgent *agent,
-                                NMConnection *   connection,
-                                const char *     connection_path,
-                                const char *     setting_name,
-                                const char *     secret_name,
+                                NMConnection    *connection,
+                                const char      *connection_path,
+                                const char      *setting_name,
+                                const char      *secret_name,
                                 gpointer         user_data)
 {
     TestSecretAgentData *sadata = user_data;
@@ -404,9 +404,9 @@ secrets_requested_no_secrets_cb(TestSecretAgent *agent,
 static void
 connection_activated_no_secrets_cb(GObject *c, GAsyncResult *result, gpointer user_data)
 {
-    TestSecretAgentData *sadata            = user_data;
-    gs_unref_object NMActiveConnection *ac = NULL;
-    gs_free_error GError *error            = NULL;
+    TestSecretAgentData                *sadata = user_data;
+    gs_unref_object NMActiveConnection *ac     = NULL;
+    gs_free_error GError               *error  = NULL;
 
     ac = nm_client_activate_connection_finish(sadata->client, result, &error);
     g_assert_error(error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
@@ -441,9 +441,9 @@ test_secret_agent_no_secrets(TestSecretAgentData *sadata, gconstpointer test_dat
 static void
 connection_activated_cancel_cb(GObject *c, GAsyncResult *result, gpointer user_data)
 {
-    TestSecretAgentData *sadata            = user_data;
-    gs_unref_object NMActiveConnection *ac = NULL;
-    gs_free_error GError *error            = NULL;
+    TestSecretAgentData                *sadata = user_data;
+    gs_unref_object NMActiveConnection *ac     = NULL;
+    gs_free_error GError               *error  = NULL;
 
     ac = nm_client_activate_connection_finish(sadata->client, result, &error);
     g_assert_error(error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_USER_CANCELED);
@@ -452,10 +452,10 @@ connection_activated_cancel_cb(GObject *c, GAsyncResult *result, gpointer user_d
 
 static char *
 secrets_requested_cancel_cb(TestSecretAgent *agent,
-                            NMConnection *   connection,
-                            const char *     connection_path,
-                            const char *     setting_name,
-                            const char *     secret_name,
+                            NMConnection    *connection,
+                            const char      *connection_path,
+                            const char      *setting_name,
+                            const char      *secret_name,
                             gpointer         user_data)
 {
     TestSecretAgentData *sadata = user_data;
@@ -495,8 +495,8 @@ static void
 connection_activated_good_cb(GObject *c, GAsyncResult *result, gpointer user_data)
 {
     TestSecretAgentData *sadata = user_data;
-    NMActiveConnection * ac;
-    GError *             error = NULL;
+    NMActiveConnection  *ac;
+    GError              *error = NULL;
 
     ac = nm_client_activate_connection_finish(sadata->client, result, &error);
     g_assert_no_error(error);
@@ -508,10 +508,10 @@ connection_activated_good_cb(GObject *c, GAsyncResult *result, gpointer user_dat
 
 static char *
 secrets_requested_good_cb(TestSecretAgent *agent,
-                          NMConnection *   connection,
-                          const char *     connection_path,
-                          const char *     setting_name,
-                          const char *     secret_name,
+                          NMConnection    *connection,
+                          const char      *connection_path,
+                          const char      *setting_name,
+                          const char      *secret_name,
                           gpointer         user_data)
 {
     TestSecretAgentData *sadata = user_data;
@@ -550,8 +550,8 @@ test_secret_agent_good(TestSecretAgentData *sadata, gconstpointer test_data)
 static void
 async_init_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 {
-    GMainLoop *   loop             = user_data;
-    gs_free_error GError *error    = NULL;
+    GMainLoop               *loop  = user_data;
+    gs_free_error GError    *error = NULL;
     gs_unref_object GObject *agent = NULL;
 
     agent = g_async_initable_new_finish(G_ASYNC_INITABLE(object), result, &error);
@@ -564,9 +564,9 @@ async_init_cb(GObject *object, GAsyncResult *result, gpointer user_data)
 static void
 test_secret_agent_nm_not_running(void)
 {
-    gs_unref_object NMSecretAgentOld *agent  = NULL;
+    gs_unref_object NMSecretAgentOld  *agent = NULL;
     nm_auto_unref_gmainloop GMainLoop *loop  = NULL;
-    GError *                           error = NULL;
+    GError                            *error = NULL;
 
     agent = g_initable_new(test_secret_agent_get_type(),
                            NULL,
@@ -626,12 +626,12 @@ registered_changed(GObject *object, GParamSpec *pspec, gpointer user_data)
 static void
 test_secret_agent_auto_register(void)
 {
-    NMTstcServiceInfo *sinfo;
+    NMTstcServiceInfo                *sinfo;
     gs_unref_object NMSecretAgentOld *agent              = NULL;
-    GError *                          error              = NULL;
+    GError                           *error              = NULL;
     AutoRegisterData                  auto_register_data = {
-        .step         = 0,
-        .invoke_count = 0,
+                         .step         = 0,
+                         .invoke_count = 0,
     };
     gulong                      signal_id;
     NMTstContextBusyWatcherData watcher_data = {};