[glib/wip/smcv/disable-nonce-tcp-server: 1/2] gdbus-peer test: Skip if we get EADDRNOTAVAIL



commit d400433866003bd4d0a8ac43d664130831a22209
Author: Simon McVittie <smcv collabora com>
Date:   Mon Nov 4 11:14:15 2019 +0000

    gdbus-peer test: Skip if we get EADDRNOTAVAIL
    
    We're still not sure why this test hits EADDRNOTAVAIL so often on CI,
    but let's not allow it to break all other CI in the meantime.
    
    Mitigates: https://gitlab.gnome.org/GNOME/glib/issues/1912
    Signed-off-by: Simon McVittie <smcv collabora com>

 gio/tests/gdbus-peer.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index 7887ab917..0f978dca7 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -1381,6 +1381,24 @@ nonce_tcp_service_thread_func (gpointer user_data)
                                    observer,
                                    NULL, /* cancellable */
                                    &error);
+
+#ifdef EADDRNOTAVAIL
+  if (server == NULL)
+    {
+      /* There is no specific GSocket error code for EADDRNOTAVAIL so the
+       * best we can do here is string matching on the error message... */
+      if (g_str_has_prefix (error->message, "Error binding to address") &&
+          g_str_has_suffix (error->message, g_strerror (EADDRNOTAVAIL)))
+        {
+          gchar *message = g_strdup_printf ("%s; see https://gitlab.gnome.org/GNOME/glib/issues/1912";,
+                                            error->message);
+          g_test_incomplete (message);
+          g_free (message);
+          return NULL;
+        }
+    }
+#endif
+
   g_assert_no_error (error);
 
   g_signal_connect (server,
@@ -1432,6 +1450,10 @@ test_nonce_tcp (void)
                                  nonce_tcp_service_thread_func,
                                  &data);
   await_service_loop ();
+
+  if (g_test_failed ())
+    return;
+
   g_assert (server != NULL);
 
   /* bring up a connection and accept it */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]