[gnutls-devel] Parallel test bug in gnutls-3.2.2

Adam Sampson ats at offog.org
Wed Jul 17 14:49:06 CEST 2013


On Wed, Jul 17, 2013 at 02:00:26PM +0200, Nikos Mavrogiannopoulos wrote:
> A comment, on the socketpair patch. That doesn't work in windows
> systems, so could you enhance this patch to return 77 on windows
> similarly to the other tests that do socketpair (77 is the code of
> test skipped)?

Sure -- here you go. I've just copied what the other tests that are
disabled on _WIN32 do.

It might be neater to add a make_socketpair wrapper to utils.c, and have
it just exit(77) on Win32?

Thanks,

-- 
Adam Sampson <ats at offog.org>                         <http://offog.org/>
-------------- next part --------------
>From 56457c3536d1c216b60c5a5f7f8a56e69f587727 Mon Sep 17 00:00:00 2001
From: Adam Sampson <ats at offog.org>
Date: Wed, 17 Jul 2013 13:44:03 +0100
Subject: [PATCH 1/1] Disable tests that use socketpair on _WIN32.

socketpair isn't provided on Windows, so these tests should just exit
77.

Note that resume-dtls.c already had a guard like this -- I've rewritten
it to match the others, but socketpair (presumably!) isn't the only
reason that test is disabled on Win32.

Signed-off-by: Adam Sampson <ats at offog.org>
---
 tests/anonself.c    | 14 ++++++++++++++
 tests/dhepskself.c  | 14 ++++++++++++++
 tests/openpgpself.c | 14 ++++++++++++++
 tests/pskself.c     | 14 ++++++++++++++
 tests/resume-dtls.c | 22 ++++++++++++----------
 tests/resume.c      | 14 ++++++++++++++
 tests/x509dn.c      | 14 ++++++++++++++
 tests/x509self.c    | 14 ++++++++++++++
 8 files changed, 110 insertions(+), 10 deletions(-)

diff --git a/tests/anonself.c b/tests/anonself.c
index c76e8ba..8436471 100644
--- a/tests/anonself.c
+++ b/tests/anonself.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -305,3 +317,5 @@ doit (void)
   else
     client (sockets[1]);
 }
+
+#endif /* _WIN32 */
diff --git a/tests/dhepskself.c b/tests/dhepskself.c
index 854a711..ef7373b 100644
--- a/tests/dhepskself.c
+++ b/tests/dhepskself.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -302,3 +314,5 @@ doit (void)
   else
     client (sockets[1]);
 }
+
+#endif /* _WIN32 */
diff --git a/tests/openpgpself.c b/tests/openpgpself.c
index 9c21117..80b016d 100644
--- a/tests/openpgpself.c
+++ b/tests/openpgpself.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -624,3 +636,5 @@ doit (void)
   else
     client (client_sds);
 }
+
+#endif /* _WIN32 */
diff --git a/tests/pskself.c b/tests/pskself.c
index 96ad965..ed5229d 100644
--- a/tests/pskself.c
+++ b/tests/pskself.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -289,3 +301,5 @@ doit (void)
   else
     client (sockets[1]);
 }
+
+#endif /* _WIN32 */
diff --git a/tests/resume-dtls.c b/tests/resume-dtls.c
index aa28b74..65cf3c2 100644
--- a/tests/resume-dtls.c
+++ b/tests/resume-dtls.c
@@ -29,6 +29,17 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -38,15 +49,6 @@
 #include <unistd.h>
 #include <gnutls/gnutls.h>
 
-#if defined(_WIN32)
-
-int main()
-{
-  exit(77);
-}
-
-#else
-
 #include "utils.h"
 
 static void wrap_db_init (void);
@@ -626,4 +628,4 @@ wrap_db_delete (void *dbf, gnutls_datum_t key)
 
 }
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
diff --git a/tests/resume.c b/tests/resume.c
index b0d137b..6156007 100644
--- a/tests/resume.c
+++ b/tests/resume.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -612,3 +624,5 @@ wrap_db_delete (void *dbf, gnutls_datum_t key)
   return -1;
 
 }
+
+#endif /* _WIN32 */
diff --git a/tests/x509dn.c b/tests/x509dn.c
index af41083..1ecc519 100644
--- a/tests/x509dn.c
+++ b/tests/x509dn.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -507,3 +519,5 @@ doit (void)
   else
     client (sockets[1]);
 }
+
+#endif /* _WIN32 */
diff --git a/tests/x509self.c b/tests/x509self.c
index e0b55f0..e52c055 100644
--- a/tests/x509self.c
+++ b/tests/x509self.c
@@ -29,6 +29,18 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#if defined(_WIN32)
+
+/* socketpair isn't supported on Win32. */
+int
+main (int argc, char** argv)
+{
+    exit (77);
+}
+
+#else
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -477,3 +489,5 @@ doit (void)
   else
     client (sockets[1]);
 }
+
+#endif /* _WIN32 */
-- 
1.8.3



More information about the Gnutls-devel mailing list