X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.cc;h=99a9eeb960eb0614f90838bd90c02084e598a5a0;hb=bc253ff1c35b279eb008b3710be9977a333da618;hp=a57b44d5ca7f0dcecc48947b46793a127dcd86a0;hpb=96702d0bcb4bd8f45ede2830660e4ccb072675ab;p=m6w6%2Flibmemcached diff --git a/libtest/server.cc b/libtest/server.cc index a57b44d5..99a9eeb9 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -190,6 +190,7 @@ bool Server::start() } size_t repeat= 5; + _app.slurp(); while (--repeat) { if (pid_file().empty() == false) @@ -203,20 +204,18 @@ bool Server::start() continue; } - throw libtest::fatal(LIBYATL_DEFAULT_PARAM, - "Unable to open pidfile for: %s", - _running.c_str()); char buf[PATH_MAX]; - getcwd(buf, sizeof(buf)); + char *getcwd_buf= getcwd(buf, sizeof(buf)); throw libtest::fatal(LIBYATL_DEFAULT_PARAM, - "Unable to open pidfile in %s for: %s", - buf, - _running.c_str()); + "Unable to open pidfile in %s for: %s stderr:%s", + getcwd_buf ? getcwd_buf : "", + _running.c_str(), + _app.stderr_c_str()); } } } - uint32_t this_wait; + uint32_t this_wait= 0; bool pinged= false; { uint32_t timeout= 20; // This number should be high enough for valgrind startup (which is slow) @@ -244,20 +243,28 @@ bool Server::start() // If we happen to have a pid file, lets try to kill it if ((pid_file().empty() == false) and (access(pid_file().c_str(), R_OK) == 0)) { + _app.slurp(); if (kill_file(pid_file()) == false) { - throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Failed to kill off server after startup occurred, when pinging failed: %s", pid_file().c_str()); + throw libtest::fatal(LIBYATL_DEFAULT_PARAM, + "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %s stderr:%s", + this_wait, + pid_file().c_str(), + _app.stderr_c_str()); } throw libtest::fatal(LIBYATL_DEFAULT_PARAM, - "Failed to ping(), waited: %u server started, having pid_file. exec: %s error:%s", - this_wait, _running.c_str(), _app.stderr_c_str()); + "Failed to ping(), waited: %u server started, having pid_file. exec: %s stderr:%s", + this_wait, _running.c_str(), + _app.stderr_c_str()); } else { throw libtest::fatal(LIBYATL_DEFAULT_PARAM, - "Failed to ping() server started. exec: %s", - _running.c_str()); + "Failed to ping(), waited: %u server started. exec: %s stderr:%s", + this_wait, + _running.c_str(), + _app.stderr_c_str()); } _running.clear(); return false;