Merge branch '2.2' into 2.3

This commit is contained in:
Markus Mäkelä
2019-03-05 04:54:40 +02:00
25 changed files with 600 additions and 146 deletions

View File

@ -2,12 +2,24 @@
#include <sstream>
#include <unordered_map>
Maxscales::Maxscales(const char* pref, const char* test_cwd, bool verbose)
Maxscales::Maxscales(const char* pref, const char* test_cwd, bool verbose, bool use_valgrind)
{
strcpy(prefix, pref);
this->verbose = verbose;
this->use_valgrind = use_valgrind;
valgring_log_num = 0;
strcpy(test_dir, test_cwd);
read_env();
if (use_valgrind)
{
for (int i = 0; i < N; i++)
{
ssh_node_f(i, true, "yum install -y valgrind gdb 2>&1");
ssh_node_f(i, true, "apt install -y --force-yes valgrind gdb 2>&1");
ssh_node_f(i, true, "zypper -n install valgrind gdb 2>&1");
ssh_node_f(i, true, "rm -rf /var/cache/maxscale/maxscale.lock");
}
}
}
int Maxscales::read_env()
@ -231,14 +243,35 @@ int Maxscales::close_maxscale_connections(int m)
int Maxscales::restart_maxscale(int m)
{
int res = ssh_node(m, "service maxscale restart", true);
int res;
if (use_valgrind)
{
res = stop_maxscale(m);
res += start_maxscale(m);
}
else
{
res =ssh_node(m, "service maxscale restart", true);
}
fflush(stdout);
return res;
}
int Maxscales::stop_maxscale(int m)
{
int res = ssh_node(m, "service maxscale stop", true);
int res;
if (use_valgrind)
{
res = ssh_node_f(m, true, "sudo kill $(pidof valgrind) 2>&1 > /dev/null");
if ((res != 0) || atoi(ssh_node_output(m, "pidof valgrind", true, &res)) > 0)
{
res = ssh_node_f(m, true, "sudo kill -9 $(pidof valgrind) 2>&1 > /dev/null");
}
}
else
{
res = ssh_node(m, "service maxscale stop", true);
}
fflush(stdout);
return res;
}