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.
|
|
|
|
|
|
|
|
use strict;
|
2007-08-03 12:36:32 +02:00
|
|
|
use warnings;
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
sub mtr_report_test_passed($$);
|
|
|
|
sub mtr_report_test_failed($$);
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_report_test_skipped($);
|
|
|
|
sub mtr_report_stats ($);
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_print_line ();
|
2007-12-12 18:19:24 +01:00
|
|
|
sub mtr_print_thick_line ($);
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_print_header ();
|
|
|
|
sub mtr_report (@);
|
|
|
|
sub mtr_warning (@);
|
|
|
|
sub mtr_error (@);
|
|
|
|
sub mtr_debug (@);
|
2006-10-04 12:47:32 +02:00
|
|
|
sub mtr_verbose (@);
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2007-08-03 12:50:00 +02:00
|
|
|
my $tot_real_time= 0;
|
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_report_test_name ($) {
|
|
|
|
my $tinfo= shift;
|
2007-11-23 13:29:31 +01:00
|
|
|
my $tname= $tinfo->{name};
|
2004-12-30 16:34:01 +01:00
|
|
|
|
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};
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
_mtr_log("$tname");
|
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;
|
2007-12-12 18:19:24 +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} )
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
sub mtr_report_test_passed ($$) {
|
|
|
|
my ($tinfo, $use_timer)= @_;
|
|
|
|
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-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");
|
2004-12-30 16:34:01 +01:00
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
|
|
|
sub mtr_report_test_failed ($$) {
|
|
|
|
my ($tinfo, $logfile)= @_;
|
|
|
|
mtr_report_test_name($tinfo);
|
2004-12-30 16:34:01 +01:00
|
|
|
|
|
|
|
$tinfo->{'result'}= 'MTR_RES_FAILED';
|
2008-01-10 10:44:18 +01:00
|
|
|
my $test_failures= $tinfo->{'failures'} || 0;
|
|
|
|
$tinfo->{'failures'}= $test_failures + 1;
|
2006-10-17 10:31:06 +02:00
|
|
|
if ( defined $tinfo->{'timeout'} )
|
2005-08-18 00:16:44 +02:00
|
|
|
{
|
2007-08-03 12:36:32 +02:00
|
|
|
mtr_report("[ fail ] timeout");
|
2006-10-14 17:14:03 +02:00
|
|
|
return;
|
2005-08-18 00:16:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-08-03 12:36:32 +02:00
|
|
|
mtr_report("[ fail ]");
|
2005-08-18 00:16:44 +02:00
|
|
|
}
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2006-10-06 17:15:26 +02:00
|
|
|
if ( $tinfo->{'comment'} )
|
|
|
|
{
|
2007-08-03 13:12:53 +02:00
|
|
|
# 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"
|
2007-08-03 12:36:32 +02:00
|
|
|
mtr_report("\nERROR: $tinfo->{'comment'}");
|
2006-10-06 17:15:26 +02:00
|
|
|
}
|
2007-12-12 18:19:24 +01:00
|
|
|
elsif ( defined $logfile and -f $logfile )
|
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
|
|
|
# Test failure was detected by test tool and its report
|
2007-08-03 13:12:53 +02:00
|
|
|
# about what failed has been saved to file. Display the report.
|
|
|
|
print "\n";
|
2007-12-12 18:19:24 +01:00
|
|
|
mtr_printfile($logfile);
|
2007-08-03 13:12:53 +02:00
|
|
|
print "\n";
|
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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-08-03 13:12:53 +02:00
|
|
|
# Neither this script or the test tool has recorded info
|
|
|
|
# about why the test has failed. Should be debugged.
|
2007-08-03 12:36:32 +02:00
|
|
|
mtr_report("\nUnexpected termination, probably when starting mysqld");;
|
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
|
|
|
}
|
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_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;
|
2006-10-08 17:48:01 +02:00
|
|
|
my $found_problems= 0; # Some warnings in the logfiles are errors...
|
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++;
|
|
|
|
}
|
|
|
|
elsif ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
|
|
|
|
{
|
|
|
|
$tot_tests++;
|
|
|
|
$tot_failed++;
|
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
if ( $tinfo->{'restarted'} )
|
|
|
|
{
|
|
|
|
$tot_restarts++;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
2006-10-04 12:47:32 +02:00
|
|
|
# If a debug run, there might be interesting information inside
|
|
|
|
# the "var/log/*.err" files. We save this info in "var/log/warnings"
|
2004-12-30 16:34:01 +01:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
if ( $::opt_warnings )
|
2004-12-30 16:34:01 +01:00
|
|
|
{
|
2006-10-04 12:47:32 +02:00
|
|
|
# Save and report if there was any fatal warnings/errors in err logs
|
2004-12-30 16:34:01 +01:00
|
|
|
|
2006-10-04 12:47:32 +02:00
|
|
|
my $warnlog= "$::opt_vardir/log/warnings";
|
|
|
|
|
|
|
|
unless ( open(WARN, ">$warnlog") )
|
|
|
|
{
|
|
|
|
mtr_warning("can't write to the file \"$warnlog\": $!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
# We report different types of problems in order
|
2007-05-31 16:45:22 +02:00
|
|
|
foreach my $pattern ( "^Warning:",
|
|
|
|
"\\[Warning\\]",
|
|
|
|
"\\[ERROR\\]",
|
|
|
|
"^Error:", "^==.* at 0x",
|
|
|
|
"InnoDB: Warning",
|
|
|
|
"^safe_mutex:",
|
|
|
|
"missing DBUG_RETURN",
|
2006-10-04 12:47:32 +02:00
|
|
|
"mysqld: Warning",
|
2006-11-21 21:32:58 +01:00
|
|
|
"allocated at line",
|
2006-10-04 12:47:32 +02:00
|
|
|
"Attempting backtrace", "Assertion .* failed" )
|
|
|
|
{
|
|
|
|
foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
|
|
|
|
{
|
2007-06-21 16:37:13 +02:00
|
|
|
my $testname= "";
|
2006-10-04 12:47:32 +02:00
|
|
|
unless ( open(ERR, $errlog) )
|
|
|
|
{
|
|
|
|
mtr_warning("can't read $errlog");
|
|
|
|
next;
|
|
|
|
}
|
2007-05-24 13:11:45 +02:00
|
|
|
my $leak_reports_expected= undef;
|
2006-10-04 12:47:32 +02:00
|
|
|
while ( <ERR> )
|
|
|
|
{
|
2007-05-24 13:11:45 +02:00
|
|
|
# There is a test case that purposely provokes a
|
|
|
|
# SAFEMALLOC leak report, even though there is no actual
|
|
|
|
# leak. We need to detect this, and ignore the warning in
|
|
|
|
# that case.
|
|
|
|
if (/Begin safemalloc memory dump:/) {
|
|
|
|
$leak_reports_expected= 1;
|
|
|
|
} elsif (/End safemalloc memory dump./) {
|
|
|
|
$leak_reports_expected= undef;
|
|
|
|
}
|
|
|
|
|
2006-10-04 12:47:32 +02:00
|
|
|
# Skip some non fatal warnings from the log files
|
2007-05-31 16:45:22 +02:00
|
|
|
if (
|
|
|
|
/\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or
|
|
|
|
/Aborted connection/ or
|
|
|
|
/Client requested master to start replication from impossible position/ or
|
|
|
|
/Could not find first log file name in binary log/ or
|
|
|
|
/Enabling keys got errno/ or
|
|
|
|
/Error reading master configuration/ or
|
|
|
|
/Error reading packet/ or
|
|
|
|
/Event Scheduler/ or
|
|
|
|
/Failed to open log/ or
|
|
|
|
/Failed to open the existing master info file/ or
|
|
|
|
/Forcing shutdown of [0-9]* plugins/ or
|
|
|
|
/Got error [0-9]* when reading table/ or
|
|
|
|
/Incorrect definition of table/ or
|
|
|
|
/Incorrect information in file/ or
|
|
|
|
/InnoDB: Warning: we did not need to do crash recovery/ or
|
|
|
|
/Invalid \(old\?\) table or database name/ or
|
|
|
|
/Lock wait timeout exceeded/ or
|
|
|
|
/Log entry on master is longer than max_allowed_packet/ or
|
|
|
|
/unknown option '--loose-/ or
|
|
|
|
/unknown variable 'loose-/ or
|
|
|
|
/You have forced lower_case_table_names to 0 through a command-line option/ or
|
|
|
|
/Setting lower_case_table_names=2/ or
|
|
|
|
/NDB Binlog:/ or
|
|
|
|
/NDB: failed to setup table/ or
|
|
|
|
/NDB: only row based binary logging/ or
|
|
|
|
/Neither --relay-log nor --relay-log-index were used/ or
|
|
|
|
/Query partially completed/ or
|
|
|
|
/Slave I.O thread aborted while waiting for relay log/ or
|
|
|
|
/Slave SQL thread is stopped because UNTIL condition/ or
|
|
|
|
/Slave SQL thread retried transaction/ or
|
|
|
|
/Slave \(additional info\)/ or
|
|
|
|
/Slave: .*Duplicate column name/ or
|
|
|
|
/Slave: .*master may suffer from/ or
|
|
|
|
/Slave: According to the master's version/ or
|
|
|
|
/Slave: Column [0-9]* type mismatch/ or
|
|
|
|
/Slave: Error .* doesn't exist/ or
|
|
|
|
/Slave: Error .*Deadlock found/ or
|
|
|
|
/Slave: Error .*Unknown table/ or
|
|
|
|
/Slave: Error in Write_rows event: / or
|
|
|
|
/Slave: Field .* of table .* has no default value/ or
|
|
|
|
/Slave: Query caused different errors on master and slave/ or
|
|
|
|
/Slave: Table .* doesn't exist/ or
|
|
|
|
/Slave: Table width mismatch/ or
|
|
|
|
/Slave: The incident LOST_EVENTS occured on the master/ or
|
|
|
|
/Slave: Unknown error.* 1105/ or
|
|
|
|
/Slave: Can't drop database.* database doesn't exist/ or
|
2007-07-26 16:44:57 +02:00
|
|
|
/Slave SQL:.*(?:Error_code: \d+|Query:.*)/ or
|
2007-05-31 16:45:22 +02:00
|
|
|
/Sort aborted/ or
|
|
|
|
/Time-out in NDB/ or
|
|
|
|
/Warning:\s+One can only use the --user.*root/ or
|
|
|
|
/Warning:\s+Setting lower_case_table_names=2/ or
|
|
|
|
/Warning:\s+Table:.* on (delete|rename)/ or
|
|
|
|
/You have an error in your SQL syntax/ or
|
|
|
|
/deprecated/ or
|
|
|
|
/description of time zone/ or
|
|
|
|
/equal MySQL server ids/ or
|
|
|
|
/error .*connecting to master/ or
|
|
|
|
/error reading log entry/ or
|
|
|
|
/lower_case_table_names is set/ or
|
|
|
|
/skip-name-resolve mode/ or
|
|
|
|
/slave SQL thread aborted/ or
|
2007-06-06 03:49:24 +02:00
|
|
|
/Slave: .*Duplicate entry/ or
|
2007-06-19 12:34:21 +02:00
|
|
|
# Special case for Bug #26402 in show_check.test
|
|
|
|
# Question marks are not valid file name parts
|
|
|
|
# on Windows platforms. Ignore this error message.
|
|
|
|
/\QCan't find file: '.\test\????????.frm'\E/ or
|
2007-06-06 03:49:24 +02:00
|
|
|
# Special case, made as specific as possible, for:
|
|
|
|
# Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
|
|
|
|
# server coredump
|
2007-06-11 09:55:34 +02:00
|
|
|
/\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or
|
Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
2007-06-28 19:34:54 +02:00
|
|
|
/Statement is not safe to log in statement format/ or
|
|
|
|
|
|
|
|
# Test case for Bug#14233 produces the following warnings:
|
|
|
|
/Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc/ or
|
|
|
|
/Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc/ or
|
2007-07-16 12:09:46 +02:00
|
|
|
/Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc/ or
|
|
|
|
|
|
|
|
# BUG#29807 - innodb_mysql.test: Cannot find table test/t2
|
|
|
|
# from the internal data dictionary
|
2007-12-12 18:19:24 +01:00
|
|
|
/Cannot find table test\/bug29807 from the internal data dictionary/ or
|
2007-07-18 10:55:50 +02:00
|
|
|
|
|
|
|
# BUG#29839 - lowercase_table3.test: Cannot find table test/T1
|
|
|
|
# from the internal data dictiona
|
2007-12-12 18:19:24 +01:00
|
|
|
/Cannot find table test\/BUG29839 from the internal data dictionary/
|
2007-05-31 16:45:22 +02:00
|
|
|
)
|
2006-10-04 12:47:32 +02:00
|
|
|
{
|
|
|
|
next; # Skip these lines
|
|
|
|
}
|
2007-06-21 16:37:13 +02:00
|
|
|
if ( /CURRENT_TEST: (.*)/ )
|
|
|
|
{
|
|
|
|
$testname= $1;
|
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
if ( /$pattern/ )
|
|
|
|
{
|
2007-05-24 13:11:45 +02:00
|
|
|
if ($leak_reports_expected) {
|
|
|
|
next;
|
|
|
|
}
|
2006-10-04 12:47:32 +02:00
|
|
|
$found_problems= 1;
|
2007-06-21 16:37:13 +02:00
|
|
|
print WARN basename($errlog) . ": $testname: $_";
|
2006-10-04 12:47:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-04-02 22:58:25 +02:00
|
|
|
|
2007-04-04 10:59:00 +02:00
|
|
|
if ( $::opt_check_testcases )
|
2007-04-02 22:58:25 +02:00
|
|
|
{
|
2007-04-04 10:59:00 +02:00
|
|
|
# Look for warnings produced by mysqltest in testname.warnings
|
|
|
|
foreach my $test_warning_file
|
|
|
|
( glob("$::glob_mysql_test_dir/r/*.warnings") )
|
|
|
|
{
|
|
|
|
$found_problems= 1;
|
|
|
|
print WARN "Check myqltest warnings in $test_warning_file\n";
|
|
|
|
}
|
2007-04-02 22:58:25 +02:00
|
|
|
}
|
|
|
|
|
2006-10-04 12:47:32 +02:00
|
|
|
if ( $found_problems )
|
|
|
|
{
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
my @check_testcases= ();
|
|
|
|
|
|
|
|
foreach my $tinfo (@$tests)
|
|
|
|
{
|
|
|
|
if ( defined $tinfo->{'check_testcase_failed'} )
|
|
|
|
{
|
|
|
|
push(@check_testcases, $tinfo->{'name'});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( @check_testcases )
|
|
|
|
{
|
|
|
|
print "Check of testcase failed for: ";
|
|
|
|
print join(" ", @check_testcases);
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
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):";
|
|
|
|
|
|
|
|
foreach my $tinfo (@$tests)
|
|
|
|
{
|
|
|
|
if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
|
|
|
|
{
|
|
|
|
print " $tinfo->{'name'}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
|
|
|
|
sub mtr_print_thick_line ($) {
|
|
|
|
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-08-03 12:36:32 +02:00
|
|
|
use IO::File;
|
2007-12-12 18:19:24 +01:00
|
|
|
use Time::localtime;
|
|
|
|
|
|
|
|
sub _timestamp {
|
|
|
|
my $tm= localtime();
|
|
|
|
return sprintf("%02d%02d%02d %2d:%02d:%02d ",
|
|
|
|
$tm->year % 100, $tm->mon+1, $tm->mday,
|
|
|
|
$tm->hour, $tm->min, $tm->sec);
|
|
|
|
}
|
2007-08-03 12:36:32 +02:00
|
|
|
|
|
|
|
my $log_file_ref= undef;
|
|
|
|
|
|
|
|
sub mtr_log_init ($) {
|
|
|
|
my ($filename)= @_;
|
|
|
|
|
|
|
|
mtr_error("Log is already open") if defined $log_file_ref;
|
|
|
|
|
|
|
|
$log_file_ref= IO::File->new($filename, "a") or
|
|
|
|
mtr_warning("Could not create logfile $filename: $!");
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2007-08-03 12:36:32 +02:00
|
|
|
sub _mtr_log (@) {
|
2007-12-12 18:19:24 +01:00
|
|
|
print $log_file_ref join(" ", _timestamp(), @_),"\n"
|
2007-08-03 12:36:32 +02:00
|
|
|
if defined $log_file_ref;
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_report (@) {
|
2007-08-03 12:36:32 +02:00
|
|
|
# Print message to screen and log
|
|
|
|
_mtr_log(@_);
|
2004-12-30 16:34:01 +01:00
|
|
|
print join(" ", @_),"\n";
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_warning (@) {
|
2007-08-03 12:36:32 +02:00
|
|
|
# Print message to screen and log
|
|
|
|
_mtr_log("WARNING: ", @_);
|
2004-12-30 16:34:01 +01:00
|
|
|
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
|
|
|
|
}
|
|
|
|
|
2007-12-12 18:19:24 +01:00
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
sub mtr_error (@) {
|
2007-08-03 12:36:32 +02:00
|
|
|
# Print message to screen and log
|
|
|
|
_mtr_log("ERROR: ", @_);
|
2005-06-05 20:10:47 +02:00
|
|
|
print STDERR "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 (@) {
|
2007-12-12 18:19:24 +01:00
|
|
|
if ( $::opt_verbose > 1 )
|
2004-12-30 16:34:01 +01:00
|
|
|
{
|
2007-08-03 12:36:32 +02:00
|
|
|
_mtr_log("###: ", @_);
|
2005-01-03 16:54:08 +01:00
|
|
|
print STDERR "####: ",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 (@) {
|
2007-08-03 12:36:32 +02:00
|
|
|
# Always print to log, print to screen only when --verbose is used
|
|
|
|
_mtr_log("> ",@_);
|
2006-10-04 12:47:32 +02:00
|
|
|
if ( $::opt_verbose )
|
|
|
|
{
|
|
|
|
print STDERR "> ",join(" ", @_),"\n";
|
|
|
|
}
|
|
|
|
}
|
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};
|
|
|
|
# Always print to log, print to screen only when --verbose is used
|
|
|
|
_mtr_log("> Restart: $proc - ",@args);
|
|
|
|
if ( $::opt_verbose_restart )
|
|
|
|
{
|
|
|
|
print STDERR "> Restart $proc - ",join(" ", @args),"\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-30 16:34:01 +01:00
|
|
|
1;
|