Răsfoiți Sursa

-check for versions, report tests as skipped if versions missmatch

Christian Grothoff 10 ani în urmă
părinte
comite
8d83647523

+ 14 - 1
src/testcurl/https/test_https_session_info.c

@@ -1,6 +1,6 @@
 /*
 /*
  This file is part of libmicrohttpd
  This file is part of libmicrohttpd
- Copyright (C) 2007 Christian Grothoff
+ Copyright (C) 2007, 2016 Christian Grothoff
 
 
  libmicrohttpd is free software; you can redistribute it and/or modify
  libmicrohttpd is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published
  it under the terms of the GNU General Public License as published
@@ -168,6 +168,7 @@ int
 main (int argc, char *const *argv)
 main (int argc, char *const *argv)
 {
 {
   unsigned int errorCount = 0;
   unsigned int errorCount = 0;
+  const char *ssl_version;
 
 
   gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
   gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
 #ifdef GCRYCTL_INITIALIZATION_FINISHED
 #ifdef GCRYCTL_INITIALIZATION_FINISHED
@@ -178,6 +179,18 @@ main (int argc, char *const *argv)
       fprintf (stderr, "Error (code: %u)\n", errorCount);
       fprintf (stderr, "Error (code: %u)\n", errorCount);
       return -1;
       return -1;
     }
     }
+
+  ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
+  if (NULL == ssl_version)
+  {
+    fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
+    return 77;
+  }
+  if (0 != strncmp (ssl_version, "GnuTLS", 6))
+  {
+    fprintf (stderr, "This test can be run only with libcurl-gnutls.\n");
+    return 77;
+  }
 #if LIBCURL_VERSION_NUM >= 0x072200
 #if LIBCURL_VERSION_NUM >= 0x072200
   errorCount += test_query_session ();
   errorCount += test_query_session ();
 #endif
 #endif

+ 2 - 2
src/testcurl/https/test_https_sni.c

@@ -256,7 +256,7 @@ main (int argc, char *const *argv)
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
     {
     {
       fprintf (stderr, "Error: %s\n", strerror (errno));
       fprintf (stderr, "Error: %s\n", strerror (errno));
-      return -1;
+      return 77;
     }
     }
   load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key");
   load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key");
   load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key");
   load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key");
@@ -288,6 +288,6 @@ int main ()
 {
 {
   fprintf (stderr,
   fprintf (stderr,
            "SNI not supported by GnuTLS < 3.0\n");
            "SNI not supported by GnuTLS < 3.0\n");
-  return 0;
+  return 77;
 }
 }
 #endif
 #endif

+ 10 - 10
src/testcurl/https/test_tls_options.c

@@ -1,17 +1,17 @@
 /*
 /*
   This file is part of libmicrohttpd
   This file is part of libmicrohttpd
-  Copyright (C) 2007, 2010 Christian Grothoff
-  
+  Copyright (C) 2007, 2010, 2016 Christian Grothoff
+
   libmicrohttpd is free software; you can redistribute it and/or modify
   libmicrohttpd is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published
   it under the terms of the GNU General Public License as published
   by the Free Software Foundation; either version 2, or (at your
   by the Free Software Foundation; either version 2, or (at your
   option) any later version.
   option) any later version.
-  
+
   libmicrohttpd is distributed in the hope that it will be useful, but
   libmicrohttpd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.
   General Public License for more details.
-  
+
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with libmicrohttpd; see the file COPYING.  If not, write to the
   along with libmicrohttpd; see the file COPYING.  If not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
@@ -92,24 +92,24 @@ main (int argc, char *const *argv)
 #endif
 #endif
  if (curl_check_version (MHD_REQ_CURL_VERSION))
  if (curl_check_version (MHD_REQ_CURL_VERSION))
     {
     {
-      return 0;
+      return 77;
     }
     }
   ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
   ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
   if (NULL == ssl_version)
   if (NULL == ssl_version)
   {
   {
     fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
     fprintf (stderr, "Curl does not support SSL.  Cannot run the test.\n");
-    return 0;
+    return 77;
   }
   }
   if (0 != strncmp (ssl_version, "GnuTLS", 6))
   if (0 != strncmp (ssl_version, "GnuTLS", 6))
   {
   {
     fprintf (stderr, "This test can be run only with libcurl-gnutls.\n");
     fprintf (stderr, "This test can be run only with libcurl-gnutls.\n");
-    return 0;
+    return 77;
   }
   }
 
 
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
     {
     {
       fprintf (stderr, "Error: %s\n", strerror (errno));
       fprintf (stderr, "Error: %s\n", strerror (errno));
-      return 0; 
+      return 77;
     }
     }
 
 
   const char *aes128_sha = "AES128-SHA";
   const char *aes128_sha = "AES128-SHA";
@@ -119,9 +119,9 @@ main (int argc, char *const *argv)
       aes128_sha = "rsa_aes_128_sha";
       aes128_sha = "rsa_aes_128_sha";
       aes256_sha = "rsa_aes_256_sha";
       aes256_sha = "rsa_aes_256_sha";
     }
     }
-  
 
 
-  if (0 != 
+
+  if (0 !=
     test_wrap ("TLS1.0-AES-SHA1",
     test_wrap ("TLS1.0-AES-SHA1",
 	       &test_https_transfer, NULL, daemon_flags,
 	       &test_https_transfer, NULL, daemon_flags,
 	       aes128_sha,
 	       aes128_sha,