diff options
author | Daniel Black <danielgb@au.ibm.com> | 2016-07-22 09:19:35 +1000 |
---|---|---|
committer | elenst <elenst@gmail.com> | 2016-07-22 02:19:35 +0300 |
commit | e6a64e8f0ea36f12bd24ba906aa1f4e2e367a8e0 (patch) | |
tree | 48b67a91986ef003a6959991bcb690c6865fdbfb /mysql-test/mysql-test-run.pl | |
parent | f0386598dd825e3a42c463699988f13c123dd6be (diff) | |
download | mariadb-git-e6a64e8f0ea36f12bd24ba906aa1f4e2e367a8e0.tar.gz |
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
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index dbd58f6da00..d0bff1af99e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -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,29 +5829,15 @@ sub valgrind_arguments { my $args= shift; my $exe= shift; - if ( $opt_callgrind) + # Ensure the jemalloc works with mysqld + if ($$exe =~ /mysqld/) { - 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/) - { - my %somalloc=( - 'system jemalloc' => 'libjemalloc*', - 'bundled jemalloc' => 'NONE' - ); - my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}}; - mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn; - } + my %somalloc=( + 'system jemalloc' => 'libjemalloc*', + 'bundled jemalloc' => 'NONE' + ); + 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 |