[Maria-developers] Rev 2724: Ability to stop mysql-test-run.pl temporary (useful for them who run buildbot slave on thier work computers) in file:///Users/bell/maria/bzr/work-maria-5.1/
At file:///Users/bell/maria/bzr/work-maria-5.1/ ------------------------------------------------------------ revno: 2724 revision-id: sanja@askmonty.org-20090902091710-4p0hjwa0usl3e8av parent: psergey@askmonty.org-20090901115954-nge2brzh3akkmtlz committer: sanja@askmonty.org branch nick: work-maria-5.1 timestamp: Wed 2009-09-02 12:17:10 +0300 message: Ability to stop mysql-test-run.pl temporary (useful for them who run buildbot slave on thier work computers) === modified file 'mysql-test/lib/mtr_misc.pl' --- a/mysql-test/lib/mtr_misc.pl 2009-02-19 09:01:25 +0000 +++ b/mysql-test/lib/mtr_misc.pl 2009-09-02 09:17:10 +0000 @@ -174,4 +174,21 @@ select(undef, undef, undef, ($millis/1000)); } +sub mtr_wait_lock_file { + die "usage: mtr_wait_lock_file(path_to_file, show_stop)" unless @_ == 2; + my ($file, $show)= @_; + my $waited= 0; + + while ( -e $file) + { + if (!$waited && $show) + { + print "\nGOING TO STOP...\n"; + } + mtr_milli_sleep(1000); + $waited= 1; + } + return ($waited); +} + 1; === modified file 'mysql-test/mysql-test-run.pl' --- a/mysql-test/mysql-test-run.pl 2009-06-22 08:06:35 +0000 +++ b/mysql-test/mysql-test-run.pl 2009-09-02 09:17:10 +0000 @@ -252,6 +252,11 @@ my $opt_parallel= $ENV{MTR_PARALLEL} || 1; +# lock file to stop tests +my $opt_stop_file= $ENV{MTR_STOP_FILE}; +# print message when test suite goint to be stopped +my $opt_show_stop= 0; + select(STDOUT); $| = 1; # Automatically flush STDOUT @@ -450,6 +455,15 @@ my $s= IO::Select->new(); $s->add($server); while (1) { + if ($opt_stop_file) + { + if (mtr_wait_lock_file($opt_stop_file, $opt_show_stop)) + { + # We were waiting so restart timer process + $suite_timeout_proc->kill(); + $suite_timeout_proc= My::SafeProcess->timer(suite_timeout()); + } + } my @ready = $s->can_read(1); # Wake up once every second foreach my $sock (@ready) { if ($sock == $server) { @@ -931,6 +945,8 @@ 'warnings!' => \$opt_warnings, 'timestamp' => \&report_option, 'timediff' => \&report_option, + 'stop-file=s' => \$opt_stop_file, + 'show-stop' => \$opt_show_stop, 'help|h' => \$opt_usage, 'list-options' => \$opt_list_options, @@ -5392,6 +5408,12 @@ warnings Scan the log files for warnings. Use --nowarnings to turn off. + stop-file=file (also MTR_STOP_FILE environment variable) if this + file detected mysql test will not start new tests + until the file will be removed. + show-stop works with stop-file, print message when mysql test + switches to waiting to removing the file mode. + sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time debug-sync-timeout=NUM Set default timeout for WAIT_FOR debug sync actions. Disable facility with NUM=0.
participants (1)
-
sanja@askmonty.org