X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.cc;h=e554039a1c523d8dea88c4c869f89f067af85ed8;hb=77c987b7f93f71d3cca198e60538c7a75d7d11ab;hp=66575e74300725dd93b9327be6e339d3682cb649;hpb=53c5e334c2810febf02a2e6a826b3735f33593ee;p=m6w6%2Flibmemcached diff --git a/libtest/server.cc b/libtest/server.cc index 66575e74..e554039a 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -138,6 +138,19 @@ bool Server::start() } Application app(executable(), is_libtool()); + + if (is_debug()) + { + app.use_gdb(); + } + else if (getenv("TESTS_ENVIRONMENT")) + { + if (strstr(getenv("TESTS_ENVIRONMENT"), "gdb")) + { + app.use_gdb(); + } + } + if (args(app) == false) { Error << "Could not build command()"; @@ -186,10 +199,16 @@ bool Server::start() // If we happen to have a pid file, lets try to kill it if (pid_file().empty() == false) { - Error << "We are going to kill it off"; - kill_file(pid_file()); + if (kill_file(pid_file()) == false) + { + fatal_message("Failed to kill off server after startup occurred, when pinging failed"); + } + Error << "Failed to ping() server started, having pid_file. exec:" << _running; + } + else + { + Error << "Failed to ping() server started. exec:" << _running; } - Error << "Failed to ping() server started with:" << _running; _running.clear(); return false; } @@ -287,8 +306,7 @@ bool Server::set_log_file() int fd; if ((fd= mkstemp(file_buffer)) == -1) { - perror(file_buffer); - return false; + libtest::fatal(LIBYATL_DEFAULT_PARAM, "mkstemp() failed on %s with %s", file_buffer, strerror(errno)); } close(fd); @@ -301,13 +319,9 @@ bool Server::args(Application& app) { // Set a log file if it was requested (and we can) - if (getenv("LIBTEST_LOG") and has_log_file_option()) + if (has_log_file_option()) { - if (not set_log_file()) - { - return false; - } - + set_log_file(); log_file_option(app, _log_file); }