X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fserver.cc;h=d5329b11971851b1e04c50fa28aeb2735443d38a;hb=3c4d734f56530d43520f385bff97162c04ac81ac;hp=f547d455abb56384606540f879c6b49f58ea5725;hpb=23d5278248d8f3deff5903d17b6d55cc503ef3a9;p=m6w6%2Flibmemcached diff --git a/libtest/server.cc b/libtest/server.cc index f547d455..d5329b11 100644 --- a/libtest/server.cc +++ b/libtest/server.cc @@ -188,6 +188,11 @@ bool Server::start() return false; } + if (is_valgrind() or is_helgrind()) + { + _running+= " &"; + } + if (system(_running.c_str()) == -1) { Error << "system() failed:" << strerror(errno); @@ -195,6 +200,11 @@ bool Server::start() return false; } + if (is_helgrind()) + { + sleep(4); + } + if (pid_file_option() and not pid_file().empty()) { Wait wait(pid_file()); @@ -205,7 +215,7 @@ bool Server::start() } } - int count= 5; + int count= is_helgrind() ? 20 : 5; while (not ping() and --count) { nap(); @@ -325,7 +335,12 @@ void Server::rebuild_base_command() } else if (is_valgrind()) { - _base_command+= "valgrind --log-file=tests/var/tmp/valgrind.out --leak-check=full --show-reachable=yes "; + _base_command+= "valgrind --log-file=tests/var/tmp/valgrind.out --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE "; + + } + else if (is_helgrind()) + { + _base_command+= "valgrind --log-file=tests/var/tmp/helgrind.out --tool=helgrind --read-var-info=yes --error-exitcode=1 -v "; } _base_command+= executable(); @@ -359,7 +374,7 @@ bool Server::args(std::string& options) } assert(daemon_file_option()); - if (daemon_file_option()) + if (daemon_file_option() and not is_valgrind() and not is_helgrind()) { arg_buffer << " " << daemon_file_option(); } @@ -396,6 +411,11 @@ 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 @@ -486,6 +506,12 @@ bool server_startup_st::is_valgrind() const return bool(getenv("LIBTEST_MANUAL_VALGRIND")); } +bool server_startup_st::is_helgrind() const +{ + return bool(getenv("LIBTEST_MANUAL_HELGRIND")); +} + + bool server_startup(server_startup_st& construct, const std::string& server_type, in_port_t try_port, int argc, const char *argv[]) { Outn();