gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (376afc84 -> 0ea5d514)


From: gnunet
Subject: [libmicrohttpd] branch master updated (376afc84 -> 0ea5d514)
Date: Sat, 15 Jan 2022 15:47:40 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 376afc84 test_upgrade: added detailed error reporting and add some 
check for return values
     new c5c6afee test_upgrade: replaced a few left abort() with meaningful 
descriptions
     new 34a6a025 test_upgrade: don't fail with particular sockets errors
     new b5a7f183 test_upgrade: fail if connection is closed when it shouldn't
     new 8c4f7ce1 test_upgrade: use 'volatile' for variable with multithread 
access
     new 42d39ec4 test_upgrade: minor code refactoring
     new dab2e231 test_upgrade: added missing fflush()
     new d44b9b23 test_upgrade_large: applied fixes and improvements from 
test_upgrade
     new 0a478564 test_upgrade{,_large}: simplified stdout,stderr flushing
     new 0ea5d514 test_upgrade{,_large}: used the same port for all checks.

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/test_upgrade.c       | 108 ++++++---
 src/microhttpd/test_upgrade_large.c | 439 ++++++++++++++++++++++++++++--------
 2 files changed, 411 insertions(+), 136 deletions(-)

diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 152bc85b..fa91f7dc 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -1,6 +1,7 @@
 /*
      This file is part of libmicrohttpd
-     Copyright (C) 2016 Christian Grothoff
+     Copyright (C) 2016-2020 Christian Grothoff
+     Copyright (C) 2016-2022 Evgeny Grin (Karlson2k)
 
      libmicrohttpd is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -163,8 +164,18 @@ _testErrorLog_func (const char *errDesc, const char 
*funcName, int lineNum)
 #endif
 
 
+static void
+fflush_allstd (void)
+{
+  fflush (stderr);
+  fflush (stdout);
+}
+
+
 static int verbose = 0;
 
+static uint16_t global_port;
+
 enum tls_tool
 {
   TLS_CLI_NO_TOOL = 0,
@@ -196,7 +207,10 @@ gnutlscli_connect (int *sock,
                        SOCK_STREAM,
                        0,
                        sp))
-    return -1;
+  {
+    testErrorLogDesc ("socketpair() failed");
+    return (pid_t) -1;
+  }
   chld = fork ();
   if (0 != chld)
   {
@@ -208,9 +222,9 @@ gnutlscli_connect (int *sock,
   (void) close (0);
   (void) close (1);
   if (-1 == dup2 (sp[0], 0))
-    abort ();
+    externalErrorExitDesc ("dup2() failed");
   if (-1 == dup2 (sp[0], 1))
-    abort ();
+    externalErrorExitDesc ("dup2() failed");
   MHD_socket_close_chk_ (sp[0]);
   if (TLS_CLI_GNUTLS == use_tls_tool)
   {
@@ -569,7 +583,7 @@ static pthread_t pt;
 /**
  * Will be set to the upgraded socket.
  */
-static struct wr_socket *usock;
+static struct wr_socket *volatile usock;
 
 /**
  * Thread we use to run the interaction with the upgraded socket.
@@ -769,7 +783,8 @@ send_all (struct wr_socket *sock,
                    len - off);
     if (0 > ret)
     {
-      if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()))
+      if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()) ||
+          MHD_SCKT_ERR_IS_EINTR_ (MHD_socket_get_error_ ()))
       {
         ret = 0;
         continue;
@@ -804,10 +819,12 @@ recv_hdr (struct wr_socket *sock)
     {
       if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()))
         continue;
+      if (MHD_SCKT_ERR_IS_EINTR_ (MHD_socket_get_error_ ()))
+        continue;
       externalErrorExitDesc ("recv() failed");
     }
     if (0 == ret)
-      continue; /* TODO: replace with error exit! */
+      mhdErrorExitDesc ("The server unexpectedly closed connection");
     if (c == next)
     {
       i++;
@@ -846,13 +863,16 @@ recv_all (struct wr_socket *sock,
                    len - off);
     if (0 > ret)
     {
-      if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()))
+      if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()) ||
+          MHD_SCKT_ERR_IS_EINTR_ (MHD_socket_get_error_ ()))
       {
         ret = 0;
         continue;
       }
       externalErrorExitDesc ("recv() failed");
     }
+    if (0 == ret)
+      mhdErrorExitDesc ("The server unexpectedly closed connection");
   }
   if (0 != strncmp (text, buf, len))
   {
@@ -1104,7 +1124,17 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
                              &ws,
                              &es,
                              &tv))
-      mhdErrorExitDesc ("MHD_get_fdset() failed"); /* TODO: handle errors */
+    {
+#ifdef MHD_POSIX_SOCKETS
+      if (EINTR != errno)
+        externalErrorExitDesc ("Unexpected select() error");
+#else
+      if ((WSAEINVAL != WSAGetLastError ()) ||
+          (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) )
+        externalErrorExitDesc ("Unexpected select() error");
+      Sleep (tv.tv_sec * 1000 + tv.tv_usec / 1000);
+#endif
+    }
     MHD_run_from_select (daemon,
                          &rs,
                          &ws,
@@ -1169,10 +1199,18 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
                   NULL,
                   NULL,
                   &tv);
