MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:kent Date:August 17 2005 10:07pm
Subject:bk commit into 4.1 tree (kent:1.2386) BUG#11792
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of kent. When kent 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
  1.2386 05/08/18 00:07:17 kent@stripped +1 -0
  mtr_process.pl:
    Bug#11792: Create a shell like 'mysqltest' exit status

  mysql-test/lib/mtr_process.pl
    1.14 05/08/18 00:05:03 kent@stripped +20 -14
    Bug#11792: Create a shell like 'mysqltest' exit status

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kent
# Host:	dialup-d2i-62-65-90-69.home.se
# Root:	/Users/kent/mysql/bk/mysql-4.1-release-tmp

--- 1.13/mysql-test/lib/mtr_process.pl	2005-08-17 15:14:12 +02:00
+++ 1.14/mysql-test/lib/mtr_process.pl	2005-08-18 00:05:03 +02:00
@@ -185,10 +185,6 @@
 
   if ( $mode eq 'run' or $mode eq 'test' )
   {
-    my $exit_value= -1;
-#    my $signal_num=  0;
-#    my $dumped_core= 0;
-
     if ( $mode eq 'run' )
     {
       # Simple run of command, we wait for it to return
@@ -199,12 +195,7 @@
         mtr_error("$path ($pid) got lost somehow");
       }
 
-      $exit_value=  $?;
-#      $exit_value=  $? >> 8;
-#      $signal_num=  $? & 127;
-#      $dumped_core= $? & 128;
-
-      return $exit_value;
+      return mtr_process_exit_status($?);
     }
     else
     {
@@ -218,6 +209,7 @@
       # FIXME is this as it should be? Can't mysqld terminate
       # normally from running a test case?
 
+      my $exit_value= -1;
       my $ret_pid;                      # What waitpid() returns
 
       while ( ($ret_pid= waitpid(-1,0)) != -1 )
@@ -230,10 +222,7 @@
         if ( $ret_pid == $pid )
         {
           # We got termination of mysqltest, we are done
-          $exit_value=  $?;
-#          $exit_value=  $? >> 8;
-#          $signal_num=  $? & 127;
-#          $dumped_core= $? & 128;
+          $exit_value= mtr_process_exit_status($?);
           last;
         }
 
@@ -291,6 +280,23 @@
   }
 }
 
+
+# ----------------------------------------------------------------------
+# We try to emulate how an Unix shell calculates the exit code
+# ----------------------------------------------------------------------
+
+sub mtr_process_exit_status {
+  my $raw_status= shift;
+
+  if ( $raw_status & 127 )
+  {
+    return ($raw_status & 127) + 128;  # Signal num + 128
+  }
+  else
+  {
+    return $raw_status >> 8;           # Exit code
+  }
+}
 
 
 ##############################################################################
Thread
bk commit into 4.1 tree (kent:1.2386) BUG#11792kent18 Aug