X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.h;h=d987a0b7d3307e8e5ebde87b4014b022bc7d9104;hb=b90c798532ec8d4d4e2f5c1eea1ec18354dd2070;hp=f13cad0781c302f12aca53fdab500b8136d189c4;hpb=28602fd2f5f1c758b50cd82d4545da8e6c55f5c7;p=m6w6%2Flibmemcached diff --git a/libtest/server.h b/libtest/server.h index f13cad07..d987a0b7 100644 --- a/libtest/server.h +++ b/libtest/server.h @@ -28,9 +28,9 @@ private: std::string _log_file; std::string _base_command; // executable command which include libtool, valgrind, gdb, etc std::string _running; // Current string being used for system() + pid_t _pid; protected: - pid_t _pid; in_port_t _port; std::string _hostname; std::string _extra_args; @@ -92,7 +92,7 @@ public: virtual bool ping()= 0; - virtual pid_t get_pid(bool error_is_ok= true)= 0; + virtual pid_t get_pid(bool error_is_ok= false)= 0; virtual bool build(int argc, const char *argv[])= 0; @@ -130,6 +130,11 @@ public: return (_pid > 1); } + bool check_pid(pid_t pid_arg) const + { + return (pid_arg > 1); + } + bool is_socket() const { return _hostname[0] == '/'; @@ -142,7 +147,7 @@ public: std::string log_and_pid(); - bool kill(); + bool kill(pid_t pid_arg); bool start(); bool command(std::string& command_arg); @@ -150,6 +155,7 @@ protected: void nap(); private: + bool is_helgrind() const; bool is_valgrind() const; bool is_debug() const; bool set_log_file(); @@ -165,6 +171,7 @@ class server_startup_st { private: std::string server_list; + bool _socket; public: @@ -172,6 +179,7 @@ public: std::vector servers; server_startup_st() : + _socket(false), udp(0) { } @@ -185,8 +193,20 @@ public: } bool is_debug() const; + bool is_helgrind() const; bool is_valgrind() const; + bool socket() + { + return _socket; + } + + void set_socket() + { + _socket= true; + } + + void shutdown(bool remove= false); void push_server(Server *); Server *pop_server();