-    if ( (-1 == ret) &&
-         (EAGAIN != errno) &&
-         (EINTR != errno) )
-      mhdErrorExitDesc ("MHD_get_fdset() failed"); /* TODO: handle errors */
+    if (0 > ret)
+    {
+#ifdef MHD_POSIX_SOCKETS
+      if (EINTR != errno)
+        externalErrorExitDesc ("Unexpected select() error");
+#else
+      if ((WSAEINVAL != WSAGetLastError ()) ||
+          (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) )
+        externalErrorExitDesc ("Unexpected select() error");
+      Sleep (tv.tv_sec * 1000 + tv.tv_usec / 1000);
+#endif
+    }
     MHD_run (daemon);
   }
 }
@@ -1200,7 +1238,7 @@ run_mhd_loop (struct MHD_Daemon *daemon,
     run_mhd_epoll_loop (daemon);
 #endif
   else
-    abort ();
+    externalErrorExitDesc ("Wrong 'flags' value");
 }
 
 
@@ -1229,9 +1267,7 @@ test_upgrade (int flags,
 
   if (! test_tls)
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -1245,9 +1281,7 @@ test_upgrade (int flags,
   else
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE
                           | MHD_USE_TLS,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL,
@@ -1271,6 +1305,7 @@ test_upgrade (int flags,
   if ( (NULL == dinfo) ||
        (0 == dinfo->port) )
     mhdErrorExitDesc ("MHD_get_daemon_info() failed");
+  global_port = dinfo->port; /* Re-use the same port for the next checks */
   if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool))
   {
     sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
@@ -1398,6 +1433,9 @@ main (int argc,
 #endif /* ! HTTPS_SUPPORT */
   }
 
+  global_port = MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT) ?
+                0 : (test_tls ? 1091 : 1090);
+
   /* run tests */
   if (verbose)
     printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n",
@@ -1405,6 +1443,7 @@ main (int argc,
   /* try external select */
   res = test_upgrade (0,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1416,6 +1455,7 @@ main (int argc,
   /* Try external auto */
   res = test_upgrade (MHD_USE_AUTO,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1427,6 +1467,7 @@ main (int argc,
 #ifdef EPOLL_SUPPORT
   res = test_upgrade (MHD_USE_EPOLL,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1440,6 +1481,7 @@ main (int argc,
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD
                       | MHD_USE_THREAD_PER_CONNECTION,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1451,6 +1493,7 @@ main (int argc,
   res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD
                       | MHD_USE_THREAD_PER_CONNECTION,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1462,6 +1505,7 @@ main (int argc,
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD
                       | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1474,8 +1518,7 @@ main (int argc,
   /* Test different event loops, with and without thread pool */
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD,
                       0);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1485,8 +1528,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal select.\n");
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD,
                       2);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1496,8 +1538,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal select with thread pool.\n");
   res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
                       0);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1507,8 +1548,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal 'auto'.\n");
   res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
                       2);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1519,8 +1559,7 @@ main (int argc,
 #ifdef HAVE_POLL
   res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD,
                       0);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1530,8 +1569,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal poll.\n");
   res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD,
                       2);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   if (res)
     fprintf (stderr,
              "FAILED: Upgrade with internal poll with thread pool, return code 
%d.\n",
@@ -1542,8 +1580,7 @@ main (int argc,
 #ifdef EPOLL_SUPPORT
   res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD,
                       0);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   if (res)
     fprintf (stderr,
              "FAILED: Upgrade with internal epoll, return code %d.\n",
@@ -1552,8 +1589,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal epoll.\n");
   res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD,
                       2);
-  fflush (stderr);
-  fflush (stdout);
+  fflush_allstd ();
   if (res)
     fprintf (stderr,
              "FAILED: Upgrade with internal epoll, return code %d.\n",
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index 817408fb..3ccb1985 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -1,6 +1,7 @@
 /*
      This file is part of libmicrohttpd
-     Copyright (C) 2016, 2019 Christian Grothoff
+     Copyright (C) 2016-2020 Christian Grothoff
+     Copyright (C) 2016-2022 Evgeny Grin (Karlson2k)
 
      libmicrohttpd is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -46,12 +47,23 @@
 #include <netinet/ip.h>
 #endif /* HAVE_NETINET_IP_H */
 
+#ifdef HTTPS_SUPPORT
+#include <gnutls/gnutls.h>
+#include "../testcurl/https/tls_test_keys.h"
+
+#if defined(HAVE_FORK) && defined(HAVE_WAITPID)
+#include <sys/types.h>
+#include <sys/wait.h>
+#endif /* HAVE_FORK && HAVE_WAITPID */
+#endif /* HTTPS_SUPPORT */
+
 #include "platform.h"
 #include "microhttpd.h"
 #include "mhd_itc.h"
 
 #include "test_helpers.h"
 
+
 #define LARGE_STRING \
   
"HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello"
 \
   
"HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello"
 \
@@ -212,18 +224,122 @@
   
"WorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorld"
 \
   
"WorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorldWorld\n"
 
-#ifdef HTTPS_SUPPORT
-#include <gnutls/gnutls.h>
-#include "../testcurl/https/tls_test_keys.h"
 
-#if defined(HAVE_FORK) && defined(HAVE_WAITPID)
-#include <sys/types.h>
-#include <sys/wait.h>
-#endif /* HAVE_FORK && HAVE_WAITPID */
-#endif /* HTTPS_SUPPORT */
+_MHD_NORETURN static void
+_externalErrorExit_func (const char *errDesc, const char *funcName, int 
lineNum)
+{
+  fflush (stdout);
+  if ((NULL != errDesc) && (0 != errDesc[0]))
+    fprintf (stderr, "%s", errDesc);
+  else
+    fprintf (stderr, "System or external library call failed");
+  if ((NULL != funcName) && (0 != funcName[0]))
+    fprintf (stderr, " in %s", funcName);
+  if (0 < lineNum)
+    fprintf (stderr, " at line %d", lineNum);
+
+  fprintf (stderr, ".\nLast errno value: %d (%s)\n", (int) errno,
+           strerror (errno));
+#ifdef MHD_WINSOCK_SOCKETS
+  fprintf (stderr, "WSAGetLastError() value: %d\n", (int) WSAGetLastError ());
+#endif /* MHD_WINSOCK_SOCKETS */
+  fflush (stderr);
+  exit (99);
+}
+
+
+_MHD_NORETURN static void
+_mhdErrorExit_func (const char *errDesc, const char *funcName, int lineNum)
+{
+  fflush (stdout);
+  if ((NULL != errDesc) && (0 != errDesc[0]))
+    fprintf (stderr, "%s", errDesc);
+  else
+    fprintf (stderr, "MHD unexpected error");
+  if ((NULL != funcName) && (0 != funcName[0]))
+    fprintf (stderr, " in %s", funcName);
+  if (0 < lineNum)
+    fprintf (stderr, " at line %d", lineNum);
+
+  fprintf (stderr, ".\nLast errno value: %d (%s)\n", (int) errno,
+           strerror (errno));
+
+  fflush (stderr);
+  exit (8);
+}
+
+
+static void
+_testErrorLog_func (const char *errDesc, const char *funcName, int lineNum)
+{
+  fflush (stdout);
+  if ((NULL != errDesc) && (0 != errDesc[0]))
+    fprintf (stderr, "%s", errDesc);
+  else
+    fprintf (stderr, "System or external library call resulted in error");
+  if ((NULL != funcName) && (0 != funcName[0]))
+    fprintf (stderr, " in %s", funcName);
+  if (0 < lineNum)
+    fprintf (stderr, " at line %d", lineNum);
+
+  fprintf (stderr, ".\nLast errno value: %d (%s)\n", (int) errno,
+           strerror (errno));
+#ifdef MHD_WINSOCK_SOCKETS
+  fprintf (stderr, "WSAGetLastError() value: %d\n", (int) WSAGetLastError ());
+#endif /* MHD_WINSOCK_SOCKETS */
+  fflush (stderr);
+}
+
+
+#if defined(HAVE___FUNC__)
+#define externalErrorExit(ignore) \
+    _externalErrorExit_func(NULL, __func__, __LINE__)
+#define externalErrorExitDesc(errDesc) \
+    _externalErrorExit_func(errDesc, __func__, __LINE__)
+#define mhdErrorExit(ignore) \
+    _mhdErrorExit_func(NULL, __func__, __LINE__)
+#define mhdErrorExitDesc(errDesc) \
+    _mhdErrorExit_func(errDesc, __func__, __LINE__)
+#define testErrorLog(ignore) \
+    _testErrorLog_func(NULL, __func__, __LINE__)
+#define testErrorLogDesc(errDesc) \
+    _testErrorLog_func(errDesc, __func__, __LINE__)
+#elif defined(HAVE___FUNCTION__)
+#define externalErrorExit(ignore) \
+    _externalErrorExit_func(NULL, __FUNCTION__, __LINE__)
+#define externalErrorExitDesc(errDesc) \
+    _externalErrorExit_func(errDesc, __FUNCTION__, __LINE__)
+#define mhdErrorExit(ignore) \
+    _mhdErrorExit_func(NULL, __FUNCTION__, __LINE__)
+#define mhdErrorExitDesc(errDesc) \
+    _mhdErrorExit_func(errDesc, __FUNCTION__, __LINE__)
+#define testErrorLog(ignore) \
+    _testErrorLog_func(NULL, __FUNCTION__, __LINE__)
+#define testErrorLogDesc(errDesc) \
+    _testErrorLog_func(errDesc, __FUNCTION__, __LINE__)
+#else
+#define externalErrorExit(ignore) _externalErrorExit_func(NULL, NULL, __LINE__)
+#define externalErrorExitDesc(errDesc) \
+  _externalErrorExit_func(errDesc, NULL, __LINE__)
+#define mhdErrorExit(ignore) _mhdErrorExit_func(NULL, NULL, __LINE__)
+#define mhdErrorExitDesc(errDesc) _mhdErrorExit_func(errDesc, NULL, __LINE__)
+#define testErrorLog(ignore) _testErrorLog_func(NULL, NULL, __LINE__)
+#define testErrorLogDesc(errDesc) _testErrorLog_func(errDesc, NULL, __LINE__)
+#endif
+
+
+static void
+fflush_allstd (void)
+{
+  fflush (stderr);
+  fflush (stdout);
+}
+
 
 static int verbose = 0;
 
+static uint16_t global_port;
+
 static struct MHD_itc_ kicker = MHD_ITC_STATIC_INIT_INVALID;
 
 enum tls_tool
@@ -257,7 +373,10 @@ gnutlscli_connect (int *sock,
                        SOCK_STREAM,
                        0,
                        sp))
-    return -1;
+  {
+    testErrorLogDesc ("socketpair() failed");
+    return (pid_t) -1;
+  }
   chld = fork ();
   if (0 != chld)
   {
@@ -269,9 +388,9 @@ gnutlscli_connect (int *sock,
   (void) close (0);
   (void) close (1);
   if (-1 == dup2 (sp[0], 0))
-    abort ();
+    externalErrorExitDesc ("dup2() failed");
   if (-1 == dup2 (sp[0], 1))
-    abort ();
+    externalErrorExitDesc ("dup2() failed");
   MHD_socket_close_chk_ (sp[0]);
   if (TLS_CLI_GNUTLS == use_tls_tool)
   {
@@ -363,11 +482,15 @@ wr_create_plain_sckt (void)
 {
   struct wr_socket *s = malloc (sizeof(struct wr_socket));
   if (NULL == s)
+  {
+    testErrorLogDesc ("malloc() failed");
     return NULL;
+  }
   s->t = wr_plain;
   s->fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
   if (MHD_INVALID_SOCKET != s->fd)
-    return s;
+    return s; /* Success */
+  testErrorLogDesc ("socket() failed");
   free (s);
   return NULL;
 }
@@ -383,7 +506,10 @@ wr_create_tls_sckt (void)
 #ifdef HTTPS_SUPPORT
   struct wr_socket *s = malloc (sizeof(struct wr_socket));
   if (NULL == s)
+  {
+    testErrorLogDesc ("malloc() failed");
     return NULL;
+  }
   s->t = wr_tls;
   s->tls_connected = 0;
   s->fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -408,13 +534,23 @@ wr_create_tls_sckt (void)
 #endif /* GnuTLS before 3.1.9 or Win x64 */
             return s;
           }
+          else
+            testErrorLogDesc ("gnutls_credentials_set() failed");
           gnutls_certificate_free_credentials (s->tls_crd);
         }
+        else
+          testErrorLogDesc ("gnutls_certificate_allocate_credentials() 
failed");
       }
+      else
+        testErrorLogDesc ("gnutls_set_default_priority() failed");
       gnutls_deinit (s->tls_s);
     }
+    else
+      testErrorLogDesc ("gnutls_init() failed");
     (void) MHD_socket_close_ (s->fd);
   }
+  else
+    testErrorLogDesc ("socket() failed");
   free (s);
 #endif /* HTTPS_SUPPORT */
   return NULL;
@@ -433,7 +569,10 @@ wr_create_from_plain_sckt (MHD_socket plain_sk)
   struct wr_socket *s = malloc (sizeof(struct wr_socket));
 
   if (NULL == s)
+  {
+    testErrorLogDesc ("malloc() failed");
     return NULL;
+  }
   s->t = wr_plain;
   s->fd = plain_sk;
   return s;
@@ -453,7 +592,10 @@ wr_connect (struct wr_socket *s,
             int length)
 {
   if (0 != connect (s->fd, addr, length))
+  {
+    testErrorLogDesc ("connect() failed");
     return -1;
+  }
   if (wr_plain == s->t)
     return 0;
 #ifdef HTTPS_SUPPORT
@@ -468,6 +610,8 @@ wr_connect (struct wr_socket *s,
     return 0;
   }
 #endif /* HTTPS_SUPPORT */
+  testErrorLogDesc ("HTTPS socket connect called, but code does not support" \
+                    " HTTPS sockets");
   return -1;
 }
 
@@ -483,7 +627,10 @@ wr_handshake (struct wr_socket *s)
   else if (GNUTLS_E_AGAIN == res)
     MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
   else
+  {
+    testErrorLogDesc ("gnutls_handshake() failed with hard error");
     MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */
+  }
   return s->tls_connected;
 }
 
@@ -507,13 +654,7 @@ wr_send (struct wr_socket *s,
          size_t len)
 {
   if (wr_plain == s->t)
-  {
-    ssize_t ret;
-
-    ret = MHD_send_ (s->fd, buf, len);
-
-    return ret;
-  }
+    return MHD_send_ (s->fd, buf, len);
 #ifdef HTTPS_SUPPORT
   if (wr_tls == s->t)
   {
@@ -521,17 +662,22 @@ wr_send (struct wr_socket *s,
 
     if (! s->tls_connected && ! wr_handshake (s))
       return -1;
-    ret = gnutls_record_send (s->tls_s,
-                              buf,
-                              len);
+
+    ret = gnutls_record_send (s->tls_s, buf, len);
     if (ret > 0)
       return ret;
     if (GNUTLS_E_AGAIN == ret)
       MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
     else
-      MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);   /* hard error */
+    {
+      testErrorLogDesc ("gnutls_record_send() failed with hard error");
+      MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);  /* hard error */
+      return -1;
+    }
   }
 #endif /* HTTPS_SUPPORT */
+  testErrorLogDesc ("HTTPS socket send called, but code does not support" \
+                    " HTTPS sockets");
   return -1;
 }
 
@@ -565,7 +711,11 @@ wr_recv (struct wr_socket *s,
     if (GNUTLS_E_AGAIN == ret)
       MHD_socket_set_error_ (MHD_SCKT_EAGAIN_);
     else
-      MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);   /* hard error */
+    {
+      testErrorLogDesc ("gnutls_record_recv() failed with hard error");
+      MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_);  /* hard error */
+      return -1;
+    }
   }
 #endif /* HTTPS_SUPPORT */
   return -1;
@@ -601,7 +751,7 @@ static pthread_t pt;
 /**
  * Will be set to the upgraded socket.
  */
-static struct wr_socket *usock;
+static struct wr_socket *volatile usock;
 
 /**
  * Thread we use to run the interaction with the upgraded socket.
@@ -614,6 +764,32 @@ static pthread_t pt_client;
 static volatile bool done;
 
 
+const char *
+term_reason_str (enum MHD_RequestTerminationCode term_code)
+{
+  switch ((int) term_code)
+  {
+  case MHD_REQUEST_TERMINATED_COMPLETED_OK:
+    return "COMPLETED_OK";
+  case MHD_REQUEST_TERMINATED_WITH_ERROR:
+    return "TERMINATED_WITH_ERROR";
+  case MHD_REQUEST_TERMINATED_TIMEOUT_REACHED:
+    return "TIMEOUT_REACHED";
+  case MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN:
+    return "DAEMON_SHUTDOWN";
+  case MHD_REQUEST_TERMINATED_READ_ERROR:
+    return "READ_ERROR";
+  case MHD_REQUEST_TERMINATED_CLIENT_ABORT:
+    return "CLIENT_ABORT";
+  case -1:
+    return "(not called)";
+  default:
+    return "(unknown code)";
+  }
+  return "(problem)"; /* unreachable */
+}
+
+
 /**
  * Callback used by MHD to notify the application about completed
  * requests.  Frees memory.
@@ -630,19 +806,23 @@ notify_completed_cb (void *cls,
                      void **con_cls,
                      enum MHD_RequestTerminationCode toe)
 {
-  pthread_t *ppth = *con_cls;
-
   (void) cls;
   (void) connection;  /* Unused. Silent compiler warning. */
+  if (verbose)
+    printf ("notify_completed_cb() has been called with '%s' code.\n",
+            term_reason_str (toe));
   if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) &&
        (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) &&
        (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) )
