X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fgearmand.cc;h=f526e015f4c0648690dd19c225bc8596029c96b4;hb=9bdee8f89d770307eccf292d1d404fc4049c7976;hp=c729d8ed836a763a69897acf819107a262155ac1;hpb=c87f1a554cce74ac1ba3d4e7e9c2a1d2904e4766;p=m6w6%2Flibmemcached diff --git a/libtest/gearmand.cc b/libtest/gearmand.cc index c729d8ed..f526e015 100644 --- a/libtest/gearmand.cc +++ b/libtest/gearmand.cc @@ -37,10 +37,10 @@ #include #include -#include "util/instance.h" -#include "util/operation.h" +#include "util/instance.hpp" +#include "util/operation.hpp" -using namespace gearman_util; +using namespace datadifferential; using namespace libtest; #include @@ -54,16 +54,13 @@ using namespace libtest; #include #include -#include -#include - #include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wold-style-cast" #endif -class GetPid : public Instance::Finish +class GetPid : public util::Instance::Finish { private: pid_t _pid; @@ -91,10 +88,10 @@ public: if (_pid < 1) { _pid= -1; - return true; + return false; } - return false; + return true; } }; @@ -110,20 +107,29 @@ public: pid_t get_pid(bool error_is_ok) { + if (not pid_file().empty()) + { + Wait wait(pid_file(), 0); + + if (error_is_ok and not wait.successful()) + { + Error << "Pidfile was not found:" << pid_file(); + return -1; + } + } + GetPid *get_instance_pid; - Instance instance(hostname(), port()); + util::Instance instance(hostname(), port()); instance.set_finish(get_instance_pid= new GetPid); - instance.push(new Operation(test_literal_param("getpid\r\n"), true)); + instance.push(new util::Operation(test_literal_param("getpid\r\n"), true)); - if (not instance.run() and not error_is_ok) + if (error_is_ok and instance.run() == false) { Error << "Failed to obtain pid of server"; } - _pid= get_instance_pid->pid(); - - return _pid; + return get_instance_pid->pid(); } bool ping() @@ -138,7 +144,7 @@ public: if (gearman_success(gearman_client_add_server(client, hostname().c_str(), port()))) { - gearman_return_t rc= gearman_client_echo(client, gearman_literal_param("This is my echo test")); + gearman_return_t rc= gearman_client_echo(client, test_literal_param("This is my echo test")); if (gearman_success(rc)) {