Update libtest.
[m6w6/libmemcached] / libtest / server_container.cc
index 0448e20900e2b847831a6f5c802a073e68eb9135..f87a9fba126cde97070b3b1525bb19a007c63d52 100644 (file)
@@ -182,7 +182,7 @@ bool server_startup_st::validate()
 
 bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[], const bool opt_startup_message)
 {
-  construct.start_server(server_type, try_port, argc, argv, opt_startup_message);
+  return construct.start_server(server_type, try_port, argc, argv, opt_startup_message);
 }
 
 bool server_startup_st::start_server(const std::string& server_type, in_port_t try_port, int argc, const char *argv[], const bool opt_startup_message)
@@ -274,7 +274,13 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
     {
       throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Launching of an unknown server was attempted: %s", server_type.c_str());
     }
+  }
+  catch (...)
+  {
+    throw;
+  }
 
+  try {
     /*
       We will now cycle the server we have created.
     */
@@ -296,20 +302,30 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t
     }
     else
 #endif
+
       if (server->start() == false)
+      {
+        delete server;
+        return false;
+      }
+      else
+      {
+        if (opt_startup_message)
+        {
+          Outn();
+          Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running();
+          Outn();
+        }
+      }
+  }
+  catch (libtest::disconnected& err)
+  {
+    if (fatal::is_disabled() == false and try_port != LIBTEST_FAIL_PORT)
     {
+      stream::cerr(err.file(), err.line(), err.func()) << err.what();
       delete server;
       return false;
     }
-    else
-    {
-      if (opt_startup_message)
-      {
-        Outn();
-        Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running();
-        Outn();
-      }
-    }
   }
   catch (...)
   {