1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
This commit is contained in:
Magnus Svensson
2009-01-27 15:10:15 +01:00
8 changed files with 213 additions and 106 deletions

View File

@ -371,9 +371,9 @@ sub main {
if ($opt_force){
# All test should have been run, print any that are still in $tests
foreach my $test ( @$tests ){
$test->print_test();
}
#foreach my $test ( @$tests ){
# $test->print_test();
#}
}
# Not all tests completed, failure
@ -697,6 +697,12 @@ sub run_worker ($) {
if ($line eq 'TESTCASE'){
my $test= My::Test::read_test($server);
#$test->print_test();
# Clear comment and logfile, to avoid
# reusing them from previous test
delete($test->{'comment'});
delete($test->{'logfile'});
run_testcase($test);
#$test->{result}= 'MTR_RES_PASSED';
# Send it back, now with results set
@ -2915,6 +2921,7 @@ sub start_run_one ($$) {
output => $errfile,
args => \$args,
user_data => $errfile,
verbose => $opt_verbose,
);
mtr_verbose("Started $proc");
return $proc;
@ -3362,6 +3369,85 @@ sub run_testcase ($) {
}
#
# 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) = @_;
# Open the servers .err log file and read all lines
# belonging to current tets into @lines
my $Ferr = IO::File->new($error_log)
or mtr_error("Could not open file '$error_log' for reading: $!");
my @lines;
while ( my $line = <$Ferr> )
{
if ( $line =~ /"^CURRENT_TEST:"/ )
{
# Throw away lines from previous tests
@lines = ();
}
push(@lines, $line);
}
$Ferr = undef; # Close error log file
# mysql_client_test.test sends a COM_DEBUG packet to the server
# to provoke a SAFEMALLOC leak report, ignore any warnings
# between "Begin/end safemalloc memory dump"
if ( grep(/Begin safemalloc memory dump:/, @lines) > 0)
{
my $discard_lines= 1;
foreach my $line ( @lines )
{
if ($line =~ /Begin safemalloc memory dump:/){
$discard_lines = 1;
} elsif ($line =~ /End safemalloc memory dump./){
$discard_lines = 0;
}
if ($discard_lines){
$line = "ignored";
}
}
}
# Write all suspicious lines to $error_log.warnings file
my $warning_log = "$error_log.warnings";
my $Fwarn = IO::File->new($warning_log, "w")
or die("Could not open file '$warning_log' for writing: $!");
print $Fwarn "Suspicious lines from $error_log\n";
my @patterns =
(
qr/^Warning:|mysqld: Warning|\\[Warning\\]/,
qr/^Error:|\\[ERROR\\]/,
qr/^==.* at 0x/,
qr/InnoDB: Warning|InnoDB: Error/,
qr/^safe_mutex:|allocated at line/,
qr/missing DBUG_RETURN/,
qr/Attempting backtrace/,
qr/Assertion .* failed/,
);
foreach my $line ( @lines )
{
foreach my $pat ( @patterns )
{
if ( $line =~ /$pat/ )
{
print $Fwarn $line;
last;
}
}
}
$Fwarn = undef; # Close file
}
# Run include/check-warnings.test
#
# RETURN VALUE
@ -3374,6 +3460,8 @@ sub start_check_warnings ($$) {
my $name= "warnings-".$mysqld->name();
extract_warning_lines($mysqld->value('log-error'));
my $args;
mtr_init_args(\$args);
@ -3409,6 +3497,7 @@ sub start_check_warnings ($$) {
output => $errfile,
args => \$args,
user_data => $errfile,
verbose => $opt_verbose,
);
mtr_verbose("Started $proc");
return $proc;
@ -3645,6 +3734,17 @@ sub save_datadir_after_failure($$) {
}
sub remove_ndbfs_from_ndbd_datadir {
my ($ndbd_datadir)= @_;
# Remove the ndb_*_fs directory from ndbd.X/ dir
foreach my $ndbfs_dir ( glob("$ndbd_datadir/ndb_*_fs") )
{
next unless -d $ndbfs_dir; # Skip if not a directory
rmtree($ndbfs_dir);
}
}
sub after_failure ($) {
my ($tinfo)= @_;
@ -3670,6 +3770,14 @@ sub after_failure ($) {
if ( clusters() ) {
foreach my $cluster ( clusters() ) {
my $cluster_dir= "$opt_vardir/".$cluster->{name};
# Remove the fileystem of each ndbd
foreach my $ndbd ( in_cluster($cluster, ndbds()) )
{
my $ndbd_datadir= $ndbd->value("DataDir");
remove_ndbfs_from_ndbd_datadir($ndbd_datadir);
}
save_datadir_after_failure($cluster_dir, $save_dir);
}
}