https tests: supported multi-TLS selection on libcurl >= 7.56.0,

fixed error report for failed initialisation of libcurl
This commit is contained in:
Evgeny Grin (Karlson2k) committed 2017-11-15 16:12:12 +03:00
1 parent fd7d712823
commit 23324164fb
13 files changed
+44 -56

No files matched your search

+2 -5
View File
@@ -222,11 +222,8 @@ main (int argc, char *const *argv)
unsigned int errorCount = 0;
(void)argc; /* Unused. Silent compiler warning. */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+2 -5
View File
@@ -139,11 +139,8 @@ main (int argc, char *const *argv)
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+2 -5
View File
@@ -150,11 +150,8 @@ main (int argc, char *const *argv)
/* initialize random seed used by curl clients */
unsigned int iseed = (unsigned int) time (NULL);
srand (iseed);
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
@@ -157,11 +157,8 @@ main (int argc, char *const *argv)
#endif
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
srand (iseed);
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
if (NULL == ssl_version)
{
+2 -5
View File
@@ -250,11 +250,8 @@ main (int argc, char *const *argv)
unsigned int errorCount = 0;
(void)argc; /* Unused. Silent compiler warning. */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+2 -6
View File
@@ -136,12 +136,8 @@ main (int argc, char *const *argv)
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error (code: %u). l:%d f:%s\n", errorCount, __LINE__,
__FUNCTION__);
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+2 -5
View File
@@ -199,11 +199,8 @@ main (int argc, char *const *argv)
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error (code: %u)\n", errorCount);
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
if (NULL == ssl_version)
+2 -5
View File
@@ -269,11 +269,8 @@ main (int argc, char *const *argv)
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+2 -5
View File
@@ -94,11 +94,8 @@ main (int argc, char *const *argv)
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error (code: %u)\n", errorCount);
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version)
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+2 -5
View File
@@ -238,11 +238,8 @@ main (int argc, char *const *argv)
return -1;
}
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return -1;
}
if (!testsuite_curl_global_init ())
return 99;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS |
MHD_USE_ERROR_LOG, port,
+2 -5
View File
@@ -121,11 +121,8 @@ main (int argc, char *const *argv)
return 77;
}
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
fprintf (stderr, "Error: %s\n", strerror (errno));
return 99;
}
if (!testsuite_curl_global_init ())
return 99;
const char *aes128_sha = "AES128-SHA";
const char *aes256_sha = "AES256-SHA";
+19
View File
@@ -525,3 +525,22 @@ test_wrap (const char *test_name, int
va_end (arg_list);
return ret;
}
int testsuite_curl_global_init (void)
{
CURLcode res;
#if LIBCURL_VERSION_NUM >= 0x07380
if (CURLSSLSET_OK != curl_global_sslset(CURLSSLBACKEND_GNUTLS, NULL, NULL))
{
if (CURLSSLSET_TOO_LATE == curl_global_sslset(CURLSSLBACKEND_OPENSSL, NULL, NULL))
fprintf (stderr, "WARNING: libcurl was already initialised.\n");
}
#endif /* LIBCURL_VERSION_NUM >= 0x07380 */
res = curl_global_init (CURL_GLOBAL_ALL);
if (CURLE_OK != res)
{
fprintf (stderr, "libcurl initialisation error: %s\n", curl_easy_strerror(res));
return 0;
}
return 1;
}
+3
View File
@@ -149,4 +149,7 @@ test_wrap (const char *test_name, int
int proto_version), void * cls,
int port,
int daemon_flags, const char *cipher_suite, int proto_version, ...);
int testsuite_curl_global_init (void);
#endif /* TLS_TEST_COMMON_H_ */