-    abort ();
+    mhdErrorExitDesc ("notify_completed_cb() called with wrong code");
+  if (NULL == con_cls)
+    mhdErrorExitDesc ("'con_cls' parameter is NULL");
+  if (NULL == *con_cls)
+    mhdErrorExitDesc ("'*con_cls' pointer is NULL");
   if (! pthread_equal (**((pthread_t **) con_cls),
                        pthread_self ()))
-    abort ();
-  if (NULL != ppth)
-    free (*con_cls);
+    mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread");
+  free (*con_cls);
   *con_cls = NULL;
 }
 
@@ -664,12 +844,16 @@ log_cb (void *cls,
 
   (void) cls;
   (void) connection;  /* Unused. Silent compiler warning. */
-  if (0 != strcmp (uri,
-                   "/"))
-    abort ();
+  if (NULL == uri)
+    mhdErrorExitDesc ("The 'uri' parameter is NULL");
+  if (0 != strcmp (uri, "/"))
+  {
+    fprintf (stderr, "Wrong 'uri' value: '%s'. ", uri);
+    mhdErrorExit ();
+  }
   ppth = malloc (sizeof (pthread_t));
   if (NULL == ppth)
-    abort ();
+    externalErrorExitDesc ("malloc() failed");
   *ppth = pthread_self ();
   return (void *) ppth;
 }
