X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver_container.cc;h=05997238bb2379624f048217d9d4b488639f22f1;hb=99332db60646cb1b06a61d1636eddbbf0b5d0b40;hp=d8ef5d495364ad4c51e42722b3a70faeb20a67ac;hpb=bf755bec1cd09fad086a47650c1a725c9fbc7eb1;p=awesomized%2Flibmemcached diff --git a/libtest/server_container.cc b/libtest/server_container.cc index d8ef5d49..05997238 100644 --- a/libtest/server_container.cc +++ b/libtest/server_container.cc @@ -34,7 +34,7 @@ * */ -#include +#include "mem_config.h" #include #include @@ -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) @@ -241,7 +241,7 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t } else if (server_type.compare("memcached-sasl") == 0) { - if (MEMCACHED_SASL_BINARY) + if (MEMCACHED_BINARY) { if (HAVE_LIBMEMCACHED) { @@ -259,22 +259,18 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t } } } - else if (server_type.compare("memcached-light") == 0) - { - if (MEMCACHED_LIGHT_BINARY) - { - if (HAVE_LIBMEMCACHED) - { - server= build_memcached_light("localhost", try_port); - } - } - } if (server == NULL) { 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. */ @@ -287,29 +283,38 @@ bool server_startup_st::start_server(const std::string& server_type, in_port_t t server->build(argc, argv); +#if 0 if (false) { Out << "Pausing for startup, hit return when ready."; std::string gdb_command= server->base_command(); - std::string options; -#if 0 - Out << "run " << server->args(options); -#endif getchar(); } - else if (server->start() == false) - { - delete server; - return false; - } else - { - if (opt_startup_message) +#endif + + if (server->start() == false) { - Outn(); - Out << "STARTING SERVER(pid:" << server->pid() << "): " << server->running(); - Outn(); + 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; } } catch (...) @@ -338,24 +343,6 @@ bool server_startup_st::start_socket_server(const std::string& server_type, cons { Error << "Socket files are not supported for gearmand yet"; } - else if (server_type.compare("memcached-sasl") == 0) - { - if (MEMCACHED_SASL_BINARY) - { - if (HAVE_LIBMEMCACHED) - { - server= build_memcached_sasl_socket("localhost", try_port, username(), password()); - } - else - { - Error << "Libmemcached was not found"; - } - } - else - { - Error << "No memcached binary is available"; - } - } else if (server_type.compare("memcached") == 0) { if (MEMCACHED_BINARY) @@ -397,17 +384,18 @@ bool server_startup_st::start_socket_server(const std::string& server_type, cons server->build(argc, argv); +#if 0 if (false) { Out << "Pausing for startup, hit return when ready."; std::string gdb_command= server->base_command(); std::string options; -#if 0 Out << "run " << server->args(options); -#endif getchar(); } - else if (server->start() == false) + else +#endif + if (server->start() == false) { Error << "Failed to start " << *server; delete server;