diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-25 20:33:19 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-25 20:33:19 +0300 |
commit | 9d1596d3108ff237dbe368942296a0f6fbba47f8 (patch) | |
tree | bb6ac83244c81ce1e4063cbe4c35b15d13e01b39 /src/testcurl/https/test_https_session_info.c | |
parent | a7b7a32ec6dd493e00573da4b2f343f02feb0aa7 (diff) | |
download | libmicrohttpd-9d1596d3108ff237dbe368942296a0f6fbba47f8.tar.gz libmicrohttpd-9d1596d3108ff237dbe368942296a0f6fbba47f8.zip |
Make testsuite parallel build compatible (part 2)
Diffstat (limited to 'src/testcurl/https/test_https_session_info.c')
-rw-r--r-- | src/testcurl/https/test_https_session_info.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c index fe2d0724..eb821240 100644 --- a/src/testcurl/https/test_https_session_info.c +++ b/src/testcurl/https/test_https_session_info.c | |||
@@ -100,17 +100,21 @@ test_query_session () | |||
100 | struct CBC cbc; | 100 | struct CBC cbc; |
101 | CURLcode errornum; | 101 | CURLcode errornum; |
102 | char url[256]; | 102 | char url[256]; |
103 | int port; | ||
104 | |||
105 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
106 | port = 0; | ||
107 | else | ||
108 | port = 3060; | ||
103 | 109 | ||
104 | if (NULL == (cbc.buf = malloc (sizeof (char) * 255))) | 110 | if (NULL == (cbc.buf = malloc (sizeof (char) * 255))) |
105 | return 16; | 111 | return 16; |
106 | cbc.size = 255; | 112 | cbc.size = 255; |
107 | cbc.pos = 0; | 113 | cbc.pos = 0; |
108 | 114 | ||
109 | gen_test_file_url (url, DEAMON_TEST_PORT); | ||
110 | |||
111 | /* setup test */ | 115 | /* setup test */ |
112 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 116 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
113 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, | 117 | MHD_USE_ERROR_LOG, port, |
114 | NULL, NULL, &query_session_ahc, NULL, | 118 | NULL, NULL, &query_session_ahc, NULL, |
115 | MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", | 119 | MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", |
116 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 120 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
@@ -122,6 +126,14 @@ test_query_session () | |||
122 | free (cbc.buf); | 126 | free (cbc.buf); |
123 | return 2; | 127 | return 2; |
124 | } | 128 | } |
129 | if (0 == port) | ||
130 | { | ||
131 | const union MHD_DaemonInfo *dinfo; | ||
132 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
133 | if (NULL == dinfo || 0 == dinfo->port) | ||
134 | { MHD_stop_daemon (d); return 32; } | ||
135 | port = (int)dinfo->port; | ||
136 | } | ||
125 | 137 | ||
126 | const char *aes256_sha = "AES256-SHA"; | 138 | const char *aes256_sha = "AES256-SHA"; |
127 | if (curl_uses_nss_ssl() == 0) | 139 | if (curl_uses_nss_ssl() == 0) |
@@ -129,6 +141,7 @@ test_query_session () | |||
129 | aes256_sha = "rsa_aes_256_sha"; | 141 | aes256_sha = "rsa_aes_256_sha"; |
130 | } | 142 | } |
131 | 143 | ||
144 | gen_test_file_url (url, port); | ||
132 | c = curl_easy_init (); | 145 | c = curl_easy_init (); |
133 | #if DEBUG_HTTPS_TEST | 146 | #if DEBUG_HTTPS_TEST |
134 | curl_easy_setopt (c, CURLOPT_VERBOSE, 1); | 147 | curl_easy_setopt (c, CURLOPT_VERBOSE, 1); |
@@ -172,6 +185,7 @@ test_query_session () | |||
172 | int | 185 | int |
173 | main (int argc, char *const *argv) | 186 | main (int argc, char *const *argv) |
174 | { | 187 | { |
188 | #if LIBCURL_VERSION_NUM >= 0x072200 | ||
175 | unsigned int errorCount = 0; | 189 | unsigned int errorCount = 0; |
176 | const char *ssl_version; | 190 | const char *ssl_version; |
177 | 191 | ||
@@ -200,10 +214,11 @@ main (int argc, char *const *argv) | |||
200 | curl_global_cleanup (); | 214 | curl_global_cleanup (); |
201 | return 77; | 215 | return 77; |
202 | } | 216 | } |
203 | #if LIBCURL_VERSION_NUM >= 0x072200 | ||
204 | errorCount += test_query_session (); | 217 | errorCount += test_query_session (); |
205 | #endif | ||
206 | print_test_result (errorCount, argv[0]); | 218 | print_test_result (errorCount, argv[0]); |
207 | curl_global_cleanup (); | 219 | curl_global_cleanup (); |
208 | return errorCount != 0 ? 1 : 0; | 220 | return errorCount != 0 ? 1 : 0; |
221 | #else /* LIBCURL_VERSION_NUM < 0x072200 */ | ||
222 | return 77; | ||
223 | #endif /* LIBCURL_VERSION_NUM < 0x072200 */ | ||
209 | } | 224 | } |