@@ -708,15 +892,15 @@ notify_connection_cb (void *cls,
   {
   case MHD_CONNECTION_NOTIFY_STARTED:
     if (MHD_NO != started)
-      abort ();
+      mhdErrorExitDesc ("The connection has been already started");
     started = MHD_YES;
     *socket_context = &started;
     break;
   case MHD_CONNECTION_NOTIFY_CLOSED:
     if (MHD_YES != started)
-      abort ();
+      mhdErrorExitDesc ("The connection has not been started before");
     if (&started != *socket_context)
-      abort ();
+      mhdErrorExitDesc ("Wrong '*socket_context' value");
     *socket_context = NULL;
     started = MHD_NO;
     break;
@@ -737,15 +921,15 @@ make_blocking (MHD_socket fd)
 
   flags = fcntl (fd, F_GETFL);
   if (-1 == flags)
-    abort ();
+    externalErrorExitDesc ("fcntl() failed");
   if ((flags & ~O_NONBLOCK) != flags)
     if (-1 == fcntl (fd, F_SETFL, flags & ~O_NONBLOCK))
-      abort ();
+      externalErrorExitDesc ("fcntl() failed");
 #elif defined(MHD_WINSOCK_SOCKETS)
   unsigned long flags = 0;
 
   if (0 != ioctlsocket (fd, (int) FIONBIO, &flags))
-    abort ();
+    externalErrorExitDesc ("ioctlsocket() failed");
 #endif /* MHD_WINSOCK_SOCKETS */
 }
 
@@ -776,9 +960,11 @@ send_all (struct wr_socket *sock,
                    len - off);
     if (0 > ret)
     {
-      if (! MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()))
-        abort ();
-      ret = 0;
+      if (! MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()) &&
+          ! MHD_SCKT_ERR_IS_EINTR_ (MHD_socket_get_error_ ()))
+        externalErrorExitDesc ("send() failed");
+      else
+        ret = 0;
     }
     kick_select ();
   }
