*
*/
-#include <config.h>
+#include "mem_config.h"
#include <libtest/common.h>
#include <cassert>
}
else
{
- char port_str[NI_MAXSERV];
+ char port_str[NI_MAXSERV]= { 0 };
snprintf(port_str, sizeof(port_str), "%u", int(arg->port()));
server_config_string+= "--server=";
// host_to_shutdown => host number to shutdown in array
bool server_startup_st::shutdown(uint32_t host_to_shutdown)
{
- Error << servers.size() << " > " << host_to_shutdown;
if (servers.size() > host_to_shutdown)
{
Server* tmp= servers[host_to_shutdown];
bool success= true;
for (std::vector<Server *>::iterator iter= servers.begin(); iter != servers.end(); ++iter)
{
- if ((*iter) and (*iter)->has_pid() and (*iter)->kill() == false)
+ if ((*iter)->has_pid() and (*iter)->kill() == false)
{
Error << "Unable to kill:" << *(*iter);
success= false;
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)
}
}
}
+ else if (server_type.compare("hostile-gearmand") == 0)
+ {
+ if (GEARMAND_BINARY)
+ {
+ if (HAVE_LIBGEARMAN)
+ {
+ server= build_gearmand("localhost", try_port, "gearmand/hostile_gearmand");
+ }
+ }
+ }
else if (server_type.compare("drizzled") == 0)
{
if (DRIZZLED_BINARY)
}
}
}
- 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.
*/
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 (...)
{
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)
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;