Commit ee793d03 authored by unknown's avatar unknown

mtr_process.pl:

  Bug#11792: Check all of status code, to catch a crash as a failure
mtr_cases.pl:
  Code cleanup for skipped/disabled handling
mtr_process.pl:
  In debug mode, report if mysqladmin did not at least
  make the server stop listening to the port.
  Increased the time waiting for terminating to 20 seconds,
  to wait for really slow slave shutdown.
  Added call to start_reap_all(), to avoid zombies.
mtr_report.pl:
  Removed prototype for unused function mtr_report_test_disabled()


mysql-test/lib/mtr_report.pl:
  Removed prototype for unused function mtr_report_test_disabled()
mysql-test/lib/mtr_cases.pl:
  Code cleanup for skipped/disabled handling
mysql-test/lib/mtr_process.pl:
  Bug#11792: Check all of status code, to catch a crash as a failure
parent 996eb5df
...@@ -53,21 +53,20 @@ sub collect_test_cases ($) { ...@@ -53,21 +53,20 @@ sub collect_test_cases ($) {
else else
{ {
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Skip some tests listed in disabled.def # Disable some tests listed in disabled.def
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
my %skiplist; my %disabled;
my $skipfile= "$testdir/disabled.def"; if ( open(DISABLED, "$testdir/disabled.def" ) )
if ( open(SKIPFILE, $skipfile) )
{ {
while ( <SKIPFILE> ) while ( <DISABLED> )
{ {
chomp; chomp;
if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ ) if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
{ {
$skiplist{$1}= $2; $disabled{$1}= $2;
} }
} }
close SKIPFILE; close DISABLED;
} }
foreach my $elem ( sort readdir(TESTDIR) ) { foreach my $elem ( sort readdir(TESTDIR) ) {
...@@ -75,7 +74,7 @@ sub collect_test_cases ($) { ...@@ -75,7 +74,7 @@ sub collect_test_cases ($) {
next if ! defined $tname; next if ! defined $tname;
next if $::opt_do_test and ! defined mtr_match_prefix($elem,$::opt_do_test); next if $::opt_do_test and ! defined mtr_match_prefix($elem,$::opt_do_test);
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%skiplist); collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled);
} }
closedir TESTDIR; closedir TESTDIR;
} }
...@@ -119,7 +118,7 @@ sub collect_one_test_case($$$$$$) { ...@@ -119,7 +118,7 @@ sub collect_one_test_case($$$$$$) {
my $tname= shift; my $tname= shift;
my $elem= shift; my $elem= shift;
my $cases= shift; my $cases= shift;
my $skiplist=shift; my $disabled=shift;
my $path= "$testdir/$elem"; my $path= "$testdir/$elem";
...@@ -188,7 +187,7 @@ sub collect_one_test_case($$$$$$) { ...@@ -188,7 +187,7 @@ sub collect_one_test_case($$$$$$) {
my $slave_mi_file= "$testdir/$tname.slave-mi"; my $slave_mi_file= "$testdir/$tname.slave-mi";
my $master_sh= "$testdir/$tname-master.sh"; my $master_sh= "$testdir/$tname-master.sh";
my $slave_sh= "$testdir/$tname-slave.sh"; my $slave_sh= "$testdir/$tname-slave.sh";
my $disabled= "$testdir/$tname.disabled"; my $disabled_file= "$testdir/$tname.disabled";
$tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; $tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
$tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : []; $tinfo->{'slave_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
...@@ -292,18 +291,18 @@ sub collect_one_test_case($$$$$$) { ...@@ -292,18 +291,18 @@ sub collect_one_test_case($$$$$$) {
} }
# FIXME why this late? # FIXME why this late?
if ( $skiplist->{$tname} ) if ( $disabled->{$tname} )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip' $tinfo->{'disable'}= 1; # Sub type of 'skip'
$tinfo->{'comment'}= $skiplist->{$tname} if $skiplist->{$tname}; $tinfo->{'comment'}= $disabled->{$tname} if $disabled->{$tname};
} }
if ( -f $disabled ) if ( -f $disabled_file )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip' $tinfo->{'disable'}= 1; # Sub type of 'skip'
$tinfo->{'comment'}= mtr_fromfile($disabled); $tinfo->{'comment'}= mtr_fromfile($disabled_file);
} }
# We can't restart a running server that may be in use # We can't restart a running server that may be in use
......
...@@ -186,8 +186,8 @@ sub spawn_parent_impl { ...@@ -186,8 +186,8 @@ sub spawn_parent_impl {
if ( $mode eq 'run' or $mode eq 'test' ) if ( $mode eq 'run' or $mode eq 'test' )
{ {
my $exit_value= -1; my $exit_value= -1;
my $signal_num= 0; # my $signal_num= 0;
my $dumped_core= 0; # my $dumped_core= 0;
if ( $mode eq 'run' ) if ( $mode eq 'run' )
{ {
...@@ -199,9 +199,10 @@ sub spawn_parent_impl { ...@@ -199,9 +199,10 @@ sub spawn_parent_impl {
mtr_error("$path ($pid) got lost somehow"); mtr_error("$path ($pid) got lost somehow");
} }
$exit_value= $? >> 8; $exit_value= $?;
$signal_num= $? & 127; # $exit_value= $? >> 8;
$dumped_core= $? & 128; # $signal_num= $? & 127;
# $dumped_core= $? & 128;
return $exit_value; return $exit_value;
} }
...@@ -229,9 +230,10 @@ sub spawn_parent_impl { ...@@ -229,9 +230,10 @@ sub spawn_parent_impl {
if ( $ret_pid == $pid ) if ( $ret_pid == $pid )
{ {
# We got termination of mysqltest, we are done # We got termination of mysqltest, we are done
$exit_value= $? >> 8; $exit_value= $?;
$signal_num= $? & 127; # $exit_value= $? >> 8;
$dumped_core= $? & 128; # $signal_num= $? & 127;
# $dumped_core= $? & 128;
last; last;
} }
...@@ -473,6 +475,7 @@ sub mtr_stop_mysqld_servers ($) { ...@@ -473,6 +475,7 @@ sub mtr_stop_mysqld_servers ($) {
} }
else else
{ {
# Server is dead, we remove the pidfile if any
# Race, could have been removed between I tested with -f # Race, could have been removed between I tested with -f
# and the unlink() below, so I better check again with -f # and the unlink() below, so I better check again with -f
...@@ -502,10 +505,12 @@ sub mtr_stop_mysqld_servers ($) { ...@@ -502,10 +505,12 @@ sub mtr_stop_mysqld_servers ($) {
# that for true Win32 processes, kill(0,$pid) will not return 1. # that for true Win32 processes, kill(0,$pid) will not return 1.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
start_reap_all(); # Avoid zombies
SIGNAL: SIGNAL:
foreach my $sig (15,9) foreach my $sig (15,9)
{ {
my $retries= 10; # 10 seconds my $retries= 20; # FIXME 20 seconds, this is silly!
kill($sig, keys %mysqld_pids); kill($sig, keys %mysqld_pids);
while ( $retries-- and kill(0, keys %mysqld_pids) ) while ( $retries-- and kill(0, keys %mysqld_pids) )
{ {
...@@ -514,6 +519,8 @@ sub mtr_stop_mysqld_servers ($) { ...@@ -514,6 +519,8 @@ sub mtr_stop_mysqld_servers ($) {
} }
} }
stop_reap_all(); # Get into control again
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Now, we check if all we can find using kill(0,$pid) are dead, # Now, we check if all we can find using kill(0,$pid) are dead,
# and just assume the rest are. We cleanup socket and PID files. # and just assume the rest are. We cleanup socket and PID files.
...@@ -632,7 +639,8 @@ sub mtr_mysqladmin_shutdown () { ...@@ -632,7 +639,8 @@ sub mtr_mysqladmin_shutdown () {
$mysql_admin_pids{$pid}= 1; $mysql_admin_pids{$pid}= 1;
} }
# We wait blocking, we wait for the last one anyway # As mysqladmin is such a simple program, we trust it to terminate.
# I.e. we wait blocking, and wait wait for them all before we go on.
while (keys %mysql_admin_pids) while (keys %mysql_admin_pids)
{ {
foreach my $pid (keys %mysql_admin_pids) foreach my $pid (keys %mysql_admin_pids)
...@@ -651,7 +659,8 @@ sub mtr_mysqladmin_shutdown () { ...@@ -651,7 +659,8 @@ sub mtr_mysqladmin_shutdown () {
my $timeout= 20; # 20 seconds max my $timeout= 20; # 20 seconds max
my $res= 1; # If we just fall through, we are done my $res= 1; # If we just fall through, we are done
# in the sense that the servers don't
# listen to their ports any longer
TIME: TIME:
while ( $timeout-- ) while ( $timeout-- )
{ {
...@@ -669,6 +678,8 @@ sub mtr_mysqladmin_shutdown () { ...@@ -669,6 +678,8 @@ sub mtr_mysqladmin_shutdown () {
last; # If we got here, we are done last; # If we got here, we are done
} }
$timeout or mtr_debug("At least one server is still listening to its port");
sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep
return $res; return $res;
...@@ -794,8 +805,12 @@ sub sleep_until_file_created ($$$) { ...@@ -794,8 +805,12 @@ sub sleep_until_file_created ($$$) {
# #
############################################################################## ##############################################################################
# FIXME something is wrong, we sometimes terminate with "Hangup" written
# to tty, and no STDERR output telling us why.
sub mtr_exit ($) { sub mtr_exit ($) {
my $code= shift; my $code= shift;
# cluck("Called mtr_exit()");
local $SIG{HUP} = 'IGNORE'; local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$); kill('HUP', -$$);
exit($code); exit($code);
......
...@@ -10,7 +10,6 @@ sub mtr_report_test_name($); ...@@ -10,7 +10,6 @@ sub mtr_report_test_name($);
sub mtr_report_test_passed($); sub mtr_report_test_passed($);
sub mtr_report_test_failed($); sub mtr_report_test_failed($);
sub mtr_report_test_skipped($); sub mtr_report_test_skipped($);
sub mtr_report_test_disabled($);
sub mtr_show_failed_diff ($); sub mtr_show_failed_diff ($);
sub mtr_report_stats ($); sub mtr_report_stats ($);
......
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