Commit 8c54f0e6 authored by He Zhenxing's avatar He Zhenxing

Auto merge

parents 560a9d15 451a6f77
...@@ -186,6 +186,10 @@ my $opt_suite_timeout = 300; # minutes ...@@ -186,6 +186,10 @@ my $opt_suite_timeout = 300; # minutes
my $opt_shutdown_timeout= 10; # seconds my $opt_shutdown_timeout= 10; # seconds
my $opt_start_timeout = 180; # seconds my $opt_start_timeout = 180; # seconds
sub testcase_timeout { return $opt_testcase_timeout * 60; };
sub suite_timeout { return $opt_suite_timeout * 60; };
sub check_timeout { return $opt_testcase_timeout * 6; };
my $opt_start; my $opt_start;
my $opt_start_dirty; my $opt_start_dirty;
my $opt_repeat= 1; my $opt_repeat= 1;
...@@ -409,7 +413,7 @@ sub run_test_server ($$$) { ...@@ -409,7 +413,7 @@ sub run_test_server ($$$) {
my %running; my %running;
my $result; my $result;
my $suite_timeout_proc= My::SafeProcess->timer($opt_suite_timeout * 60); my $suite_timeout_proc= My::SafeProcess->timer(suite_timeout());
my $s= IO::Select->new(); my $s= IO::Select->new();
$s->add($server); $s->add($server);
...@@ -1166,7 +1170,18 @@ sub command_line_setup { ...@@ -1166,7 +1170,18 @@ sub command_line_setup {
} }
} }
# # --------------------------------------------------------------------------
# Check timeout arguments
# --------------------------------------------------------------------------
mtr_error("Invalid value '$opt_testcase_timeout' supplied ".
"for option --testcase-timeout")
if ($opt_testcase_timeout <= 0);
mtr_error("Invalid value '$opt_suite_timeout' supplied ".
"for option --testsuite-timeout")
if ($opt_suite_timeout <= 0);
# --------------------------------------------------------------------------
# Check valgrind arguments # Check valgrind arguments
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args) if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args)
...@@ -2752,6 +2767,8 @@ sub check_testcase($$) ...@@ -2752,6 +2767,8 @@ sub check_testcase($$)
# Return immediately if no check proceess was started # Return immediately if no check proceess was started
return 0 unless ( keys %started ); return 0 unless ( keys %started );
my $timeout_proc= My::SafeProcess->timer(check_timeout());
while (1){ while (1){
my $result; my $result;
my $proc= My::SafeProcess->wait_any(); my $proc= My::SafeProcess->wait_any();
...@@ -2778,6 +2795,9 @@ sub check_testcase($$) ...@@ -2778,6 +2795,9 @@ sub check_testcase($$)
if ( keys(%started) == 0){ if ( keys(%started) == 0){
# All checks completed # All checks completed
$timeout_proc->kill();
return 0; return 0;
} }
# Wait for next process to exit # Wait for next process to exit
...@@ -2790,8 +2810,12 @@ sub check_testcase($$) ...@@ -2790,8 +2810,12 @@ sub check_testcase($$)
# Test failed, grab the report mysqltest has created # Test failed, grab the report mysqltest has created
my $report= mtr_grab_file($err_file); my $report= mtr_grab_file($err_file);
$tinfo->{check}.= $tinfo->{check}.=
"\nThe check of testcase '$tname' failed, this is the\n". "\nMTR's internal check of the test case '$tname' failed.
"diff between before and after:\n"; This means that the test case does not preserve the state that existed
before the test case was executed. Most likely the test case did not
do a proper clean-up.
This is the diff of the states of the servers before and after the
test case was executed:\n";
$tinfo->{check}.= $report; $tinfo->{check}.= $report;
# Check failed, mark the test case with that info # Check failed, mark the test case with that info
...@@ -2817,6 +2841,12 @@ sub check_testcase($$) ...@@ -2817,6 +2841,12 @@ sub check_testcase($$)
} }
} }
elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for ".
"'check-testcase' expired after ".check_timeout().
" seconds";
$result= 4;
}
else { else {
# Unknown process returned, most likley a crash, abort everything # Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}= $tinfo->{comment}=
...@@ -2828,8 +2858,12 @@ sub check_testcase($$) ...@@ -2828,8 +2858,12 @@ sub check_testcase($$)
# Kill any check processes still running # Kill any check processes still running
map($_->kill(), values(%started)); map($_->kill(), values(%started));
$timeout_proc->kill();
return $result; return $result;
} }
mtr_error("INTERNAL_ERROR: check_testcase");
} }
...@@ -2896,7 +2930,7 @@ sub run_on_all($$) ...@@ -2896,7 +2930,7 @@ sub run_on_all($$)
# Return immediately if no check proceess was started # Return immediately if no check proceess was started
return 0 unless ( keys %started ); return 0 unless ( keys %started );
my $timeout_proc= My::SafeProcess->timer(60); # Seconds my $timeout_proc= My::SafeProcess->timer(check_timeout());
while (1){ while (1){
my $result; my $result;
...@@ -2927,7 +2961,9 @@ sub run_on_all($$) ...@@ -2927,7 +2961,9 @@ sub run_on_all($$)
next; next;
} }
elsif ( $proc eq $timeout_proc ) { elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc expired for running '$run'"; $tinfo->{comment}.= "Timeout $timeout_proc for '$run' ".
"expired after ". check_timeout().
" seconds";
} }
else { else {
# Unknown process returned, most likley a crash, abort everything # Unknown process returned, most likley a crash, abort everything
...@@ -2942,6 +2978,7 @@ sub run_on_all($$) ...@@ -2942,6 +2978,7 @@ sub run_on_all($$)
return 1; return 1;
} }
mtr_error("INTERNAL_ERROR: run_on_all");
} }
...@@ -3125,7 +3162,7 @@ sub run_testcase ($) { ...@@ -3125,7 +3162,7 @@ sub run_testcase ($) {
exit(1); exit(1);
} }
my $test_timeout_proc= My::SafeProcess->timer($opt_testcase_timeout * 60); my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout());
do_before_run_mysqltest($tinfo); do_before_run_mysqltest($tinfo);
...@@ -3270,14 +3307,16 @@ sub run_testcase ($) { ...@@ -3270,14 +3307,16 @@ sub run_testcase ($) {
{ {
my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log"; my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log";
$tinfo->{comment}= $tinfo->{comment}=
"Test case timeout after $opt_testcase_timeout minute(s)\n\n"; "Test case timeout after ".testcase_timeout().
" seconds\n\n";
# Add 20 last executed commands from test case log file # Add 20 last executed commands from test case log file
if (-e $log_file_name) if (-e $log_file_name)
{ {
$tinfo->{comment}.= $tinfo->{comment}.=
"== $log_file_name == \n" . mtr_lastlinesfromfile($log_file_name, 20)."\n"; "== $log_file_name == \n".
mtr_lastlinesfromfile($log_file_name, 20)."\n";
} }
$tinfo->{'timeout'}= $opt_testcase_timeout; # Mark as timeout $tinfo->{'timeout'}= testcase_timeout(); # Mark as timeout
run_on_all($tinfo, 'analyze-timeout'); run_on_all($tinfo, 'analyze-timeout');
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
return 1; return 1;
...@@ -3371,6 +3410,8 @@ sub check_warnings ($) { ...@@ -3371,6 +3410,8 @@ sub check_warnings ($) {
# Return immediately if no check proceess was started # Return immediately if no check proceess was started
return 0 unless ( keys %started ); return 0 unless ( keys %started );
my $timeout_proc= My::SafeProcess->timer(check_timeout());
while (1){ while (1){
my $result= 0; my $result= 0;
my $proc= My::SafeProcess->wait_any(); my $proc= My::SafeProcess->wait_any();
...@@ -3403,6 +3444,9 @@ sub check_warnings ($) { ...@@ -3403,6 +3444,9 @@ sub check_warnings ($) {
if ( keys(%started) == 0){ if ( keys(%started) == 0){
# All checks completed # All checks completed
$timeout_proc->kill();
return $result; return $result;
} }
# Wait for next process to exit # Wait for next process to exit
...@@ -3421,6 +3465,12 @@ sub check_warnings ($) { ...@@ -3421,6 +3465,12 @@ sub check_warnings ($) {
# Remove the .err file the check generated # Remove the .err file the check generated
unlink($err_file); unlink($err_file);
} }
elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for ".
"'check warnings' expired after ".check_timeout().
" seconds";
$result= 4;
}
else { else {
# Unknown process returned, most likley a crash, abort everything # Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}= $tinfo->{comment}=
...@@ -3431,10 +3481,12 @@ sub check_warnings ($) { ...@@ -3431,10 +3481,12 @@ sub check_warnings ($) {
# Kill any check processes still running # Kill any check processes still running
map($_->kill(), values(%started)); map($_->kill(), values(%started));
$timeout_proc->kill();
return $result; return $result;
} }
return $res; mtr_error("INTERNAL_ERROR: check_warnings");
} }
......
...@@ -27,9 +27,10 @@ INSERT into t1(name) values('Record_3'); ...@@ -27,9 +27,10 @@ INSERT into t1(name) values('Record_3');
INSERT into t1(name) values('Record_4'); INSERT into t1(name) values('Record_4');
## There should be a difference ## ## There should be a difference ##
SET @@session.max_allowed_packet= 1024*1024*1024; SET @@session.max_allowed_packet= 1024*1024*1024;
select SET @orig_file= load_file('MYSQLD_LOGFILE.orig');
STRCMP(load_file('MYSQLD_LOGFILE.orig'), load_file('MYSQLD_LOGFILE.copy')); SET @copy_file= load_file('MYSQLD_LOGFILE.copy');
STRCMP(load_file('MYSQLD_LOGFILE.orig'), load_file('MYSQLD_LOGFILE.copy')) SELECT STRCMP(@orig_file, @copy_file);
STRCMP(@orig_file, @copy_file)
1 1
## Dropping tables ## ## Dropping tables ##
DROP TABLE t1; DROP TABLE t1;
...@@ -436,11 +436,13 @@ reset master; ...@@ -436,11 +436,13 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
CREATE TABLE mysqltest1.without_select (f1 BIGINT); CREATE TABLE mysqltest1.without_select (f1 BIGINT);
CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1; CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1;
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # DROP DATABASE IF EXISTS mysqltest1
master-bin.000001 # Query # # CREATE DATABASE mysqltest1 master-bin.000001 # Query # # CREATE DATABASE mysqltest1
master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT) master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT)
master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; BEGIN
......
...@@ -266,6 +266,9 @@ sync_slave_with_master; ...@@ -266,6 +266,9 @@ sync_slave_with_master;
source include/master-slave-reset.inc; source include/master-slave-reset.inc;
connection master; connection master;
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
--enable_warnings
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
CREATE TABLE mysqltest1.without_select (f1 BIGINT); CREATE TABLE mysqltest1.without_select (f1 BIGINT);
......
...@@ -81,8 +81,10 @@ INSERT into t1(name) values('Record_4'); ...@@ -81,8 +81,10 @@ INSERT into t1(name) values('Record_4');
--echo ## There should be a difference ## --echo ## There should be a difference ##
SET @@session.max_allowed_packet= 1024*1024*1024; SET @@session.max_allowed_packet= 1024*1024*1024;
--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE --replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
eval select eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig');
STRCMP(load_file('$MYSQLD_LOGFILE.orig'), load_file('$MYSQLD_LOGFILE.copy')); --replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
eval SET @copy_file= load_file('$MYSQLD_LOGFILE.copy');
eval SELECT STRCMP(@orig_file, @copy_file);
--remove_file $MYSQLD_LOGFILE.copy --remove_file $MYSQLD_LOGFILE.copy
--remove_file $MYSQLD_LOGFILE.orig --remove_file $MYSQLD_LOGFILE.orig
......
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