@@ -809,13 +995,12 @@ recv_hdr (struct wr_socket *sock)
     {
       if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()))
         continue;
-      fprintf (stderr,
-               "recv failed unexpectedly: %s\n",
-               MHD_socket_last_strerr_ ());
-      abort ();
+      if (MHD_SCKT_ERR_IS_EINTR_ (MHD_socket_get_error_ ()))
+        continue;
+      externalErrorExitDesc ("recv() failed");
     }
     if (0 == ret)
-      continue;
+      mhdErrorExitDesc ("The server unexpectedly closed connection");
     kick_select ();
     if (c == next)
     {
@@ -855,18 +1040,29 @@ recv_all (struct wr_socket *sock,
                    len - off);
     if (0 > ret)
     {
-      if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()))
+      if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ()) ||
+          MHD_SCKT_ERR_IS_EINTR_ (MHD_socket_get_error_ ()))
       {
         ret = 0;
         continue;
       }
-      abort ();
+      externalErrorExitDesc ("recv() failed");
     }
+    if (0 == ret)
+      mhdErrorExitDesc ("The server unexpectedly closed connection");
     if (0 != strncmp (text, buf, off + ret))
-      abort ();
+    {
+      fprintf (stderr, "Wrong received text. Expected: '%s' ."
+               "Got: '%.*s'. ", text, (int) (off + ret), buf);
+      mhdErrorExit ();
+    }
   }
   if (0 != strncmp (text, buf, len))
