diff options
author | kent@mysql.com <> | 2005-09-01 14:45:39 +0200 |
---|---|---|
committer | kent@mysql.com <> | 2005-09-01 14:45:39 +0200 |
commit | b6889a4e72170a7179fc65c24480cc4fb795d921 (patch) | |
tree | cee23c9b964cf7b94d1601294e4dab95020ec924 /mysql-test | |
parent | 4b5ca92631d3781904a9d391ffd0b68afe804260 (diff) | |
parent | 1a5f346bf9ef2d4b12cfbd26989650045b1339fa (diff) | |
download | mariadb-git-b6889a4e72170a7179fc65c24480cc4fb795d921.tar.gz |
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/Users/kent/mysql/bk/mysql-4.1
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/lib/mtr_process.pl | 82 | ||||
-rw-r--r-- | mysql-test/lib/mtr_report.pl | 5 | ||||
-rw-r--r-- | mysql-test/lib/mtr_timer.pl | 12 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 45 |
4 files changed, 97 insertions, 47 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index c9ae92305c2..bae66353825 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -12,16 +12,17 @@ use strict; #use POSIX ":sys_wait_h"; use POSIX 'WNOHANG'; -sub mtr_run ($$$$$$); -sub mtr_spawn ($$$$$$); +sub mtr_run ($$$$$$;$); +sub mtr_spawn ($$$$$$;$); sub mtr_stop_mysqld_servers ($); sub mtr_kill_leftovers (); sub mtr_record_dead_children (); sub mtr_exit ($); sub sleep_until_file_created ($$$); +sub mtr_kill_processes ($); # static in C -sub spawn_impl ($$$$$$$); +sub spawn_impl ($$$$$$$$); ############################################################################## # @@ -32,37 +33,43 @@ sub spawn_impl ($$$$$$$); # This function try to mimic the C version used in "netware/mysql_test_run.c" # FIXME learn it to handle append mode as well, a "new" flag or a "append" -sub mtr_run ($$$$$$) { +sub mtr_run ($$$$$$;$) { my $path= shift; my $arg_list_t= shift; my $input= shift; my $output= shift; my $error= shift; my $pid_file= shift; + my $spawn_opts= shift; - return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file); + return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file, + $spawn_opts); } -sub mtr_run_test ($$$$$$) { +sub mtr_run_test ($$$$$$;$) { my $path= shift; my $arg_list_t= shift; my $input= shift; my $output= shift; my $error= shift; my $pid_file= shift; + my $spawn_opts= shift; - return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file); + return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file, + $spawn_opts); } -sub mtr_spawn ($$$$$$) { +sub mtr_spawn ($$$$$$;$) { my $path= shift; my $arg_list_t= shift; my $input= shift; my $output= shift; my $error= shift; my $pid_file= shift; + my $spawn_opts= shift; - return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file); + return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file, + $spawn_opts); } @@ -72,7 +79,7 @@ sub mtr_spawn ($$$$$$) { # ############################################################################## -sub spawn_impl ($$$$$$$) { +sub spawn_impl ($$$$$$$$) { my $path= shift; my $arg_list_t= shift; my $mode= shift; @@ -80,6 +87,7 @@ sub spawn_impl ($$$$$$$) { my $output= shift; my $error= shift; my $pid_file= shift; # FIXME + my $spawn_opts= shift; if ( $::opt_script_debug ) { @@ -89,6 +97,18 @@ sub spawn_impl ($$$$$$$) { print STDERR "#### ", "STDOUT $output\n" if $output; print STDERR "#### ", "STDERR $error\n" if $error; print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n"; + print STDERR "#### ", "spawn options:\n"; + if ($spawn_opts) + { + foreach my $key (sort keys %{$spawn_opts}) + { + print STDERR "#### ", " - $key: $spawn_opts->{$key}\n"; + } + } + else + { + print STDERR "#### ", " none\n"; + } print STDERR "#### ", "-" x 78, "\n"; } @@ -135,9 +155,16 @@ sub spawn_impl ($$$$$$$) { # $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c"; } + my $log_file_open_mode = '>'; + + if ($spawn_opts and $spawn_opts->{'append_log_file'}) + { + $log_file_open_mode = '>>'; + } + if ( $output ) { - if ( ! open(STDOUT,">",$output) ) + if ( ! open(STDOUT,$log_file_open_mode,$output) ) { mtr_error("can't redirect STDOUT to \"$output\": $!"); } @@ -154,9 +181,9 @@ sub spawn_impl ($$$$$$$) { } else { - if ( ! open(STDERR,">",$error) ) + if ( ! open(STDERR,$log_file_open_mode,$error) ) { - mtr_error("can't redirect STDERR to \"$output\": $!"); + mtr_error("can't redirect STDERR to \"$error\": $!"); } } } @@ -533,17 +560,8 @@ sub mtr_stop_mysqld_servers ($) { start_reap_all(); # Avoid zombies - SIGNAL: - foreach my $sig (15,9) - { - my $retries= 20; # FIXME 20 seconds, this is silly! - kill($sig, keys %mysqld_pids); - while ( $retries-- and kill(0, keys %mysqld_pids) ) - { - mtr_debug("Sleep 1 second waiting for processes to die"); - sleep(1) # Wait one second - } - } + my @mysqld_pids= keys %mysqld_pids; + mtr_kill_processes(\@mysqld_pids); stop_reap_all(); # Get into control again @@ -826,6 +844,21 @@ sub sleep_until_file_created ($$$) { } +sub mtr_kill_processes ($) { + my $pids = shift; + + foreach my $sig (15,9) + { + my $retries= 20; # FIXME 20 seconds, this is silly! + kill($sig, @{$pids}); + while ( $retries-- and kill(0, @{$pids}) ) + { + mtr_debug("Sleep 1 second waiting for processes to die"); + sleep(1) # Wait one second + } + } +} + ############################################################################## # # When we exit, we kill off all children @@ -841,6 +874,7 @@ sub sleep_until_file_created ($$$) { sub mtr_exit ($) { my $code= shift; # cluck("Called mtr_exit()"); + mtr_timer_stop_all($::glob_timers); local $SIG{HUP} = 'IGNORE'; kill('HUP', -$$); sleep 2; diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 5e1a8308505..868653afaa4 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -177,7 +177,7 @@ sub mtr_report_stats ($) { "%.2f\% were successful.\n\n", $ratio; print "The log files in var/log may give you some hint\n", - "of what when wrong.\n", + "of what went wrong.\n", "If you want to report this error, please read first ", "the documentation at\n", "http://www.mysql.com/doc/en/MySQL_test_suite.html\n"; @@ -223,7 +223,8 @@ sub mtr_report_stats ($) { if ( $tot_failed != 0 ) { - print "mysql-test-run: *** Failing the test(s):"; + my $test_mode= join(" ", @::glob_test_mode) || "default"; + print "mysql-test-run in $test_mode mode: *** Failing the test(s):"; foreach my $tinfo (@$tests) { diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl index aab57d1bc52..709cebd6407 100644 --- a/mysql-test/lib/mtr_timer.pl +++ b/mysql-test/lib/mtr_timer.pl @@ -15,6 +15,7 @@ use POSIX 'WNOHANG'; sub mtr_init_timers (); sub mtr_timer_start($$$); sub mtr_timer_stop($$); +sub mtr_timer_stop_all($); sub mtr_timer_waitpid($$$); ############################################################################## @@ -113,6 +114,17 @@ sub mtr_timer_stop ($$) { } +sub mtr_timer_stop_all ($) { + my $timers= shift; + + foreach my $name ( keys %{$timers->{'timers'}} ) + { + mtr_timer_stop($timers, $name); + } + return 1; +} + + sub mtr_timer_timeout ($$) { my ($timers,$pid)= @_; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e72d8f5f683..fffdd9037ec 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -142,6 +142,7 @@ our $glob_timers= undef; our $glob_use_running_server= 0; our $glob_use_running_ndbcluster= 0; our $glob_use_embedded_server= 0; +our @glob_test_mode; our $glob_basedir; @@ -606,6 +607,7 @@ sub command_line_setup () { if ( $opt_embedded_server ) { $glob_use_embedded_server= 1; + push(@glob_test_mode, "embedded"); $opt_skip_rpl= 1; # We never run replication with embedded if ( $opt_extern ) @@ -614,6 +616,11 @@ sub command_line_setup () { } } + if ( $opt_ps_protocol ) + { + push(@glob_test_mode, "ps-protocol"); + } + # FIXME don't understand what this is # if ( $opt_local_master ) # { @@ -999,25 +1006,19 @@ sub kill_and_cleanup () { # FIXME do we really need to create these all, or are they # created for us when tables are created? - rmtree("$master->[0]->{'path_myddir'}"); - mkpath("$master->[0]->{'path_myddir'}/mysql"); - mkpath("$master->[0]->{'path_myddir'}/test"); - - rmtree("$master->[1]->{'path_myddir'}"); - mkpath("$master->[1]->{'path_myddir'}/mysql"); - mkpath("$master->[1]->{'path_myddir'}/test"); - - rmtree("$slave->[0]->{'path_myddir'}"); - mkpath("$slave->[0]->{'path_myddir'}/mysql"); - mkpath("$slave->[0]->{'path_myddir'}/test"); - - rmtree("$slave->[1]->{'path_myddir'}"); - mkpath("$slave->[1]->{'path_myddir'}/mysql"); - mkpath("$slave->[1]->{'path_myddir'}/test"); - - rmtree("$slave->[2]->{'path_myddir'}"); - mkpath("$slave->[2]->{'path_myddir'}/mysql"); - mkpath("$slave->[2]->{'path_myddir'}/test"); + my @data_dir_lst = ( + $master->[0]->{'path_myddir'}, + $master->[1]->{'path_myddir'}, + $slave->[0]->{'path_myddir'}, + $slave->[1]->{'path_myddir'}, + $slave->[2]->{'path_myddir'}); + + foreach my $data_dir (@data_dir_lst) + { + rmtree("$data_dir"); + mkpath("$data_dir/mysql"); + mkpath("$data_dir/test"); + } # To make some old test cases work, we create a soft # link from the old "var" location to the new one @@ -1565,8 +1566,9 @@ sub report_failure_and_restart ($) { print "\n"; if ( ! $opt_force ) { - print "Aborting: $tinfo->{'name'} failed. To continue, re-run with '--force'."; - print "\n"; + my $test_mode= join(" ", @::glob_test_mode) || "default"; + print "Aborting: $tinfo->{'name'} failed in $test_mode mode. "; + print "To continue, re-run with '--force'.\n"; if ( ! $opt_gdb and ! $glob_use_running_server and ! $opt_ddd and ! $glob_use_embedded_server ) { @@ -1612,6 +1614,7 @@ sub do_before_start_master ($$) { } } + # FIXME only remove the ones that are tied to this master # Remove old master.info and relay-log.info files unlink("$master->[0]->{'path_myddir'}/master.info"); unlink("$master->[0]->{'path_myddir'}/relay-log.info"); |