Commit fe7250a0 authored by Bjorn Munch's avatar Bjorn Munch

merge from 5.5-mtr

parents 54c86966 c429202b
# -*- cperl -*- # -*- cperl -*-
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public
...@@ -150,7 +150,11 @@ sub fix_tmpdir { ...@@ -150,7 +150,11 @@ sub fix_tmpdir {
sub fix_log_error { sub fix_log_error {
my ($self, $config, $group_name, $group)= @_; my ($self, $config, $group_name, $group)= @_;
my $dir= $self->{ARGS}->{vardir}; my $dir= $self->{ARGS}->{vardir};
if ( $::opt_valgrind and $::opt_debug ) {
return "$dir/log/$group_name.trace";
} else {
return "$dir/log/$group_name.err"; return "$dir/log/$group_name.err";
}
} }
sub fix_log { sub fix_log {
......
...@@ -94,7 +94,7 @@ eval { ...@@ -94,7 +94,7 @@ eval {
local $SIG{INT}= \&handle_signal; local $SIG{INT}= \&handle_signal;
local $SIG{CHLD}= sub { local $SIG{CHLD}= sub {
message("Got signal @_"); message("Got signal @_");
kill(9, -$child_pid); kill('KILL', -$child_pid);
my $ret= waitpid($child_pid, 0); my $ret= waitpid($child_pid, 0);
if ($? & 127){ if ($? & 127){
exit(65); # Killed by signal exit(65); # Killed by signal
...@@ -134,7 +134,7 @@ if ( $@ ) { ...@@ -134,7 +134,7 @@ if ( $@ ) {
# Use negative pid in order to kill the whole # Use negative pid in order to kill the whole
# process group # process group
# #
my $ret= kill(9, -$child_pid); my $ret= kill('KILL', -$child_pid);
message("Killed child: $child_pid, ret: $ret"); message("Killed child: $child_pid, ret: $ret");
if ($ret > 0) { if ($ret > 0) {
message("Killed child: $child_pid"); message("Killed child: $child_pid");
......
...@@ -274,12 +274,13 @@ my $opt_strace_client; ...@@ -274,12 +274,13 @@ my $opt_strace_client;
our $opt_user = "root"; our $opt_user = "root";
my $opt_valgrind= 0; our $opt_valgrind= 0;
my $opt_valgrind_mysqld= 0; my $opt_valgrind_mysqld= 0;
my $opt_valgrind_mysqltest= 0; my $opt_valgrind_mysqltest= 0;
my @default_valgrind_args= ("--show-reachable=yes"); my @default_valgrind_args= ("--show-reachable=yes");
my @valgrind_args; my @valgrind_args;
my $opt_valgrind_path; my $opt_valgrind_path;
my $valgrind_reports= 0;
my $opt_callgrind; my $opt_callgrind;
my %mysqld_logs; my %mysqld_logs;
my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions. my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions.
...@@ -504,6 +505,25 @@ sub main { ...@@ -504,6 +505,25 @@ sub main {
push @$completed, run_ctest() if $opt_ctest; push @$completed, run_ctest() if $opt_ctest;
if ($opt_valgrind) {
# Create minimalistic "test" for the reporting
my $tinfo = My::Test->new
(
name => 'valgrind_report',
);
# Set dummy worker id to align report with normal tests
$tinfo->{worker} = 0 if $opt_parallel > 1;
if ($valgrind_reports) {
$tinfo->{result}= 'MTR_RES_FAILED';
$tinfo->{comment}= "Valgrind reported failures at shutdown, see above";
$tinfo->{failures}= 1;
} else {
$tinfo->{result}= 'MTR_RES_PASSED';
}
mtr_report_test($tinfo);
push @$completed, $tinfo;
}
mtr_print_line(); mtr_print_line();
if ( $opt_gcov ) { if ( $opt_gcov ) {
...@@ -704,6 +724,9 @@ sub run_test_server ($$$) { ...@@ -704,6 +724,9 @@ sub run_test_server ($$$) {
elsif ($line =~ /^SPENT/) { elsif ($line =~ /^SPENT/) {
add_total_times($line); add_total_times($line);
} }
elsif ($line eq 'VALGREP' && $opt_valgrind) {
$valgrind_reports= 1;
}
else { else {
mtr_error("Unknown response: '$line' from client"); mtr_error("Unknown response: '$line' from client");
} }
...@@ -889,6 +912,7 @@ sub run_worker ($) { ...@@ -889,6 +912,7 @@ sub run_worker ($) {
my $valgrind_reports= 0; my $valgrind_reports= 0;
if ($opt_valgrind_mysqld) { if ($opt_valgrind_mysqld) {
$valgrind_reports= valgrind_exit_reports(); $valgrind_reports= valgrind_exit_reports();
print $server "VALGREP\n" if $valgrind_reports;
} }
if ( $opt_gprof ) { if ( $opt_gprof ) {
gprof_collect (find_mysqld($basedir), keys %gprof_dirs); gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
...@@ -4747,13 +4771,6 @@ sub mysqld_start ($$) { ...@@ -4747,13 +4771,6 @@ sub mysqld_start ($$) {
unlink($mysqld->value('pid-file')); unlink($mysqld->value('pid-file'));
my $output= $mysqld->value('#log-error'); my $output= $mysqld->value('#log-error');
if ( $opt_valgrind and $opt_debug )
{
# When both --valgrind and --debug is selected, send
# all output to the trace file, making it possible to
# see the exact location where valgrind complains
$output= "$opt_vardir/log/".$mysqld->name().".trace";
}
# Remember this log file for valgrind error report search # Remember this log file for valgrind error report search
$mysqld_logs{$output}= 1 if $opt_valgrind; $mysqld_logs{$output}= 1 if $opt_valgrind;
# Remember data dir for gmon.out files if using gprof # Remember data dir for gmon.out files if using gprof
...@@ -5660,6 +5677,7 @@ sub valgrind_exit_reports() { ...@@ -5660,6 +5677,7 @@ sub valgrind_exit_reports() {
@culprits); @culprits);
mtr_print_line(); mtr_print_line();
print ("$valgrind_rep\n"); print ("$valgrind_rep\n");
$found_err= 1;
$err_in_report= 0; $err_in_report= 0;
} }
# Make ready to collect new report # Make ready to collect new report
......
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