[glib-networking] tls/tests: skip tests that fail with certain gnutls releases



commit 26e58fd28d632a3b6e4aab86437d5e0a8a69a288
Author: Dan Winship <danw gnome org>
Date:   Sun Dec 7 10:38:29 2014 +0100

    tls/tests: skip tests that fail with certain gnutls releases
    
    The handshake-while-simultaneously-reading-and-writing tests fail with
    certain gnutls releases due to a gnutls bug, so skip it when compiling
    against those releases.

 tls/tests/Makefile.am  |    7 ++++---
 tls/tests/connection.c |   25 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/tls/tests/Makefile.am b/tls/tests/Makefile.am
index 2f1f6f6..8d3d903 100644
--- a/tls/tests/Makefile.am
+++ b/tls/tests/Makefile.am
@@ -1,13 +1,15 @@
 include $(top_srcdir)/glib-networking.mk
 
 AM_CPPFLAGS +=                                 \
+       $(GNUTLS_CFLAGS)                        \
        -I$(top_srcdir)/tls                     \
        -I$(top_builddir)/tls                   \
        -DSRCDIR=\""$(abs_srcdir)"\"            \
        -DTOP_BUILDDIR=\""$(top_builddir)"\"
 
 LDADD  = \
-       $(GLIB_LIBS)
+       $(GLIB_LIBS) \
+       $(GNUTLS_LIBS)
 
 test_programs =       \
        certificate   \
@@ -24,8 +26,7 @@ test_programs +=           \
        pkcs11-slot
 
 AM_CPPFLAGS +=                 \
-       $(PKCS11_CFLAGS)        \
-       $(GNUTLS_CFLAGS)
+       $(PKCS11_CFLAGS)
 
 LDADD += $(top_builddir)/tls/pkcs11/libgiopkcs11.la $(PKCS11_LIBS)
 
diff --git a/tls/tests/connection.c b/tls/tests/connection.c
index 0e7b706..6bcb9c2 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -24,6 +24,7 @@
 #include "mock-interaction.h"
 
 #include <gio/gio.h>
+#include <gnutls/gnutls.h>
 
 #include <sys/types.h>
 #include <string.h>
@@ -1048,10 +1049,28 @@ test_simultaneous_async (TestConnection *test,
   g_assert_cmpstr (test->buf, ==, TEST_DATA);
 }
 
+static gboolean
+check_gnutls_has_rehandshaking_bug (void)
+{
+  const char *version = gnutls_check_version (NULL);
+
+  return (!strcmp (version, "3.1.27") ||
+         !strcmp (version, "3.1.28") ||
+         !strcmp (version, "3.2.19") ||
+         !strcmp (version, "3.3.8") ||
+         !strcmp (version, "3.3.9"));
+}
+
 static void
 test_simultaneous_async_rehandshake (TestConnection *test,
                                     gconstpointer   data)
 {
+  if (check_gnutls_has_rehandshaking_bug ())
+    {
+      g_test_skip ("test would fail due to gnutls bug 108690");
+      return;
+    }
+
   test->rehandshake = TRUE;
   test_simultaneous_async (test, data);
 }
@@ -1146,6 +1165,12 @@ static void
 test_simultaneous_sync_rehandshake (TestConnection *test,
                                    gconstpointer   data)
 {
+  if (check_gnutls_has_rehandshaking_bug ())
+    {
+      g_test_skip ("test would fail due to gnutls bug 108690");
+      return;
+    }
+
   test->rehandshake = TRUE;
   test_simultaneous_sync (test, data);
 }


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