gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 06/13: test_daemon: fixed to not skip if failed


From: gnunet
Subject: [libmicrohttpd] 06/13: test_daemon: fixed to not skip if failed
Date: Thu, 23 Nov 2023 11:49:09 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 9dcf06f9eb1365d641824b44a5549c120a060099
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Oct 27 11:41:53 2023 +0300

    test_daemon: fixed to not skip if failed
---
 src/microhttpd/test_daemon.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c
index b759bc98..00c83c63 100644
--- a/src/microhttpd/test_daemon.c
+++ b/src/microhttpd/test_daemon.c
@@ -1,6 +1,7 @@
 /*
      This file is part of libmicrohttpd
      Copyright (C) 2007, 2017 Christian Grothoff
+     Copyright (C) 2014--2023  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
@@ -22,6 +23,7 @@
  * @file test_daemon.c
  * @brief  Testcase for libmicrohttpd starts and stops
  * @author Christian Grothoff
+ * @author Karlson2k (Evgeny Grin)
  */
 
 #include "platform.h"
@@ -106,7 +108,7 @@ testStartStop (void)
     fprintf (stderr,
              "Failed to start daemon on port %u\n",
              (unsigned int) 0);
-    exit (77);
+    exit (3);
   }
   MHD_stop_daemon (d);
   return 0;
@@ -133,10 +135,9 @@ testExternalRun (void)
     fprintf (stderr,
              "Failed to start daemon on port %u\n",
              (unsigned int) 0);
-    exit (77);
+    exit (3);
   }
-  i = 0;
-  while (i < 15)
+  for (i = 0; i < 15; ++i)
   {
     maxfd = 0;
     FD_ZERO (&rs);
@@ -147,14 +148,13 @@ testExternalRun (void)
                "Failed in MHD_get_fdset().\n");
       return 256;
     }
-    if (MHD_run (d) == MHD_NO)
+    if (MHD_NO == MHD_run (d))
     {
       MHD_stop_daemon (d);
       fprintf (stderr,
                "Failed in MHD_run().\n");
       return 8;
     }
-    i++;
   }
   MHD_stop_daemon (d);
   return 0;
@@ -176,8 +176,8 @@ testThread (void)
   {
     fprintf (stderr,
              "Failed to start daemon on port %u.\n",
-             (unsigned int) 1082);
-    exit (77);
+             (unsigned int) 0);
+    exit (3);
   }
   if (MHD_run (d) != MHD_NO)
   {
@@ -207,7 +207,7 @@ testMultithread (void)
     fprintf (stderr,
              "Failed to start daemon on port %u\n",
              (unsigned int) 0);
-    exit (77);
+    exit (3);
   }
   if (MHD_run (d) != MHD_NO)
   {
@@ -225,13 +225,20 @@ main (int argc,
       char *const *argv)
 {
   unsigned int errorCount = 0;
+  int has_threads_support;
   (void) argc; (void) argv; /* Unused. Silent compiler warning. */
 
+  has_threads_support =
+    (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_THREADS));
   errorCount += testStartError ();
-  errorCount += testStartStop ();
+  if (has_threads_support)
+    errorCount += testStartStop ();
   errorCount += testExternalRun ();
-  errorCount += testThread ();
-  errorCount += testMultithread ();
+  if (has_threads_support)
+  {
+    errorCount += testThread ();
+    errorCount += testMultithread ();
+  }
   if (0 != errorCount)
     fprintf (stderr,
              "Error (code: %u)\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]