MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:April 29 2009 2:14pm
Subject:bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2786) Bug#44511
View as plain text  
#At file:///home/bm136801/mysql/waitall-51/

 2786 Bjorn Munch	2009-04-29
       Bug #44511 MTR2: add an option not to kill other servers when one from the group exits
      MTR would die as soon as one server terminates
      Implemented --wait-all option and associated subroutine
      modified:
        mysql-test/lib/My/SafeProcess.pm
        mysql-test/mysql-test-run.pl

=== modified file 'mysql-test/lib/My/SafeProcess.pm'
--- a/mysql-test/lib/My/SafeProcess.pm	2009-04-08 12:54:36 +0000
+++ b/mysql-test/lib/My/SafeProcess.pm	2009-04-29 14:13:38 +0000
@@ -536,6 +536,18 @@ sub wait_any {
   return $proc;
 }
 
+
+#
+# Wait for all processes to exit
+#
+sub wait_all {
+  while(keys %running)
+  {
+    wait_any();
+  }
+}
+
+
 #
 # Check if any process has exited, but don't wait.
 #

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-04-28 21:06:36 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-04-29 14:13:38 +0000
@@ -209,6 +209,7 @@ sub check_timeout { return $opt_testcase
 
 my $opt_start;
 my $opt_start_dirty;
+my $opt_wait_all;
 my $opt_repeat= 1;
 my $opt_retry= 3;
 my $opt_retry_failure= 2;
@@ -879,6 +880,7 @@ sub command_line_setup {
              'sleep=i'                  => \$opt_sleep,
              'start-dirty'              => \$opt_start_dirty,
              'start'                    => \$opt_start,
+             'wait-all'                 => \$opt_wait_all,
 	     'print-testcases'          => \&collect_option,
 	     'repeat=i'                 => \$opt_repeat,
 	     'retry=i'                  => \$opt_retry,
@@ -1237,6 +1239,15 @@ sub command_line_setup {
   }
 
   # --------------------------------------------------------------------------
+  # Check use of wait-all
+  # --------------------------------------------------------------------------
+
+  if ($opt_wait_all && ! ($opt_start_dirty || $opt_start))
+  {
+    mtr_error("--wait-all can only be used with --start or --start-dirty");
+  }
+
+  # --------------------------------------------------------------------------
   # Check timeout arguments
   # --------------------------------------------------------------------------
 
@@ -3258,19 +3269,29 @@ sub run_testcase ($) {
   # --------------------------------------------------------------------
   # If --start or --start-dirty given, stop here to let user manually
   # run tests
+  # If --wait-all is also given, do the same, but don't die if one
+  # server exits
   # ----------------------------------------------------------------------
+
   if ( $opt_start or $opt_start_dirty )
   {
     mtr_print("\nStarted", started(all_servers()));
     mtr_print("Waiting for server(s) to exit...");
-    my $proc= My::SafeProcess->wait_any();
-    if ( grep($proc eq $_, started(all_servers())) )
-    {
-      mtr_print("Server $proc died");
+    if ( $opt_wait_all ) {
+      My::SafeProcess->wait_all();
+      mtr_print( "All servers exited" );
+      exit(1);
+    }
+    else {
+      my $proc= My::SafeProcess->wait_any();
+      if ( grep($proc eq $_, started(all_servers())) )
+      {
+        mtr_print("Server $proc died");
+        exit(1);
+      }
+      mtr_print("Unknown process $proc died");
       exit(1);
     }
-    mtr_print("Unknown process $proc died");
-    exit(1);
   }
 
   my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout());
@@ -5153,6 +5174,8 @@ Misc options
                          $0 --start alias &
   start-dirty           Only start the servers (without initialization) for
                         the first specified test case
+  wait-all              If --start or --start-dirty option is used, wait for all
+                        servers to exit before finishing the process
   fast                  Run as fast as possible, dont't wait for servers
                         to shutdown etc.
   repeat=N              Run each test N number of times

Thread
bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2786) Bug#44511Bjorn Munch29 Apr