-    abort ();
+  {
+    fprintf (stderr, "Wrong received text. Expected: '%s' ."
+             "Got: '%.*s'. ", text, (int) len, buf);
+    mhdErrorExit ();
+  }
 }
 
 
@@ -981,12 +1177,12 @@ upgrade_cb (void *cls,
 
   usock = wr_create_from_plain_sckt (sock);
   if (0 != extra_in_size)
-    abort ();
+    mhdErrorExitDesc ("'extra_in_size' is not zero");
   if (0 != pthread_create (&pt,
                            NULL,
                            &run_usock,
                            urh))
-    abort ();
+    externalErrorExitDesc ("pthread_create() failed");
 }
 
 
@@ -1040,7 +1236,6 @@ ahc_upgrade (void *cls,
              void **con_cls)
 {
   struct MHD_Response *resp;
-  enum MHD_Result ret;
   (void) cls;
   (void) url;
   (void) method;                        /* Unused. Silent compiler warning. */
@@ -1048,20 +1243,26 @@ ahc_upgrade (void *cls,
   (void) upload_data;
   (void) upload_data_size;  /* Unused. Silent compiler warning. */
 
+  if (NULL == con_cls)
+    mhdErrorExitDesc ("'con_cls' is NULL");
   if (NULL == *con_cls)
-    abort ();
+    mhdErrorExitDesc ("'*con_cls' value is NULL");
   if (! pthread_equal (**((pthread_t **) con_cls), pthread_self ()))
-    abort ();
+    mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread");
   resp = MHD_create_response_for_upgrade (&upgrade_cb,
                                           NULL);
-  MHD_add_response_header (resp,
-                           MHD_HTTP_HEADER_UPGRADE,
-                           "Hello World Protocol");
-  ret = MHD_queue_response (connection,
-                            MHD_HTTP_SWITCHING_PROTOCOLS,
-                            resp);
+  if (NULL == resp)
+    mhdErrorExitDesc ("MHD_create_response_for_upgrade() failed");
+  if (MHD_YES != MHD_add_response_header (resp,
+                                          MHD_HTTP_HEADER_UPGRADE,
+                                          "Hello World Protocol"))
+    mhdErrorExitDesc ("MHD_add_response_header() failed");
+  if (MHD_YES != MHD_queue_response (connection,
+                                     MHD_HTTP_SWITCHING_PROTOCOLS,
+                                     resp))
+    mhdErrorExitDesc ("MHD_queue_response() failed");
   MHD_destroy_response (resp);
-  return ret;
+  return MHD_YES;
 }
 
 
@@ -1095,7 +1296,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
                        &ws,
                        &es,
                        &max_fd))
