mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-26 04:09:30 +03:00
Make testsuite parallel build compatible (part 2)
This commit is contained in:
@@ -62,7 +62,7 @@ https_transfer_thread_adapter (void *args)
|
||||
|
||||
/* time spread incomming requests */
|
||||
usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX));
|
||||
ret = test_https_transfer (NULL,
|
||||
ret = test_https_transfer (NULL, cargs->port,
|
||||
cargs->cipher_suite, cargs->proto_version);
|
||||
if (ret == 0)
|
||||
return NULL;
|
||||
@@ -78,12 +78,12 @@ https_transfer_thread_adapter (void *args)
|
||||
* TODO : make client_count a parameter - number of curl client threads to spawn
|
||||
*/
|
||||
static int
|
||||
test_single_client (void *cls, const char *cipher_suite,
|
||||
test_single_client (void *cls, int port, const char *cipher_suite,
|
||||
int curl_proto_version)
|
||||
{
|
||||
void *client_thread_ret;
|
||||
struct https_test_data client_args =
|
||||
{ NULL, cipher_suite, curl_proto_version };
|
||||
{ NULL, port, cipher_suite, curl_proto_version };
|
||||
|
||||
client_thread_ret = https_transfer_thread_adapter (&client_args);
|
||||
if (client_thread_ret != NULL)
|
||||
@@ -100,7 +100,7 @@ test_single_client (void *cls, const char *cipher_suite,
|
||||
* TODO : make client_count a parameter - numver of curl client threads to spawn
|
||||
*/
|
||||
static int
|
||||
test_parallel_clients (void * cls, const char *cipher_suite,
|
||||
test_parallel_clients (void * cls, int port, const char *cipher_suite,
|
||||
int curl_proto_version)
|
||||
{
|
||||
int i;
|
||||
@@ -108,7 +108,7 @@ test_parallel_clients (void * cls, const char *cipher_suite,
|
||||
void *client_thread_ret;
|
||||
pthread_t client_arr[client_count];
|
||||
struct https_test_data client_args =
|
||||
{ NULL, cipher_suite, curl_proto_version };
|
||||
{ NULL, port, cipher_suite, curl_proto_version };
|
||||
|
||||
for (i = 0; i < client_count; ++i)
|
||||
{
|
||||
@@ -137,6 +137,12 @@ main (int argc, char *const *argv)
|
||||
{
|
||||
unsigned int errorCount = 0;
|
||||
const char *aes256_sha = "AES256-SHA";
|
||||
int port;
|
||||
|
||||
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
|
||||
port = 0;
|
||||
else
|
||||
port = 3020;
|
||||
|
||||
/* initialize random seed used by curl clients */
|
||||
unsigned int iseed = (unsigned int) time (NULL);
|
||||
@@ -157,7 +163,7 @@ main (int argc, char *const *argv)
|
||||
#ifdef EPOLL_SUPPORT
|
||||
errorCount +=
|
||||
test_wrap ("single threaded daemon, single client, epoll", &test_single_client,
|
||||
NULL,
|
||||
NULL, port,
|
||||
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL,
|
||||
aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
|
||||
srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
|
||||
@@ -165,7 +171,7 @@ main (int argc, char *const *argv)
|
||||
#endif
|
||||
errorCount +=
|
||||
test_wrap ("single threaded daemon, single client", &test_single_client,
|
||||
NULL,
|
||||
NULL, port,
|
||||
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG,
|
||||
aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
|
||||
srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
|
||||
@@ -173,7 +179,7 @@ main (int argc, char *const *argv)
|
||||
#ifdef EPOLL_SUPPORT
|
||||
errorCount +=
|
||||
test_wrap ("single threaded daemon, parallel clients, epoll",
|
||||
&test_parallel_clients, NULL,
|
||||
&test_parallel_clients, NULL, port,
|
||||
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL,
|
||||
aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
|
||||
srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
|
||||
@@ -181,7 +187,7 @@ main (int argc, char *const *argv)
|
||||
#endif
|
||||
errorCount +=
|
||||
test_wrap ("single threaded daemon, parallel clients",
|
||||
&test_parallel_clients, NULL,
|
||||
&test_parallel_clients, NULL, port,
|
||||
MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG,
|
||||
aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
|
||||
srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
|
||||
|
||||
Reference in New Issue
Block a user