2004-12-30 16:34:01 +01:00
|
|
|
# -*- cperl -*-
|
2006-12-31 01:02:27 +01:00
|
|
|
# Copyright (C) 2004-2006 MySQL AB
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-12-30 16:34:01 +01:00
|
|
|
|
|
|
|
# This is a library file used by the Perl version of mysql-test-run,
|
|
|
|
# and is part of the translation of the Bourne shell script with the
|
|
|
|
# same name.
|
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
package mtr_report;
|
2004-12-30 16:34:01 +01:00
|
|
|
use strict;
|
2008-02-04 11:16:25 +01:00
|
|
|
|
|
|
|
use base qw(Exporter);
|
|
|
|
our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
|
|
|
|
mtr_print_header mtr_report mtr_report_stats
|
|
|
|
mtr_warning mtr_error mtr_debug mtr_verbose
|
|
|
|
mtr_verbose_restart mtr_report_test_passed
|
2008-04-27 23:35:38 +02:00
|
|
|
mtr_report_test_skipped
|
2008-04-25 08:23:57 +02:00
|
|
|
mtr_report_test);
|
2008-02-04 11:16:25 +01:00
|
|
|
|
2008-04-08 16:51:26 +02:00
|
|
|
use mtr_match;
|
2008-02-04 11:16:25 +01:00
|
|
|
require "mtr_io.pl";
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2007-08-03 12:50:00 +02:00
|
|
|
my $tot_real_time= 0;
|
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
our $timestamp= 0;
|
2008-04-24 14:15:15 +02:00
|
|
|
our $timediff= 1;
|
2008-04-24 13:02:53 +02:00
|
|
|
our $name;
|
|
|
|
our $verbose;
|
|
|
|
our $verbose_restart= 0;
|
|
|
|
|
2007-08-03 12:50:00 +02:00
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
sub report_option {
|
|
|
|
my ($opt, $value)= @_;
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
# Convert - to _ in option name
|
2008-04-24 14:15:15 +02:00
|
|
|
$opt =~ s/-/_/g;
|
2008-02-04 11:16:25 +01:00
|
|
|
no strict 'refs';
|
|
|
|
${$opt}= $value;
|
2008-04-24 13:02:53 +02:00
|
|
|
|
|
|
|
#print $name, " setting $opt to ", (defined $value? $value : "undef") ,"\n";
|
2008-02-04 11:16:25 +01:00
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
sub SHOW_SUITE_NAME() { return 1; };
|
|
|
|
|
|
|
|
sub _mtr_report_test_name ($) {
|
2004-12-30 16:34:01 +01:00
|
|
|
my $tinfo= shift;
|
2007-11-23 13:29:31 +01:00
|
|
|
my $tname= $tinfo->{name};
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2008-04-24 13:02:53 +02:00
|
|
|
return unless defined $verbose;
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
# Remove suite part of name
|
|
|
|
$tname =~ s/.*\.// unless SHOW_SUITE_NAME;
|
|
|
|
|
|
|
|
# Add combination name if any
|
2007-11-23 13:29:31 +01:00
|
|
|
$tname.= " '$tinfo->{combination}'"
|
|
|
|
if defined $tinfo->{combination};
|
|
|
|
|
2008-04-24 13:02:53 +02:00
|
|
|
print $name, _timestamp();
|
2007-11-23 13:29:31 +01:00
|
|
|
printf "%-30s ", $tname;
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_report_test_skipped ($) {
|
|
|
|
my $tinfo= shift;
|
2008-02-04 11:16:25 +01:00
|
|
|
_mtr_report_test_name($tinfo);
|
2004-12-30 16:34:01 +01:00
|
|
|
|
|
|
|
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
|
mysql-test-run.pl:
Let --start-and-exit actually start a server
Added that test case names can be specified on the comman line
Added embedded server support
Added environment variables UMASK, UMASK_DIR
Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER
Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST
Pass on return value from sleep_until_file_created(), to fail test
Fail test if early termination of mysqld servers
Create intial databases for the second master, and two additional slaves
mtr_process.pl:
Find out if port is still in use, using simple TCP connect
Use non blocking waitpid() to catch terminations early
Make a special case spawning the 'mysqltest' application
Redo the fork() if it returns EAGAIN
Make sure to record if master or slave terminated
Improved debugging output
Improved code that remove PID files to avoid race
Abort if we can't stop all mysqld servers using our ports
Many improvements in killing mysqld servers
Let sleep_until_file_created() catch if server died early
mtr_report.pl:
Added option to disable test cases using <testcase>.disabled file
If --timer, only try to open file with time data if it exists
mtr_io.pl:
Remove starting/ending space reading server options from file
mysql-test/lib/mtr_io.pl:
Remove starting/ending space reading server options from file
mysql-test/lib/mtr_report.pl:
Added option to disable test cases using <testcase>.disabled file
If --timer, only try to open file with time data if it exists
mysql-test/lib/mtr_process.pl:
Find out if port is still in use, using simple TCP connect
Use non blocking waitpid() to catch terminations early
Make a special case spawning the 'mysqltest' application
Redo the fork() if it returns EAGAIN
Make sure to record if master or slave terminated
Improved debugging output
Improved code that remove PID files to avoid race
Abort if we can't stop all mysqld servers using our ports
Many improvements in killing mysqld servers
Let sleep_until_file_created() catch if server died early
mysql-test/mysql-test-run.pl:
Let --start-and-exit actually start a server
Added that test case names can be specified on the comman line
Added embedded server support
Added environment variables UMASK, UMASK_DIR
Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER
Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST
Pass on return value from sleep_until_file_created(), to fail test
Fail test if early termination of mysqld servers
Create intial databases for the second master, and two additional slaves
2005-02-03 21:13:27 +01:00
|
|
|
if ( $tinfo->{'disable'} )
|
|
|
|
{
|
2007-08-03 12:36:32 +02:00
|
|
|
mtr_report("[ disabled ] $tinfo->{'comment'}");
|
mysql-test-run.pl:
Let --start-and-exit actually start a server
Added that test case names can be specified on the comman line
Added embedded server support
Added environment variables UMASK, UMASK_DIR
Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER
Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST
Pass on return value from sleep_until_file_created(), to fail test
Fail test if early termination of mysqld servers
Create intial databases for the second master, and two additional slaves
mtr_process.pl:
Find out if port is still in use, using simple TCP connect
Use non blocking waitpid() to catch terminations early
Make a special case spawning the 'mysqltest' application
Redo the fork() if it returns EAGAIN
Make sure to record if master or slave terminated
Improved debugging output
Improved code that remove PID files to avoid race
Abort if we can't stop all mysqld servers using our ports
Many improvements in killing mysqld servers
Let sleep_until_file_created() catch if server died early
mtr_report.pl:
Added option to disable test cases using <testcase>.disabled file
If --timer, only try to open file with time data if it exists
mtr_io.pl:
Remove starting/ending space reading server options from file
mysql-test/lib/mtr_io.pl:
Remove starting/ending space reading server options from file
mysql-test/lib/mtr_report.pl:
Added option to disable test cases using <testcase>.disabled file
If --timer, only try to open file with time data if it exists
mysql-test/lib/mtr_process.pl:
Find out if port is still in use, using simple TCP connect
Use non blocking waitpid() to catch terminations early
Make a special case spawning the 'mysqltest' application
Redo the fork() if it returns EAGAIN
Make sure to record if master or slave terminated
Improved debugging output
Improved code that remove PID files to avoid race
Abort if we can't stop all mysqld servers using our ports
Many improvements in killing mysqld servers
Let sleep_until_file_created() catch if server died early
mysql-test/mysql-test-run.pl:
Let --start-and-exit actually start a server
Added that test case names can be specified on the comman line
Added embedded server support
Added environment variables UMASK, UMASK_DIR
Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER
Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST
Pass on return value from sleep_until_file_created(), to fail test
Fail test if early termination of mysqld servers
Create intial databases for the second master, and two additional slaves
2005-02-03 21:13:27 +01:00
|
|
|
}
|
2006-11-24 18:26:53 +01:00
|
|
|
elsif ( $tinfo->{'comment'} )
|
mysql-test-run.pl:
Let --start-and-exit actually start a server
Added that test case names can be specified on the comman line
Added embedded server support
Added environment variables UMASK, UMASK_DIR
Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER
Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST
Pass on return value from sleep_until_file_created(), to fail test
Fail test if early termination of mysqld servers
Create intial databases for the second master, and two additional slaves
mtr_process.pl:
Find out if port is still in use, using simple TCP connect
Use non blocking waitpid() to catch terminations early
Make a special case spawning the 'mysqltest' application
Redo the fork() if it returns EAGAIN
Make sure to record if master or slave terminated
Improved debugging output
Improved code that remove PID files to avoid race
Abort if we can't stop all mysqld servers using our ports
Many improvements in killing mysqld servers
Let sleep_until_file_created() catch if server died early
mtr_report.pl:
Added option to disable test cases using <testcase>.disabled file
If --timer, only try to open file with time data if it exists
mtr_io.pl:
Remove starting/ending space reading server options from file
mysql-test/lib/mtr_io.pl:
Remove starting/ending space reading server options from file
mysql-test/lib/mtr_report.pl:
Added option to disable test cases using <testcase>.disabled file
If --timer, only try to open file with time data if it exists
mysql-test/lib/mtr_process.pl:
Find out if port is still in use, using simple TCP connect
Use non blocking waitpid() to catch terminations early
Make a special case spawning the 'mysqltest' application
Redo the fork() if it returns EAGAIN
Make sure to record if master or slave terminated
Improved debugging output
Improved code that remove PID files to avoid race
Abort if we can't stop all mysqld servers using our ports
Many improvements in killing mysqld servers
Let sleep_until_file_created() catch if server died early
mysql-test/mysql-test-run.pl:
Let --start-and-exit actually start a server
Added that test case names can be specified on the comman line
Added embedded server support
Added environment variables UMASK, UMASK_DIR
Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER
Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST
Pass on return value from sleep_until_file_created(), to fail test
Fail test if early termination of mysqld servers
Create intial databases for the second master, and two additional slaves
2005-02-03 21:13:27 +01:00
|
|
|
{
|
2007-12-12 18:19:24 +01:00
|
|
|
if ( $tinfo->{skip_detected_by_test} )
|
|
|
|
{
|
2008-02-28 18:55:46 +01:00
|
|
|
mtr_report("[ skip ]. $tinfo->{'comment'}");
|
2008-01-07 19:44:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-12 18:19:24 +01:00
|
|
|
mtr_report("[ skip ] $tinfo->{'comment'}");
|
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
}
|
2006-11-24 18:26:53 +01:00
|
|
|
else
|
|
|
|
{
|
2007-12-12 18:19:24 +01:00
|
|
|
mtr_report("[ skip ]");
|
2006-11-24 18:26:53 +01:00
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
sub mtr_report_test_passed ($$) {
|
|
|
|
my ($tinfo, $use_timer)= @_;
|
2008-02-04 11:16:25 +01:00
|
|
|
_mtr_report_test_name($tinfo);
|
2004-12-30 16:34:01 +01:00
|
|
|
|
|
|
|
my $timer= "";
|
2007-12-12 18:19:24 +01:00
|
|
|
if ( $use_timer and -f "$::opt_vardir/log/timer" )
|
2005-03-21 16:01:39 +01:00
|
|
|
{
|
2005-05-15 17:22:54 +02:00
|
|
|
$timer= mtr_fromfile("$::opt_vardir/log/timer");
|
2007-08-03 12:50:00 +02:00
|
|
|
$tot_real_time += ($timer/1000);
|
2005-03-21 16:01:39 +01:00
|
|
|
$timer= sprintf "%12s", $timer;
|
2008-04-24 13:02:53 +02:00
|
|
|
$tinfo->{timer}= $timer;
|
2005-03-21 16:01:39 +01:00
|
|
|
}
|
2008-01-10 10:44:18 +01:00
|
|
|
# Set as passed unless already set
|
|
|
|
if ( not defined $tinfo->{'result'} ){
|
|
|
|
$tinfo->{'result'}= 'MTR_RES_PASSED';
|
|
|
|
}
|
2007-08-03 12:36:32 +02:00
|
|
|
mtr_report("[ pass ] $timer");
|
2008-04-24 13:02:53 +02:00
|
|
|
|
|
|
|
# Show any problems check-testcase found
|
|
|
|
if ( defined $tinfo->{'check'} )
|
|
|
|
{
|
|
|
|
mtr_report($tinfo->{'check'});
|
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2008-04-24 13:02:53 +02:00
|
|
|
sub mtr_report_test ($) {
|
|
|
|
my ($tinfo)= @_;
|
|
|
|
_mtr_report_test_name($tinfo);
|
|
|
|
|
|
|
|
if ($tinfo->{'result'} eq 'MTR_RES_FAILED'){
|
|
|
|
|
|
|
|
if ( defined $tinfo->{'warnings'} )
|
|
|
|
{
|
|
|
|
mtr_report("[ fail ] Found warnings in server log file!");
|
|
|
|
mtr_report($tinfo->{'warnings'});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( defined $tinfo->{'timeout'} )
|
|
|
|
{
|
|
|
|
mtr_report("[ fail ] timeout");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mtr_report("[ fail ]");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $tinfo->{'comment'} )
|
|
|
|
{
|
|
|
|
# The test failure has been detected by mysql-test-run.pl
|
|
|
|
# when starting the servers or due to other error, the reason for
|
|
|
|
# failing the test is saved in "comment"
|
|
|
|
mtr_report("\nERROR: $tinfo->{'comment'}");
|
|
|
|
}
|
|
|
|
elsif ( $tinfo->{logfile} )
|
|
|
|
{
|
|
|
|
# Test failure was detected by test tool and its report
|
|
|
|
# about what failed has been saved to file. Display the report.
|
|
|
|
mtr_report("\n");
|
|
|
|
mtr_report($tinfo->{logfile}, "\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
# Neither this script or the test tool has recorded info
|
|
|
|
# about why the test has failed. Should be debugged.
|
|
|
|
mtr_report("\nUnexpected termination, probably when starting mysqld");;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($tinfo->{'result'} eq 'MTR_RES_SKIPPED')
|
|
|
|
{
|
|
|
|
if ( $tinfo->{'disable'} )
|
|
|
|
{
|
|
|
|
mtr_report("[ disabled ] $tinfo->{'comment'}");
|
|
|
|
}
|
|
|
|
elsif ( $tinfo->{'comment'} )
|
|
|
|
{
|
|
|
|
if ( $tinfo->{skip_detected_by_test} )
|
|
|
|
{
|
|
|
|
mtr_report("[ skip ]. $tinfo->{'comment'}");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mtr_report("[ skip ] $tinfo->{'comment'}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mtr_report("[ skip ]");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($tinfo->{'result'} eq 'MTR_RES_PASSED')
|
|
|
|
{
|
|
|
|
my $timer= $tinfo->{timer} || "";
|
|
|
|
mtr_report("[ pass ] $timer");
|
2008-04-27 21:31:32 +02:00
|
|
|
|
|
|
|
# Show any problems check-testcase found
|
|
|
|
if ( defined $tinfo->{'check'} )
|
|
|
|
{
|
|
|
|
mtr_report($tinfo->{'check'});
|
|
|
|
}
|
2008-04-24 13:02:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_report_stats ($) {
|
|
|
|
my $tests= shift;
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Find out how we where doing
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
my $tot_skiped= 0;
|
|
|
|
my $tot_passed= 0;
|
|
|
|
my $tot_failed= 0;
|
|
|
|
my $tot_tests= 0;
|
2006-10-04 12:47:32 +02:00
|
|
|
my $tot_restarts= 0;
|
2008-04-08 16:51:26 +02:00
|
|
|
my $found_problems= 0;
|
2004-12-30 16:34:01 +01:00
|
|
|
|
|
|
|
foreach my $tinfo (@$tests)
|
|
|
|
{
|
|
|
|
if ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
|
|
|
|
{
|
|
|
|
$tot_skiped++;
|
|
|
|
}
|
|
|
|
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
|
|
|
|
{
|
|
|
|
$tot_tests++;
|
|
|
|
$tot_passed++;
|
|
|
|
}
|
2008-05-02 12:11:04 +02:00
|
|
|
elsif ( $tinfo->{failures} )
|
2004-12-30 16:34:01 +01:00
|
|
|
{
|
|
|
|
$tot_tests++;
|
|
|
|
$tot_failed++;
|
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
if ( $tinfo->{'restarted'} )
|
|
|
|
{
|
|
|
|
$tot_restarts++;
|
|
|
|
}
|
2008-04-08 16:51:26 +02:00
|
|
|
|
|
|
|
# Look for warnings produced by mysqltest
|
|
|
|
my $base_file= mtr_match_extension($tinfo->{'result_file'},
|
|
|
|
"result"); # Trim extension
|
|
|
|
my $warning_file= "$base_file.warnings";
|
|
|
|
if ( -f $warning_file )
|
|
|
|
{
|
|
|
|
$found_problems= 1;
|
|
|
|
mtr_warning("Check myqltest warnings in '$warning_file'");
|
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Print out a summary report to screen
|
|
|
|
# ----------------------------------------------------------------------
|
2007-12-12 18:19:24 +01:00
|
|
|
print "The servers were restarted $tot_restarts times\n";
|
2006-10-04 12:47:32 +02:00
|
|
|
|
|
|
|
if ( $::opt_timer )
|
|
|
|
{
|
2007-08-03 12:50:00 +02:00
|
|
|
use English;
|
|
|
|
|
|
|
|
mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
|
|
|
|
time - $BASETIME, "seconds executing testcases");
|
2006-10-04 12:47:32 +02:00
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
|
|
|
|
|
2008-04-08 16:51:26 +02:00
|
|
|
my $warnlog= "$::opt_vardir/log/warnings";
|
|
|
|
if ( -f $warnlog )
|
2004-12-30 16:34:01 +01:00
|
|
|
{
|
2008-04-08 16:51:26 +02:00
|
|
|
mtr_warning("Got errors/warnings while running tests, please examine",
|
|
|
|
"'$warnlog' for details.");
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
print "\n";
|
|
|
|
|
2006-10-08 17:48:01 +02:00
|
|
|
# Print a list of check_testcases that failed(if any)
|
|
|
|
if ( $::opt_check_testcases )
|
|
|
|
{
|
2008-04-24 14:15:15 +02:00
|
|
|
my %check_testcases;
|
2006-10-08 17:48:01 +02:00
|
|
|
|
|
|
|
foreach my $tinfo (@$tests)
|
|
|
|
{
|
|
|
|
if ( defined $tinfo->{'check_testcase_failed'} )
|
|
|
|
{
|
2008-04-24 14:15:15 +02:00
|
|
|
$check_testcases{$tinfo->{'name'}}= 1;
|
2006-10-08 17:48:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-24 14:15:15 +02:00
|
|
|
if ( keys %check_testcases )
|
2006-10-08 17:48:01 +02:00
|
|
|
{
|
|
|
|
print "Check of testcase failed for: ";
|
2008-04-24 14:15:15 +02:00
|
|
|
print join(" ", keys %check_testcases);
|
2006-10-08 17:48:01 +02:00
|
|
|
print "\n\n";
|
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
}
|
2006-10-08 17:48:01 +02:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
# Print a list of testcases that failed
|
|
|
|
if ( $tot_failed != 0 )
|
|
|
|
{
|
2008-05-02 12:11:04 +02:00
|
|
|
|
|
|
|
# Print each failed test, again
|
|
|
|
#foreach my $test ( @$tests ){
|
|
|
|
# if ( $test->{result} eq 'MTR_RES_FAILED' ) {
|
|
|
|
# mtr_report_test($test);
|
|
|
|
# }
|
|
|
|
#}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
my $ratio= $tot_passed * 100 / $tot_tests;
|
|
|
|
print "Failed $tot_failed/$tot_tests tests, ";
|
|
|
|
printf("%.2f", $ratio);
|
|
|
|
print "\% were successful.\n\n";
|
|
|
|
|
|
|
|
# Print the list of test that failed in a format
|
|
|
|
# that can be copy pasted to rerun only failing tests
|
|
|
|
print "Failing test(s):";
|
|
|
|
|
2008-03-26 07:22:42 +01:00
|
|
|
my %seen= ();
|
2007-12-12 18:19:24 +01:00
|
|
|
foreach my $tinfo (@$tests)
|
|
|
|
{
|
2008-03-26 07:22:42 +01:00
|
|
|
my $tname= $tinfo->{'name'};
|
|
|
|
if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' and ! $seen{$tname})
|
2007-12-12 18:19:24 +01:00
|
|
|
{
|
2008-03-26 07:22:42 +01:00
|
|
|
print " $tname";
|
|
|
|
$seen{$tname}= 1;
|
2007-12-12 18:19:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
print "\n\n";
|
|
|
|
|
|
|
|
# Print info about reporting the error
|
|
|
|
print
|
|
|
|
"The log files in var/log may give you some hint of what went wrong.\n\n",
|
|
|
|
"If you want to report this error, please read first ",
|
|
|
|
"the documentation\n",
|
|
|
|
"at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print "All $tot_tests tests were successful.\n";
|
|
|
|
}
|
|
|
|
|
2006-10-04 12:47:32 +02:00
|
|
|
if ( $tot_failed != 0 || $found_problems)
|
|
|
|
{
|
2007-04-28 10:13:27 +02:00
|
|
|
mtr_error("there were failing test cases");
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Text formatting
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
sub mtr_print_line () {
|
2007-12-12 18:19:24 +01:00
|
|
|
print '-' x 60, "\n";
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
sub mtr_print_thick_line {
|
2007-12-12 18:19:24 +01:00
|
|
|
my $char= shift || '=';
|
|
|
|
print $char x 60, "\n";
|
2005-01-03 16:54:08 +01:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_print_header () {
|
|
|
|
print "\n";
|
|
|
|
if ( $::opt_timer )
|
|
|
|
{
|
2007-12-12 18:19:24 +01:00
|
|
|
print "TEST RESULT TIME (ms)\n";
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-12 18:19:24 +01:00
|
|
|
print "TEST RESULT\n";
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
mtr_print_line();
|
|
|
|
print "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
2007-08-03 12:36:32 +02:00
|
|
|
# Log and reporting functions
|
2004-12-30 16:34:01 +01:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
use Time::localtime;
|
2007-08-03 12:36:32 +02:00
|
|
|
|
2008-04-24 14:15:15 +02:00
|
|
|
use Time::HiRes qw(gettimeofday);
|
|
|
|
|
|
|
|
my $t0= gettimeofday();
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
sub _timestamp {
|
2008-02-04 11:16:25 +01:00
|
|
|
return "" unless $timestamp;
|
2007-08-03 12:36:32 +02:00
|
|
|
|
2008-04-24 14:15:15 +02:00
|
|
|
my $diff;
|
|
|
|
if ($timediff){
|
|
|
|
my $t1= gettimeofday();
|
|
|
|
my $elapsed= $t1 - $t0;
|
|
|
|
|
|
|
|
$diff= sprintf(" +%02.3f", $elapsed);
|
|
|
|
|
|
|
|
# Save current time for next lap
|
|
|
|
$t0= $t1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
my $tm= localtime();
|
2008-04-24 14:15:15 +02:00
|
|
|
return sprintf("%02d%02d%02d %2d:%02d:%02d%s ",
|
2007-12-12 18:19:24 +01:00
|
|
|
$tm->year % 100, $tm->mon+1, $tm->mday,
|
2008-04-24 14:15:15 +02:00
|
|
|
$tm->hour, $tm->min, $tm->sec, $diff);
|
2007-08-03 12:36:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
# Print message to screen
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_report (@) {
|
2008-04-24 13:02:53 +02:00
|
|
|
if (defined $verbose)
|
|
|
|
{
|
2008-04-24 20:24:24 +02:00
|
|
|
print $name, join(" ", @_), "\n";
|
2008-04-24 13:02:53 +02:00
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
# Print warning to screen
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_warning (@) {
|
2008-04-24 13:02:53 +02:00
|
|
|
print STDERR $name, _timestamp(),
|
|
|
|
"mysql-test-run: WARNING: ", join(" ", @_), "\n";
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-04 11:16:25 +01:00
|
|
|
# Print error to screen and then exit
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_error (@) {
|
2008-04-24 13:02:53 +02:00
|
|
|
print STDERR $name, _timestamp(),
|
|
|
|
"mysql-test-run: *** ERROR: ", join(" ", @_), "\n";
|
2005-09-14 13:55:53 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_debug (@) {
|
2008-04-24 13:02:53 +02:00
|
|
|
if ( $verbose > 2 )
|
2004-12-30 16:34:01 +01:00
|
|
|
{
|
2008-04-24 13:02:53 +02:00
|
|
|
print STDERR $name,
|
|
|
|
_timestamp(), "####: ", join(" ", @_), "\n";
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
}
|
2007-08-03 12:36:32 +02:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2006-10-04 12:47:32 +02:00
|
|
|
sub mtr_verbose (@) {
|
2008-04-24 13:02:53 +02:00
|
|
|
if ( $verbose )
|
2006-10-04 12:47:32 +02:00
|
|
|
{
|
2008-04-24 13:02:53 +02:00
|
|
|
print STDERR $name, _timestamp(),
|
|
|
|
"> ",join(" ", @_),"\n";
|
2006-10-04 12:47:32 +02:00
|
|
|
}
|
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2008-02-04 09:15:44 +01:00
|
|
|
sub mtr_verbose_restart (@) {
|
|
|
|
my ($server, @args)= @_;
|
|
|
|
my $proc= $server->{proc};
|
2008-04-24 13:02:53 +02:00
|
|
|
if ( $verbose_restart )
|
2008-02-04 09:15:44 +01:00
|
|
|
{
|
2008-04-24 13:02:53 +02:00
|
|
|
print STDERR $name,_timestamp(),
|
|
|
|
"> Restart $proc - ",join(" ", @args),"\n";
|
2008-02-04 09:15:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
1;
|