-      abort ();
+      mhdErrorExitDesc ("MHD_get_fdset() failed");
     (void) MHD_get_timeout (daemon,
                             &to);
     if (1000 < to)
@@ -1107,7 +1308,17 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
                              &ws,
                              &es,
                              &tv))
-      abort ();
+    {
+#ifdef MHD_POSIX_SOCKETS
+      if (EINTR != errno)
+        externalErrorExitDesc ("Unexpected select() error");
+#else
+      if ((WSAEINVAL != WSAGetLastError ()) ||
+          (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) )
+        externalErrorExitDesc ("Unexpected select() error");
+      Sleep (tv.tv_sec * 1000 + tv.tv_usec / 1000);
+#endif
+    }
     if (FD_ISSET (MHD_itc_r_fd_ (kicker), &rs))
       MHD_itc_clear_ (kicker);
     MHD_run_from_select (daemon,
@@ -1129,7 +1340,7 @@ static void
 run_mhd_poll_loop (struct MHD_Daemon *daemon)
 {
   (void) daemon; /* Unused. Silent compiler warning. */
-  abort (); /* currently not implementable with existing MHD API */
+  externalErrorExitDesc ("Not implementable with MHD API");
 }
 
 
@@ -1154,6 +1365,8 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
 
   di = MHD_get_daemon_info (daemon,
                             MHD_DAEMON_INFO_EPOLL_FD);
+  if (NULL == di)
+    mhdErrorExitDesc ("MHD_get_daemon_info() failed");
   ep = di->listen_fd;
   while (! done)
   {
@@ -1172,10 +1385,18 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
                   NULL,
                   NULL,
                   &tv);
-    if ( (-1 == ret) &&
-         (EAGAIN != errno) &&
-         (EINTR != errno) )
-      abort ();
+    if (0 > ret)
+    {
+#ifdef MHD_POSIX_SOCKETS
+      if (EINTR != errno)
+        externalErrorExitDesc ("Unexpected select() error");
+#else
+      if ((WSAEINVAL != WSAGetLastError ()) ||
+          (0 != rs.fd_count) || (0 != ws.fd_count) || (0 != es.fd_count) )
+        externalErrorExitDesc ("Unexpected select() error");
+      Sleep (tv.tv_sec * 1000 + tv.tv_usec / 1000);
+#endif
+    }
     if (FD_ISSET (MHD_itc_r_fd_ (kicker), &rs))
       MHD_itc_clear_ (kicker);
     MHD_run (daemon);
@@ -1205,7 +1426,7 @@ run_mhd_loop (struct MHD_Daemon *daemon,
     run_mhd_epoll_loop (daemon);
 #endif
   else
-    abort ();
+    externalErrorExitDesc ("Wrong 'flags' value");
 }
 
 
@@ -1234,9 +1455,7 @@ test_upgrade (int flags,
 
   if (! test_tls)
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 512,
@@ -1251,9 +1470,7 @@ test_upgrade (int flags,
   else
     d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE
                           | MHD_USE_TLS,
-                          MHD_is_feature_supported (
-                            MHD_FEATURE_AUTODETECT_BIND_PORT) ?
-                          0 : 1090,
+                          global_port,
                           NULL, NULL,
                           &ahc_upgrade, NULL,
                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) 512,
@@ -1268,28 +1485,29 @@ test_upgrade (int flags,
                           MHD_OPTION_END);
 #endif /* HTTPS_SUPPORT */
   if (NULL == d)
-    return 2;
+    mhdErrorExitDesc ("MHD_start_daemon() failed");
   real_flags = MHD_get_daemon_info (d,
                                     MHD_DAEMON_INFO_FLAGS);
   if (NULL == real_flags)
-    abort ();
+    mhdErrorExitDesc ("MHD_get_daemon_info() failed");
   dinfo = MHD_get_daemon_info (d,
                                MHD_DAEMON_INFO_BIND_PORT);
   if ( (NULL == dinfo) ||
        (0 == dinfo->port) )
-    abort ();
+    mhdErrorExitDesc ("MHD_get_daemon_info() failed");
+  global_port = dinfo->port; /* Re-use the same port for the next checks */
   if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool))
   {
     sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
     if (NULL == sock)
-      abort ();
+      externalErrorExitDesc ("Create socket failed");
     sa.sin_family = AF_INET;
     sa.sin_port = htons (dinfo->port);
     sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
     if (0 != wr_connect (sock,
                          (struct sockaddr *) &sa,
                          sizeof (sa)))
-      abort ();
+      externalErrorExitDesc ("Connect socket failed");
   }
   else
   {
@@ -1303,30 +1521,27 @@ test_upgrade (int flags,
             sizeof (port));
     if (-1 == (pid = gnutlscli_connect (&tls_fork_sock,
                                         port)))
-    {
-      MHD_stop_daemon (d);
-      return 4;
-    }
+      externalErrorExitDesc ("gnutlscli_connect() failed");
 
     sock =  wr_create_from_plain_sckt (tls_fork_sock);
     if (NULL == sock)
-      abort ();
+      externalErrorExitDesc ("wr_create_from_plain_sckt() failed");
 #else  /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */
-    abort ();
+    externalErrorExitDesc ("Unsupported 'use_tls_tool' value");
 #endif /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */
   }
 
   if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
   {
     if (! MHD_itc_init_ (kicker))
-      abort ();
+      externalErrorExitDesc ("MHD_itc_init_() failed");
   }
 
   if (0 != pthread_create (&pt_client,
                            NULL,
                            &run_usock_client,
                            sock))
