MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:msvensson Date:October 31 2007 1:11pm
Subject:bk commit into 5.0 tree (msvensson:1.2565)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-31 14:11:14+01:00, msvensson@stripped +2 -0
  Reorganize wait for process to exit loop 

  mysql-test/lib/My/SafeProcess.pm@stripped, 2007-10-31 14:11:12+01:00, msvensson@stripped +3 -2
    Silence printouts
    Remove commen

  mysql-test/mysql-test-run.pl@stripped, 2007-10-31 14:11:12+01:00, msvensson@stripped +92 -108
    Reorganize wait for process to exit loop 

diff -Nrup a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
--- a/mysql-test/lib/My/SafeProcess.pm	2007-10-30 20:34:57 +01:00
+++ b/mysql-test/lib/My/SafeProcess.pm	2007-10-31 14:11:12 +01:00
@@ -118,6 +118,7 @@ else {
   # MASV				 "lib/My/Safeprocess/");
 }
 
+
 sub new {
   my $class= shift;
 
@@ -184,7 +185,7 @@ sub new {
 
 }
 
-# Hmm My::SafeTimer...
+
 sub timer {
   my $class= shift;
   my $duration= shift or die "duration required";
@@ -218,7 +219,7 @@ sub timer {
 
     # Check that parent is still alive
     if (kill(0, $parent_pid) == 0){
-      print STDERR "timer $$: parent gone, exiting!\n";
+      #print STDERR "timer $$: parent gone, exiting!\n";
       exit(0);
     }
 
diff -Nrup a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2007-10-30 20:34:57 +01:00
+++ b/mysql-test/mysql-test-run.pl	2007-10-31 14:11:12 +01:00
@@ -3056,51 +3056,23 @@ sub do_before_run_mysqltest($)
       $ENV{'NDB_STATUS_OK'} = "YES";
     }
   }
-
-  if ( $opt_check_testcases )
-  {
-    foreach my $mysqld (@{$master}, @{$slave})
-    {
-      if ( defined $mysqld->{'proc'} )
-      {
-	if (run_check_testcase($tinfo, "before", $mysqld))
-	{
-	  # Check failed, mark the test case with that info
-	  $tinfo->{'check_testcase_failed'}= 1;
-	}
-      }
-    }
-  }
-
 }
 
