- arg_buffer << " " << socket_file_option() << "\"" << _socket << "\"";
- }
-
- assert(port_option());
- if (port_option() and _port > 0)
- {
- arg_buffer << " " << port_option() << _port;
- }
-
- options+= arg_buffer.str();
-
- if (not _extra_args.empty())
- {
- options+= _extra_args;
- }
-
- return true;
-}
-
-bool Server::is_debug() const
-{
- return bool(getenv("LIBTEST_MANUAL_GDB"));
-}
-
-bool Server::is_valgrind() const
-{
- return bool(getenv("LIBTEST_MANUAL_VALGRIND"));
-}
-
-bool Server::is_helgrind() const
-{
- return bool(getenv("LIBTEST_MANUAL_HELGRIND"));
-}
-
-bool Server::kill(pid_t pid_arg)
-{
- if (check_pid(pid_arg) and kill_pid(pid_arg)) // If we kill it, reset
- {
- if (broken_pid_file() and not pid_file().empty())
- {
- unlink(pid_file().c_str());
- }
-
- if (broken_socket_cleanup() and has_socket() and not socket().empty())
- {
- unlink(socket().c_str());
- }
-
- reset_pid();
-
- return true;
- }
-
- return false;
-}
-
-void server_startup_st::push_server(Server *arg)
-{
- servers.push_back(arg);
-
- char port_str[NI_MAXSERV];
- snprintf(port_str, sizeof(port_str), "%u", int(arg->port()));
-
- std::string server_config_string;
- if (arg->has_socket())
- {
- server_config_string+= "--socket=";
- server_config_string+= '"';
- server_config_string+= arg->socket();
- server_config_string+= '"';
- server_config_string+= " ";
- }
- else
- {
- server_config_string+= "--server=";
- server_config_string+= arg->hostname();
- server_config_string+= ":";
- server_config_string+= port_str;
- server_config_string+= " ";
- }
-
- server_list+= server_config_string;
-
-}
-
-Server* server_startup_st::pop_server()
-{
- Server *tmp= servers.back();
- servers.pop_back();
- return tmp;
-}
-
-void server_startup_st::shutdown(bool remove)
-{
- if (remove)
- {
- for (std::vector<Server *>::iterator iter= servers.begin(); iter != servers.end(); iter++)
- {
- delete *iter;
- }
- servers.clear();
- }
- else
- {
- for (std::vector<Server *>::iterator iter= servers.begin(); iter != servers.end(); iter++)
- {
- if ((*iter)->has_pid() and not (*iter)->kill((*iter)->pid()))
- {
- Error << "Unable to kill:" << *(*iter);
- }
- }