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:
@@ -47,13 +47,21 @@ test_concurent_daemon_pair (void *cls,
|
||||
const char *cipher_suite,
|
||||
int proto_version)
|
||||
{
|
||||
|
||||
int ret;
|
||||
struct MHD_Daemon *d1;
|
||||
struct MHD_Daemon *d2;
|
||||
int port1, port2;
|
||||
|
||||
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
|
||||
port1 = port2 = 0;
|
||||
else
|
||||
{
|
||||
port1 = 3050;
|
||||
port2 = 3051;
|
||||
}
|
||||
|
||||
d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS |
|
||||
MHD_USE_ERROR_LOG, DEAMON_TEST_PORT,
|
||||
MHD_USE_ERROR_LOG, port1,
|
||||
NULL, NULL, &http_ahc, NULL,
|
||||
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
|
||||
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
|
||||
@@ -64,9 +72,17 @@ test_concurent_daemon_pair (void *cls,
|
||||
fprintf (stderr, MHD_E_SERVER_INIT);
|
||||
return -1;
|
||||
}
|
||||
if (0 == port1)
|
||||
{
|
||||
const union MHD_DaemonInfo *dinfo;
|
||||
dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT);
|
||||
if (NULL == dinfo || 0 == dinfo->port)
|
||||
{ MHD_stop_daemon (d1); return -1; }
|
||||
port1 = (int)dinfo->port;
|
||||
}
|
||||
|
||||
d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS |
|
||||
MHD_USE_ERROR_LOG, DEAMON_TEST_PORT + 1,
|
||||
MHD_USE_ERROR_LOG, port2,
|
||||
NULL, NULL, &http_ahc, NULL,
|
||||
MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
|
||||
MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
|
||||
@@ -78,16 +94,28 @@ test_concurent_daemon_pair (void *cls,
|
||||
fprintf (stderr, MHD_E_SERVER_INIT);
|
||||
return -1;
|
||||
}
|
||||
if (0 == port2)
|
||||
{
|
||||
const union MHD_DaemonInfo *dinfo;
|
||||
dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT);
|
||||
if (NULL == dinfo || 0 == dinfo->port)
|
||||
{
|
||||
MHD_stop_daemon (d1);
|
||||
MHD_stop_daemon (d2);
|
||||
return -1;
|
||||
}
|
||||
port2 = (int)dinfo->port;
|
||||
}
|
||||
|
||||
ret =
|
||||
test_daemon_get (NULL, cipher_suite, proto_version, DEAMON_TEST_PORT, 0);
|
||||
test_daemon_get (NULL, cipher_suite, proto_version, port1, 0);
|
||||
ret +=
|
||||
test_daemon_get (NULL, cipher_suite, proto_version,
|
||||
DEAMON_TEST_PORT + 1, 0);
|
||||
port2, 0);
|
||||
|
||||
MHD_stop_daemon (d2);
|
||||
ret +=
|
||||
test_daemon_get (NULL, cipher_suite, proto_version, DEAMON_TEST_PORT, 0);
|
||||
test_daemon_get (NULL, cipher_suite, proto_version, port1, 0);
|
||||
MHD_stop_daemon (d1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user