Add a possibility to run tests under callgrind

Flag 'use_callgrind' make all maxscale-system-test run Maxscale under Valgrind with --tool=callgrind option
This commit is contained in:
Timofey Turenko
2019-04-26 17:30:10 +03:00
parent 07ea6bd9ba
commit 08bd7c99be
4 changed files with 36 additions and 18 deletions

View File

@ -4,17 +4,16 @@
#include <string>
#include "envv.h"
Maxscales::Maxscales(const char *pref, const char *test_cwd, bool verbose, bool use_valgrind,
Maxscales::Maxscales(const char *pref, const char *test_cwd, bool verbose,
std::string network_config)
{
strcpy(prefix, pref);
this->verbose = verbose;
this->use_valgrind = use_valgrind;
valgring_log_num = 0;
strcpy(test_dir, test_cwd);
this->network_config = network_config;
read_env();
if (use_valgrind)
if (this->use_valgrind)
{
for (int i = 0; i < N; i++)
{
@ -61,6 +60,13 @@ int Maxscales::read_env()
}
}
use_valgrind = readenv_bool("use_valgrind", false);
use_callgrind = readenv_bool("use_callgrind", false);
if (use_callgrind)
{
use_valgrind = true;
}
return 0;
}
@ -211,10 +217,23 @@ int Maxscales::start_maxscale(int m)
int res;
if (use_valgrind)
{
res = ssh_node_f(m, false,
"sudo --user=maxscale valgrind --leak-check=full --show-leak-kinds=all "
"--log-file=/%s/valgrind%02d.log --trace-children=yes "
"--track-origins=yes /usr/bin/maxscale", maxscale_log_dir[m], valgring_log_num);
if (use_callgrind)
{
res = ssh_node_f(m, false,
"sudo --user=maxscale valgrind -d "
"--log-file=/%s/valgrind%02d.log --trace-children=yes "
" --tool=callgrind --callgrind-out-file=/%s/callgrind%02d.log "
" /usr/bin/maxscale",
maxscale_log_dir[m], valgring_log_num,
maxscale_log_dir[m], valgring_log_num);
}
else
{
res = ssh_node_f(m, false,
"sudo --user=maxscale valgrind --leak-check=full --show-leak-kinds=all "
"--log-file=/%s/valgrind%02d.log --trace-children=yes "
"--track-origins=yes /usr/bin/maxscale", maxscale_log_dir[m], valgring_log_num);
}
valgring_log_num++;
}
else