-sub do_after_run_mysqltest($)
-{
-  my $tinfo= shift;
-  my $tname= $tinfo->{'name'};
 
-  my $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
-
-  # Save info from this testcase run to mysqltest.log
-  mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
-    if -f $path_current_test_log;
-  mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
-    if -f $path_timefile;
+sub run_check_testcase_all($)
+{
+  my ($tinfo, $mode)= @_;
 
-  # Remove the file that mysqltest writes info to
-  unlink($path_timefile);
+  return if ( !$opt_check_testcases );
 
-  if ( $opt_check_testcases )
+  foreach my $mysqld (@{$master}, @{$slave})
   {
-    foreach my $mysqld (@{$master}, @{$slave})
+    if ( defined $mysqld->{'proc'} )
     {
-      if ( defined $mysqld->{'proc'} )
+      if (run_check_testcase($tinfo, $mode, $mysqld))
       {
-	if (run_check_testcase($tinfo, "after", $mysqld))
-	{
-	  # Check failed, mark the test case with that info
-	  $tinfo->{'check_testcase_failed'}= 1;
-	}
+	# Check failed, mark the test case with that info
+	$tinfo->{'check_testcase_failed'}= 1;
       }
     }
   }
@@ -3129,6 +3101,7 @@ sub run_testcase_mark_logs($)
 
 }
 
+
 sub find_testcase_skipped_reason($)
 {
   my ($tinfo)= @_;
@@ -3224,66 +3197,47 @@ sub run_testcase ($) {
     exit(0);
   }
 
-  {
-    my $test_timeout_proc= My::SafeProcess->timer($opt_testcase_timeout * 60);
+  my $test_timeout_proc= My::SafeProcess->timer($opt_testcase_timeout * 60);
 
-    do_before_run_mysqltest($tinfo);
+  do_before_run_mysqltest($tinfo);
+  run_check_testcase_all("before");
 
-    my $res= 37;
-    my $test= start_mysqltest($tinfo);
+  my $test= start_mysqltest($tinfo);
 
-    {
-      my $proc= My::SafeProcess->wait_any();
-      unless ( defined $proc )
-      {
-	# MASV FIXME Should not terminate program
-	mtr_error("wait_any failed");
-      }
-      mtr_verbose("Got $proc");
-      # Was it the test program that exited
-      if ($proc eq $test)
-      {
-	$res= $test->exit_status();
-	last; # Break while(1)
-      }
-
-      # It's not mysqltest that has exited, kill it
-      $test->killit();
-      $test->wait();
-
-      # Check if any server has died
-      foreach my $server ( started_servers() )
-      {
-	next if ($proc ne $server->{proc});
-
-	$res= 64; # Server failed during test run
-	last; # Break while(1)
-      }
+  my $proc= My::SafeProcess->wait_any();
+  unless ( defined $proc )
+  {
+    mtr_error("wait_any failed");
+  }
+  mtr_verbose("Got $proc");
 
-      # Check if testcase timer expired
-      if ( $proc eq $test_timeout_proc )
-      {
-	mtr_report("Test case timeout!");
-      	$res= 63;
-	last; # Break while(1)
-      }
+  # ----------------------------------------------------
+  # Stop the test case timer
+  # ----------------------------------------------------
+  $test_timeout_proc->killit();
+  $test_timeout_proc->wait();
 
-      # Check if test suite timer expired
-      if ( $proc eq $suite_timeout_proc )
-      {
-	mtr_report("Test suite timeout! Terminating...");
-      	exit(1);
-      }
-      mtr_error("Unhandled process $proc exited");
-    }
+  # ----------------------------------------------------------------------
+  # Stop Instance Manager if we are processing an IM-test case.
+  # ----------------------------------------------------------------------
+  if ( $tinfo->{'component_id'} eq 'im' and
+       !mtr_im_stop($instance_manager, $tinfo->{'name'}) )
+  {
+    mtr_error("Failed to stop Instance Manager.")
+  }
 
-    # Stop the test case timer
-    $test_timeout_proc->killit();
-    $test_timeout_proc->wait();
+  # ----------------------------------------------------
+  # Was it the test program that exited
+  # ----------------------------------------------------
+  if ($proc eq $test)
+  {
+    my $res= $test->exit_status();
 
     if ( $res == 0 )
     {
       mtr_report_test_passed($tinfo);
+
+      run_check_testcase_all("after");
     }
     elsif ( $res == 62 )
     {
@@ -3293,19 +3247,6 @@ sub run_testcase ($) {
       find_testcase_skipped_reason($tinfo);
       mtr_report_test_skipped($tinfo);
     }
-    elsif ( $res == 63 )
-    {
-      $tinfo->{'timeout'}= 1;           # Mark as timeout
-      report_failure_and_restart($tinfo);
-    }
-    elsif ( $res == 64 )
-    {
-      # Server failed, probably crashed
-      $tinfo->{comment}=
-	"Server exited during test run, it has probably crashed";
-
-      report_failure_and_restart($tinfo);
-    }
     elsif ( $res == 1 )
     {
       # Test case failure reported by mysqltest
@@ -3315,22 +3256,65 @@ sub run_testcase ($) {
     {
       # mysqltest failed, probably crashed
       $tinfo->{comment}=
-	"mysqltest returned unexpected code $res, it has probably crashed";
+	"mysqltest failed with unexpected return code $res";
       report_failure_and_restart($tinfo);
     }
 
-    do_after_run_mysqltest($tinfo);
+    # Save info from this testcase run to mysqltest.log
+    my $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
+    mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
+      if -f $path_current_test_log;
+    mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
+      if -f $path_timefile;
+
+    # Remove the file that mysqltest writes info to
+    unlink($path_timefile);
+
+    return;
 
   }
 
-  # ----------------------------------------------------------------------
-  # Stop Instance Manager if we are processing an IM-test case.
-  # ----------------------------------------------------------------------
-  if ( $tinfo->{'component_id'} eq 'im' and
-       !mtr_im_stop($instance_manager, $tinfo->{'name'}) )
+  # ----------------------------------------------------
+  # It's not mysqltest that has exited, kill it
+  # ----------------------------------------------------
+  $test->killit();
+  $test->wait();
+
+  # ----------------------------------------------------
+  # Check if it was a server that died
+  # ----------------------------------------------------
+  if ( grep($proc eq $_->{proc}, started_servers()) )
   {
-    mtr_error("Failed to stop Instance Manager.")
+    # Server failed, probably crashed
+    $tinfo->{comment}=
+      "Server failed during test run";
+
+    report_failure_and_restart($tinfo);
+    return;
   }
+
+  # ----------------------------------------------------
+  # Check if testcase timer expired
+  # ----------------------------------------------------
+  if ( $proc eq $test_timeout_proc )
+  {
+    mtr_report("Test case timeout!");
+    $tinfo->{'timeout'}= 1;           # Mark as timeout
+    report_failure_and_restart($tinfo);
+    return;
+  }
+
+  # ----------------------------------------------------
+  # Check if test suite timer expired
+  # ----------------------------------------------------
+  if ( $proc eq $suite_timeout_proc )
+  {
+    mtr_report("Test suite timeout! Terminating...");
+    exit(1);
+  }
+
+  mtr_error("Unhandled process $proc exited");
+
 }
 
 
Thread
bk commit into 5.0 tree (msvensson:1.2565)msvensson31 Oct