[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 12/13: Tests: added use of MHD_USE_NO_THREAD_SAFETY flag
From: |
gnunet |
Subject: |
[libmicrohttpd] 12/13: Tests: added use of MHD_USE_NO_THREAD_SAFETY flag |
Date: |
Thu, 23 Nov 2023 11:49:15 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 67b1cdc29dfb1f260e0d31df3121e01d8ecad027
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Nov 21 17:33:58 2023 +0300
Tests: added use of MHD_USE_NO_THREAD_SAFETY flag
---
src/microhttpd/test_client_put_stop.c | 3 ++-
src/microhttpd/test_daemon.c | 9 ++++++---
src/microhttpd/test_options.c | 21 +++++++++++----------
src/microhttpd/test_set_panic.c | 3 ++-
src/microhttpd/test_start_stop.c | 23 ++++++++++++++++++++---
src/microhttpd/test_upgrade.c | 5 +++--
src/testcurl/https/test_https_get_select.c | 4 +++-
src/testcurl/perf_get.c | 2 +-
src/testcurl/test_add_conn.c | 3 +--
src/testcurl/test_basicauth.c | 2 +-
src/testcurl/test_callback.c | 2 +-
src/testcurl/test_delete.c | 2 +-
src/testcurl/test_digestauth2.c | 2 +-
src/testcurl/test_digestauth_emu_ext.c | 2 +-
src/testcurl/test_get.c | 15 +++++++++++----
src/testcurl/test_get_chunked.c | 2 +-
src/testcurl/test_get_close_keep_alive.c | 2 +-
src/testcurl/test_get_iovec.c | 8 +++++---
src/testcurl/test_get_sendfile.c | 8 +++++---
src/testcurl/test_head.c | 2 +-
src/testcurl/test_large_put.c | 2 +-
src/testcurl/test_parse_cookies.c | 2 +-
src/testcurl/test_patch.c | 2 +-
src/testcurl/test_post.c | 2 +-
src/testcurl/test_post_loop.c | 2 +-
src/testcurl/test_postform.c | 2 +-
src/testcurl/test_process_arguments.c | 2 +-
src/testcurl/test_process_headers.c | 2 +-
src/testcurl/test_put.c | 2 +-
src/testcurl/test_put_broken_len.c | 2 +-
src/testcurl/test_put_header_fold.c | 2 +-
src/testcurl/test_toolarge.c | 3 ++-
src/testcurl/test_tricky.c | 3 ++-
src/testzzuf/test_get.c | 10 +++++++---
34 files changed, 100 insertions(+), 58 deletions(-)
diff --git a/src/microhttpd/test_client_put_stop.c
b/src/microhttpd/test_client_put_stop.c
index 388bc12d..aaf5c829 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -1979,7 +1979,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
if (testMhdThreadExternal == thrType)
d = MHD_start_daemon (((unsigned int) pollType)
- | (verbose ? MHD_USE_ERROR_LOG : 0),
+ | (verbose ? MHD_USE_ERROR_LOG : 0)
+ | MHD_USE_NO_THREAD_SAFETY,
*pport, NULL, NULL,
&ahcCheck, *ahc_param,
MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb,
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c
index 00c83c63..9239ada5 100644
--- a/src/microhttpd/test_daemon.c
+++ b/src/microhttpd/test_daemon.c
@@ -116,14 +116,15 @@ testStartStop (void)
static unsigned int
-testExternalRun (void)
+testExternalRun (int use_no_thread_safe)
{
struct MHD_Daemon *d;
fd_set rs;
MHD_socket maxfd;
int i;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG
+ | (use_no_thread_safe ? MHD_USE_NO_THREAD_SAFETY : 0),
0,
&apc_all, NULL,
&ahc_nothing, NULL,
@@ -233,7 +234,9 @@ main (int argc,
errorCount += testStartError ();
if (has_threads_support)
errorCount += testStartStop ();
- errorCount += testExternalRun ();
+ if (has_threads_support)
+ errorCount += testExternalRun (0);
+ errorCount += testExternalRun (! 0);
if (has_threads_support)
{
errorCount += testThread ();
diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c
index 7be7666d..9e2d3b45 100644
--- a/src/microhttpd/test_options.c
+++ b/src/microhttpd/test_options.c
@@ -102,7 +102,7 @@ test_ip_addr_option (void)
ret = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR, &daemon_ip_addr,
MHD_OPTION_END);
@@ -120,7 +120,7 @@ test_ip_addr_option (void)
daemon_ip_addr.sin_port = htons (port4);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) sizeof(daemon_ip_addr), &daemon_ip_addr,
@@ -138,7 +138,7 @@ test_ip_addr_option (void)
MHD_stop_daemon (d);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) (sizeof(daemon_ip_addr) / 2),
@@ -154,7 +154,7 @@ test_ip_addr_option (void)
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
daemon_ip_addr.sin_len = (socklen_t) sizeof(daemon_ip_addr);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) sizeof(daemon_ip_addr), &daemon_ip_addr,
@@ -173,7 +173,7 @@ test_ip_addr_option (void)
daemon_ip_addr.sin_len = (socklen_t) (sizeof(daemon_ip_addr) / 2);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) sizeof(daemon_ip_addr), &daemon_ip_addr,
@@ -189,7 +189,8 @@ test_ip_addr_option (void)
#if defined(HAVE_INET6) && defined(USE_IPV6_TESTING)
- d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6
+ | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR, &daemon_ip_addr6,
MHD_OPTION_END);
@@ -207,7 +208,7 @@ test_ip_addr_option (void)
daemon_ip_addr6.sin6_port = htons (port6);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) sizeof(daemon_ip_addr6), &daemon_ip_addr6,
@@ -225,7 +226,7 @@ test_ip_addr_option (void)
MHD_stop_daemon (d);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) (sizeof(daemon_ip_addr6) / 2),
@@ -241,7 +242,7 @@ test_ip_addr_option (void)
#if defined(HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN)
daemon_ip_addr6.sin6_len = (socklen_t) sizeof(daemon_ip_addr6);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) sizeof(daemon_ip_addr6), &daemon_ip_addr6,
@@ -260,7 +261,7 @@ test_ip_addr_option (void)
daemon_ip_addr6.sin6_len = (socklen_t) (sizeof(daemon_ip_addr6) / 2);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY, 0,
NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_SOCK_ADDR_LEN,
(socklen_t) sizeof(daemon_ip_addr6), &daemon_ip_addr6,
diff --git a/src/microhttpd/test_set_panic.c b/src/microhttpd/test_set_panic.c
index cec361f6..ca9a0375 100644
--- a/src/microhttpd/test_set_panic.c
+++ b/src/microhttpd/test_set_panic.c
@@ -1469,7 +1469,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
if (testMhdThreadExternal == thrType)
d = MHD_start_daemon (((unsigned int) pollType)
- | (verbose ? MHD_USE_ERROR_LOG : 0),
+ | (verbose ? MHD_USE_ERROR_LOG : 0)
+ | MHD_USE_NO_THREAD_SAFETY,
*pport, NULL, NULL,
&ahcCheck, *ahc_param,
MHD_OPTION_NOTIFY_CONNECTION, &socket_cb,
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c
index a64f3011..1031e12e 100644
--- a/src/microhttpd/test_start_stop.c
+++ b/src/microhttpd/test_start_stop.c
@@ -101,15 +101,31 @@ testMultithreadedPoolGet (unsigned int poll_flag)
}
+static unsigned int
+testExternalGet (void)
+{
+ struct MHD_Daemon *d;
+
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ 0, NULL, NULL,
+ &ahc_echo, NULL,
+ MHD_OPTION_END);
+ if (NULL == d)
+ return 8;
+ MHD_stop_daemon (d);
+ return 0;
+}
+
+
#endif
static unsigned int
-testExternalGet (void)
+testExternalGetSingleThread (void)
{
struct MHD_Daemon *d;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
0, NULL, NULL,
&ahc_echo, NULL,
MHD_OPTION_END);
@@ -132,8 +148,9 @@ main (int argc,
errorCount += testInternalGet (0);
errorCount += testMultithreadedGet (0);
errorCount += testMultithreadedPoolGet (0);
-#endif
errorCount += testExternalGet ();
+#endif
+ errorCount += testExternalGetSingleThread ();
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_POLL))
{
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 0abd5f10..22b15090 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -1275,7 +1275,8 @@ test_upgrade (unsigned int flags,
done = false;
if (! test_tls)
- d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE,
+ d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE
+ | MHD_USE_ITC,
global_port,
NULL, NULL,
&ahc_upgrade, NULL,
@@ -1289,7 +1290,7 @@ test_upgrade (unsigned int flags,
#ifdef HTTPS_SUPPORT
else
d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE
- | MHD_USE_TLS,
+ | MHD_USE_TLS | MHD_USE_ITC,
global_port,
NULL, NULL,
&ahc_upgrade, NULL,
diff --git a/src/testcurl/https/test_https_get_select.c
b/src/testcurl/https/test_https_get_select.c
index 1939ccff..8ce55e2c 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -278,7 +278,9 @@ main (int argc, char *const *argv)
#ifdef EPOLL_SUPPORT
errorCount += testExternalGet (MHD_USE_EPOLL);
#endif
- errorCount += testExternalGet (0);
+ if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
+ errorCount += testExternalGet (MHD_NO_FLAG);
+ errorCount += testExternalGet (MHD_USE_NO_THREAD_SAFETY);
curl_global_cleanup ();
if (errorCount != 0)
fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount);
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 0a8af562..c9f400a3 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -458,7 +458,7 @@ testExternalGet (uint16_t port)
multi = NULL;
cbc.buf = buf;
cbc.size = 2048;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c
index 4fd651b3..2539b5f5 100644
--- a/src/testcurl/test_add_conn.c
+++ b/src/testcurl/test_add_conn.c
@@ -739,8 +739,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
if (testMhdThreadExternal == thrType)
d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
- | (thrType == testMhdThreadExternal ?
- 0 : MHD_USE_ITC)
+ | MHD_USE_NO_THREAD_SAFETY
| (no_listen ? MHD_USE_NO_LISTEN_SOCKET : 0)
| MHD_USE_ERROR_LOG,
*pport, NULL, NULL,
diff --git a/src/testcurl/test_basicauth.c b/src/testcurl/test_basicauth.c
index 963639c9..d6fe1427 100644
--- a/src/testcurl/test_basicauth.c
+++ b/src/testcurl/test_basicauth.c
@@ -647,7 +647,7 @@ testBasicAuth (void)
else
port = 4210;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index 510043cc..3cc28c5f 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -141,7 +141,7 @@ main (int argc, char **argv)
else
port = 1140;
- d = MHD_start_daemon (0,
+ d = MHD_start_daemon (MHD_USE_NO_THREAD_SAFETY,
port,
NULL,
NULL,
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index 681afe30..81fa9986 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -389,7 +389,7 @@ testExternalDelete (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port,
NULL, NULL, &ahc_echo, &done_flag,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_digestauth2.c b/src/testcurl/test_digestauth2.c
index e94f7b63..2ec78e26 100644
--- a/src/testcurl/test_digestauth2.c
+++ b/src/testcurl/test_digestauth2.c
@@ -1366,7 +1366,7 @@ testDigestAuth (void)
if (test_bind_uri)
dauth_nonce_bind |= MHD_DAUTH_BIND_NONCE_URI_PARAMS;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahc_echo, &rq_tr,
MHD_OPTION_DIGEST_AUTH_RANDOM_COPY,
diff --git a/src/testcurl/test_digestauth_emu_ext.c
b/src/testcurl/test_digestauth_emu_ext.c
index 7a6e8e7b..8506a567 100644
--- a/src/testcurl/test_digestauth_emu_ext.c
+++ b/src/testcurl/test_digestauth_emu_ext.c
@@ -820,7 +820,7 @@ testDigestAuthEmu (void)
else
port = 4210;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index b44c8370..812aa840 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -394,7 +394,7 @@ testMultithreadedPoolGet (uint32_t poll_flag)
static unsigned int
-testExternalGet (void)
+testExternalGet (int thread_unsafe)
{
struct MHD_Daemon *d;
CURL *c;
@@ -424,7 +424,8 @@ testExternalGet (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG
+ | (thread_unsafe ? MHD_USE_NO_THREAD_SAFETY : 0),
global_port, NULL, NULL,
&ahc_echo, NULL,
MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -890,14 +891,20 @@ main (int argc, char *const *argv)
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
return 2;
global_port = 0;
- test_result = testExternalGet ();
+ test_result = testExternalGet (! 0);
if (test_result)
- fprintf (stderr, "FAILED: testExternalGet () - %u.\n", test_result);
+ fprintf (stderr, "FAILED: testExternalGet (!0) - %u.\n", test_result);
else if (verbose)
printf ("PASSED: testExternalGet ().\n");
errorCount += test_result;
if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
{
+ test_result += testExternalGet (0);
+ if (test_result)
+ fprintf (stderr, "FAILED: testExternalGet (0) - %u.\n", test_result);
+ else if (verbose)
+ printf ("PASSED: testExternalGet ().\n");
+ errorCount += test_result;
test_result += testInternalGet (0);
if (test_result)
fprintf (stderr, "FAILED: testInternalGet (0) - %u.\n", test_result);
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 1b985ce2..9ffa8041 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -591,7 +591,7 @@ testExternalGet (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
MHD_OPTION_END);
diff --git a/src/testcurl/test_get_close_keep_alive.c
b/src/testcurl/test_get_close_keep_alive.c
index 5771bec9..b84e9640 100644
--- a/src/testcurl/test_get_close_keep_alive.c
+++ b/src/testcurl/test_get_close_keep_alive.c
@@ -958,7 +958,7 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
if (testMhdThreadExternal == thrType)
d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
- | MHD_USE_ERROR_LOG,
+ | MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
*pport, NULL, NULL,
&ahc_echo, NULL,
MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c
index 00e4fa3e..f1a83ece 100644
--- a/src/testcurl/test_get_iovec.c
+++ b/src/testcurl/test_get_iovec.c
@@ -481,7 +481,7 @@ testMultithreadedPoolGet (void)
static unsigned int
-testExternalGet (void)
+testExternalGet (int thread_unsafe)
{
struct MHD_Daemon *d;
CURL *c;
@@ -516,7 +516,8 @@ testExternalGet (void)
cbc.buf = (char *) readbuf;
cbc.size = sizeof(readbuf);
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG
+ | (thread_unsafe ? MHD_USE_NO_THREAD_SAFETY : 0),
port, NULL, NULL, &ahc_cont, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
MHD_OPTION_END);
@@ -773,8 +774,9 @@ main (int argc, char *const *argv)
errorCount += testMultithreadedGet ();
errorCount += testMultithreadedPoolGet ();
errorCount += testUnknownPortGet ();
+ errorCount += testExternalGet (0);
}
- errorCount += testExternalGet ();
+ errorCount += testExternalGet (! 0);
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
curl_global_cleanup ();
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index 698a7c2e..01be8122 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -337,7 +337,7 @@ testMultithreadedPoolGet (void)
static unsigned int
-testExternalGet (void)
+testExternalGet (int thread_unsafe)
{
struct MHD_Daemon *d;
CURL *c;
@@ -373,7 +373,8 @@ testExternalGet (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG
+ | (thread_unsafe ? MHD_USE_NO_THREAD_SAFETY : 0),
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
MHD_OPTION_END);
@@ -660,8 +661,9 @@ main (int argc, char *const *argv)
errorCount += testMultithreadedGet ();
errorCount += testMultithreadedPoolGet ();
errorCount += testUnknownPortGet ();
+ errorCount += testExternalGet (0);
}
- errorCount += testExternalGet ();
+ errorCount += testExternalGet (! 0);
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
curl_global_cleanup ();
diff --git a/src/testcurl/test_head.c b/src/testcurl/test_head.c
index 4f820880..226663d3 100644
--- a/src/testcurl/test_head.c
+++ b/src/testcurl/test_head.c
@@ -756,7 +756,7 @@ testHead (void)
else
port = 4220 + oneone ? 0 : 1;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahcCheck, &ahc_param,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index d2612fa8..64669a44 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -647,7 +647,7 @@ testPutExternal (void)
cbc.size = 2048;
cbc.pos = 0;
multi = NULL;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port,
NULL, NULL, &ahc_echo, &done_flag,
MHD_OPTION_CONNECTION_MEMORY_LIMIT,
diff --git a/src/testcurl/test_parse_cookies.c
b/src/testcurl/test_parse_cookies.c
index d81f0765..41c408a9 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -1646,7 +1646,7 @@ testExternalPolling (void)
else
port = 1340 + oneone ? 0 : 6 + (uint16_t) (1 + discp_level);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahcCheck, &ahc_param,
MHD_OPTION_CLIENT_DISCIPLINE_LVL,
diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c
index e5f37901..c13712e0 100644
--- a/src/testcurl/test_patch.c
+++ b/src/testcurl/test_patch.c
@@ -374,7 +374,7 @@ testExternalPut (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port,
NULL, NULL, &ahc_echo, &done_flag,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index 3f64c0a4..58409cc1 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -433,7 +433,7 @@ testExternalPost (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index 7144abdd..5f2b7ad3 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -431,7 +431,7 @@ testExternalPost (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
MHD_OPTION_END);
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index bbd0d137..32809fa9 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -557,7 +557,7 @@ testExternalPost (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_process_arguments.c
b/src/testcurl/test_process_arguments.c
index f9720b89..8f010057 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -149,7 +149,7 @@ testExternalGet (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
MHD_OPTION_END);
diff --git a/src/testcurl/test_process_headers.c
b/src/testcurl/test_process_headers.c
index ce30b8a9..34f52d5a 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -406,7 +406,7 @@ testExternalGet (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL, &ahc_echo, NULL,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
MHD_OPTION_END);
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 97ed8591..e321a0b4 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -398,7 +398,7 @@ testExternalPut (void)
cbc.buf = buf;
cbc.size = 2048;
cbc.pos = 0;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port,
NULL, NULL, &ahc_echo, &done_flag,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_put_broken_len.c
b/src/testcurl/test_put_broken_len.c
index 65e8cd82..52a48c79 100644
--- a/src/testcurl/test_put_broken_len.c
+++ b/src/testcurl/test_put_broken_len.c
@@ -628,7 +628,7 @@ performTest (void)
else
port = 4220 + oneone ? 0 : 1;
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahcCheck, &ahc_param,
MHD_OPTION_APP_FD_SETSIZE, (int) FD_SETSIZE,
diff --git a/src/testcurl/test_put_header_fold.c
b/src/testcurl/test_put_header_fold.c
index 9b77ed99..ad9b7450 100644
--- a/src/testcurl/test_put_header_fold.c
+++ b/src/testcurl/test_put_header_fold.c
@@ -1147,7 +1147,7 @@ performCheck (void)
mem_limit = (size_t) ((TEST_UPLOAD_DATA_SIZE * 4) / 3 + 2
+ HEADERS_POINTERS_SIZE);
- d = MHD_start_daemon (MHD_USE_ERROR_LOG,
+ d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_NO_THREAD_SAFETY,
port, NULL, NULL,
&ahcCheck, &ahc_param,
MHD_OPTION_CONNECTION_MEMORY_LIMIT, mem_limit,
diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c
index e5d519c3..414f5c4f 100644
--- a/src/testcurl/test_toolarge.c
+++ b/src/testcurl/test_toolarge.c
@@ -1453,7 +1453,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
if (testMhdThreadExternal == thrType)
d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
- | (verbose ? MHD_USE_ERROR_LOG : 0),
+ | (verbose ? MHD_USE_ERROR_LOG : 0)
+ | MHD_USE_NO_THREAD_SAFETY,
*pport, NULL, NULL,
&ahcCheck, *ahc_param,
MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb,
diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c
index b3f52484..8cb53a80 100644
--- a/src/testcurl/test_tricky.c
+++ b/src/testcurl/test_tricky.c
@@ -964,7 +964,8 @@ startTestMhdDaemon (enum testMhdThreadsType thrType,
if (testMhdThreadExternal == thrType)
d = MHD_start_daemon (((unsigned int) thrType) | ((unsigned int) pollType)
- | (verbose ? MHD_USE_ERROR_LOG : 0),
+ | (verbose ? MHD_USE_ERROR_LOG : 0)
+ | MHD_USE_NO_THREAD_SAFETY,
*pport, NULL, NULL,
&ahcCheck, *ahc_param,
MHD_OPTION_URI_LOG_CALLBACK, &check_uri_cb,
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index c1a245d6..a687555a 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -1272,9 +1272,12 @@ print_test_starting (unsigned int daemon_flags)
else
{
if (0 != (MHD_USE_EPOLL & daemon_flags))
- printf ("\nStarting test with external polling and internal 'epoll'.\n");
+ printf ("\nStarting test with%s thread safety with external polling "
+ "and internal 'epoll'.\n",
+ ((0 != (MHD_USE_NO_THREAD_SAFETY & daemon_flags)) ? "out" : ""));
else
- printf ("\nStarting test with external polling.\n");
+ printf ("\nStarting test with%s thread safety with external polling.\n",
+ ((0 != (MHD_USE_NO_THREAD_SAFETY & daemon_flags)) ? "out" : ""));
}
fflush (stdout);
}
@@ -1623,8 +1626,9 @@ run_all_checks (void)
if ((77 == testRes) || (99 == testRes))
return testRes;
}
+ testRes = testExternalPolling (&port, MHD_NO_FLAG);
}
- testRes = testExternalPolling (&port, MHD_NO_FLAG);
+ testRes = testExternalPolling (&port, MHD_USE_NO_THREAD_SAFETY);
if ((77 == testRes) || (99 == testRes))
return testRes;
ret += testRes;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 04/13: MHD_start_daemon(): reject INTERNAL_POLLING_THREAD if threads are disabled, (continued)
- [libmicrohttpd] 04/13: MHD_start_daemon(): reject INTERNAL_POLLING_THREAD if threads are disabled, gnunet, 2023/11/23
- [libmicrohttpd] 02/13: MHD_quiesce_daemon(): fixed return value if already quiesced, gnunet, 2023/11/23
- [libmicrohttpd] 05/13: Moved user options counter to shorter its lifetime, gnunet, 2023/11/23
- [libmicrohttpd] 06/13: test_daemon: fixed to not skip if failed, gnunet, 2023/11/23
- [libmicrohttpd] 08/13: Improved daemon shutdown handling in external polling mode, gnunet, 2023/11/23
- [libmicrohttpd] 07/13: test_digestauth2: fixed order of the initial checks, gnunet, 2023/11/23
- [libmicrohttpd] 09/13: Micro-optimisations for non-overridable FD_SETSIZE, gnunet, 2023/11/23
- [libmicrohttpd] 13/13: Officially support zero for MHD_OPTION_THREAD_POOL_SIZE, gnunet, 2023/11/23
- [libmicrohttpd] 10/13: Unified and simplified fd_set filling, gnunet, 2023/11/23
- [libmicrohttpd] 11/13: Added new daemon flag MHD_USE_NO_THREAD_SAFETY, gnunet, 2023/11/23
- [libmicrohttpd] 12/13: Tests: added use of MHD_USE_NO_THREAD_SAFETY flag,
gnunet <=