-    abort ();
+    externalErrorExitDesc ("pthread_create() failed");
   if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
   {
     enum MHD_FLAG used_flags;
@@ -1337,13 +1552,18 @@ test_upgrade (int flags,
             sizeof (used_flags));
     run_mhd_loop (d, used_flags);
   }
-  pthread_join (pt_client,
-                NULL);
-  pthread_join (pt,
-                NULL);
+  if (0 != pthread_join (pt_client,
+                         NULL))
+    externalErrorExitDesc ("pthread_join() failed");
+  if (0 != pthread_join (pt,
+                         NULL))
+    externalErrorExitDesc ("pthread_join() failed");
 #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID)
   if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool))
-    waitpid (pid, NULL, 0);
+  {
+    if ((pid_t) -1 == waitpid (pid, NULL, 0))
+      externalErrorExitDesc ("waitpid() failed");
+  }
 #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
   if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
   {
@@ -1400,18 +1620,22 @@ main (int argc,
         printf ("GnuTLS library will be used for testing.\n");
         break;
       default:
-        abort ();
+        externalErrorExitDesc ("Wrong 'use_tls_tool' value");
       }
     }
     if ( (TLS_LIB_GNUTLS == use_tls_tool) &&
          (GNUTLS_E_SUCCESS != gnutls_global_init ()) )
-      abort ();
+      externalErrorExitDesc ("gnutls_global_init() failed");
 
 #else  /* ! HTTPS_SUPPORT */
     fprintf (stderr, "HTTPS support was disabled by configure.\n");
     return 77;
 #endif /* ! HTTPS_SUPPORT */
   }
+
+  global_port = MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT) ?
+                0 : (test_tls ? 1093 : 1092);
+
   /* run tests */
   if (verbose)
     printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n",
@@ -1419,6 +1643,7 @@ main (int argc,
   /* try external select */
   res = test_upgrade (0,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1426,9 +1651,11 @@ main (int argc,
              res);
   else if (verbose)
     printf ("PASSED: Upgrade with external select.\n");
+
   /* Try external auto */
   res = test_upgrade (MHD_USE_AUTO,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1440,6 +1667,7 @@ main (int argc,
 #ifdef EPOLL_SUPPORT
   res = test_upgrade (MHD_USE_EPOLL,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1453,6 +1681,7 @@ main (int argc,
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD
                       | MHD_USE_THREAD_PER_CONNECTION,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1464,6 +1693,7 @@ main (int argc,
   res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD
                       | MHD_USE_THREAD_PER_CONNECTION,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1475,6 +1705,7 @@ main (int argc,
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD
                       | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1487,6 +1718,7 @@ main (int argc,
   /* Test different event loops, with and without thread pool */
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1496,6 +1728,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal select.\n");
   res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD,
                       2);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1505,6 +1738,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal select with thread pool.\n");
   res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1514,6 +1748,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal 'auto'.\n");
   res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
                       2);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1524,6 +1759,7 @@ main (int argc,
 #ifdef HAVE_POLL
   res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD,
                       0);
+  fflush_allstd ();
   error_count += res;
   if (res)
     fprintf (stderr,
@@ -1533,6 +1769,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal poll.\n");
   res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD,
                       2);
+  fflush_allstd ();
   if (res)
     fprintf (stderr,
              "FAILED: Upgrade with internal poll with thread pool, return code 
%d.\n",
@@ -1543,6 +1780,7 @@ main (int argc,
 #ifdef EPOLL_SUPPORT
   res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD,
                       0);
+  fflush_allstd ();
   if (res)
     fprintf (stderr,
              "FAILED: Upgrade with internal epoll, return code %d.\n",
@@ -1551,6 +1789,7 @@ main (int argc,
     printf ("PASSED: Upgrade with internal epoll.\n");
   res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD,
                       2);
+  fflush_allstd ();
   if (res)
     fprintf (stderr,
              "FAILED: Upgrade with internal epoll, return code %d.\n",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]