Commit e6a64e8f authored by Daniel Black's avatar Daniel Black Committed by elenst

MDEV-10294: MTR using --valgrind-option to specify a tool / fixing callgrind [10.1] (#200)

* MDEV-10294: Put testname into environment as MTR_TEST_NAME during MTR

* MDEV-10294: restructure mtr to allow --valgrind-option=--tool=XXX

* MDEV-10294: mtr valgrind - supressions all tools + feedback
parent f0386598
......@@ -317,7 +317,6 @@ our $opt_user = "root";
our $opt_valgrind= 0;
my $opt_valgrind_mysqld= 0;
my $opt_valgrind_mysqltest= 0;
my @default_valgrind_args= ("--show-reachable=yes");
my @valgrind_args;
my $opt_strace= 0;
my $opt_strace_client;
......@@ -1722,17 +1721,27 @@ sub command_line_setup {
# Set special valgrind options unless options passed on command line
push(@valgrind_args, "--trace-children=yes")
unless @valgrind_args;
unshift(@valgrind_args, "--tool=callgrind");
}
if ( $opt_valgrind )
# default to --tool=memcheck
if ($opt_valgrind && ! grep(/^--tool=/i, @valgrind_args))
{
# Set valgrind_options to default unless already defined
push(@valgrind_args, @default_valgrind_args)
# Set valgrind_option unless already defined
push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes",
"--num-callers=16"))
unless @valgrind_args;
unshift(@valgrind_args, "--tool=memcheck");
}
if ( $opt_valgrind )
{
# Make valgrind run in quiet mode so it only print errors
push(@valgrind_args, "--quiet" );
push(@valgrind_args, "--suppressions=${glob_mysql_test_dir}/valgrind.supp")
if -f "$glob_mysql_test_dir/valgrind.supp";
mtr_report("Running valgrind with options \"",
join(" ", @valgrind_args), "\"");
}
......@@ -3764,6 +3773,7 @@ sub run_testcase ($$) {
my $print_freq=20;
mtr_verbose("Running test:", $tinfo->{name});
$ENV{'MTR_TEST_NAME'} = $tinfo->{name};
resfile_report_test($tinfo) if $opt_resfile;
# Allow only alpanumerics pluss _ - + . in combination names,
......@@ -5819,19 +5829,6 @@ sub valgrind_arguments {
my $args= shift;
my $exe= shift;
if ( $opt_callgrind)
{
mtr_add_arg($args, "--tool=callgrind");
mtr_add_arg($args, "--base=$opt_vardir/log");
}
else
{
mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
mtr_add_arg($args, "--leak-check=yes");
mtr_add_arg($args, "--num-callers=16");
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
# Ensure the jemalloc works with mysqld
if ($$exe =~ /mysqld/)
{
......@@ -5842,7 +5839,6 @@ sub valgrind_arguments {
my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}};
mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn;
}
}
# Add valgrind options, can be overriden by user
mtr_add_arg($args, '%s', $_) for (@valgrind_args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment