Commit 972e938d authored by Bjorn Munch's avatar Bjorn Munch

Bug #46007 Tests fail due to a crash while running 'check testcase before test'

Difficult to debug due to lacking report
This does not solve the real issue, but extracts server log when it happens
Forst commit was incomplete, didn't cover all cases
parent 052d9bef
...@@ -3015,7 +3015,8 @@ test case was executed:\n"; ...@@ -3015,7 +3015,8 @@ test case was executed:\n";
# Unknown process returned, most likley a crash, abort everything # Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}= $tinfo->{comment}=
"The server $proc crashed while running ". "The server $proc crashed while running ".
"'check testcase $mode test'"; "'check testcase $mode test'".
get_log_from_proc($proc, $tinfo->{name});
$result= 3; $result= 3;
} }
...@@ -3133,7 +3134,8 @@ sub run_on_all($$) ...@@ -3133,7 +3134,8 @@ sub run_on_all($$)
else { else {
# Unknown process returned, most likley a crash, abort everything # Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}.= $tinfo->{comment}.=
"The server $proc crashed while running '$run'"; "The server $proc crashed while running '$run'".
get_log_from_proc($proc, $tinfo->{name});
} }
# Kill any check processes still running # Kill any check processes still running
...@@ -3533,7 +3535,8 @@ sub run_testcase ($) { ...@@ -3533,7 +3535,8 @@ sub run_testcase ($) {
{ {
# Server failed, probably crashed # Server failed, probably crashed
$tinfo->{comment}= $tinfo->{comment}=
"Server $proc failed during test run"; "Server $proc failed during test run" .
get_log_from_proc($proc, $tinfo->{name});
# ---------------------------------------------------- # ----------------------------------------------------
# It's not mysqltest that has exited, kill it # It's not mysqltest that has exited, kill it
...@@ -3588,12 +3591,11 @@ sub run_testcase ($) { ...@@ -3588,12 +3591,11 @@ sub run_testcase ($) {
} }
# Extract server log from after the last occurrence of named test
# Return as an array of lines
# #
# Perform a rough examination of the servers
# error log and write all lines that look sub extract_server_log ($$) {
# suspicious into $error_log.warnings
#
sub extract_warning_lines ($$) {
my ($error_log, $tname) = @_; my ($error_log, $tname) = @_;
# Open the servers .err log file and read all lines # Open the servers .err log file and read all lines
...@@ -3645,8 +3647,37 @@ sub extract_warning_lines ($$) { ...@@ -3645,8 +3647,37 @@ sub extract_warning_lines ($$) {
} }
} }
} }
return @lines;
}
# Get log from server identified from its $proc object, from named test
# Return as a single string
#
sub get_log_from_proc ($$) {
my ($proc, $name)= @_;
my $srv_log= "";
foreach my $mysqld (mysqlds()) {
if ($mysqld->{proc} eq $proc) {
my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
$srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
last;
}
}
return $srv_log;
}
# Perform a rough examination of the servers
# error log and write all lines that look
# suspicious into $error_log.warnings
#
sub extract_warning_lines ($$) {
my ($error_log, $tname) = @_;
my @lines= extract_server_log($error_log, $tname);
# Write all suspicious lines to $error_log.warnings file # Write all suspicious lines to $error_log.warnings file
my $warning_log = "$error_log.warnings"; my $warning_log = "$error_log.warnings";
my $Fwarn = IO::File->new($warning_log, "w") my $Fwarn = IO::File->new($warning_log, "w")
or die("Could not open file '$warning_log' for writing: $!"); or die("Could not open file '$warning_log' for writing: $!");
...@@ -3829,7 +3860,8 @@ sub check_warnings ($) { ...@@ -3829,7 +3860,8 @@ sub check_warnings ($) {
else { else {
# Unknown process returned, most likley a crash, abort everything # Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}= $tinfo->{comment}=
"The server $proc crashed while running 'check warnings'"; "The server $proc crashed while running 'check warnings'".
get_log_from_proc($proc, $tinfo->{name});
$result= 3; $result= 3;
} }
......
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