List:Commits« Previous MessageNext Message »
From:kent Date:March 8 2006 6:16pm
Subject:bk commit into 4.1 tree (kent:1.2465) BUG#12433
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.2465 06/03/08 19:15:56 kent@stripped +3 -0
  mysql-test-run.pl, mtr_cases.pl
    - Back porting of some changes in later releases
    - Corrected valgrind support
    - Removed work around for TZ needed in VisualStudio 6
    - Don't restart master to add special settings from "<testcase>-master.opt",
      if same settngs as running master, feature request in bug#12433
    - With --reorder, keep tests with same *-master.opt content together,
      to save even more master restarts

  mysql-test/mysql-test-run.pl
    1.59 06/03/08 18:31:00 kent@stripped +25 -13
    Handle pseudo option --timezone=<spec> that sets TZ

  mysql-test/lib/mtr_cases.pl
    1.10 06/03/08 11:34:22 kent@stripped +2 -3
    Removed special code for Windows as in VC6 we unset
    TZ to avoid library bug

  mysql-test/lib/mtr_cases.pl
    1.9 06/03/08 11:29:17 kent@stripped +15 -2
    With --reorder, keep tests with same *-master.opt content together

  mysql-test/lib/mtr_misc.pl
    1.6 06/03/08 11:28:23 kent@stripped +42 -0
    Added functions to compare lists of options

  mysql-test/mysql-test-run.pl
    1.58 06/03/08 04:07:20 kent@stripped +54 -12
    Back porting of changes in later releases

  mysql-test/mysql-test-run.pl
    1.57 06/03/08 04:04:11 kent@stripped +16 -5
    Don't restart master if no <testcase>.sh and next <testcase>-master.opt is the same as previous one, bug#12433

  mysql-test/mysql-test-run.pl
    1.56 06/03/08 04:00:51 kent@stripped +31 -7
    Corrected valgrind support

# 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:	c-4c4072d5.010-2112-6f72651.cust.bredbandsbolaget.se
# Root:	/Users/kent/mysql/bk/mysql-4.1-new

--- 1.8/mysql-test/lib/mtr_cases.pl	2005-08-16 23:08:40 +02:00
+++ 1.10/mysql-test/lib/mtr_cases.pl	2006-03-08 11:34:22 +01:00
@@ -85,11 +85,24 @@
   if ( $::opt_reorder )
   {
     @$cases = sort {
-      if ( $a->{'master_restart'} and $b->{'master_restart'} or
-           ! $a->{'master_restart'} and ! $b->{'master_restart'} )
+      if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
       {
         return $a->{'name'} cmp $b->{'name'};
       }
+
+      if ( $a->{'master_restart'} and $b->{'master_restart'} )
+      {
+        my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
+        if ( $cmp == 0 )
+        {
+          return $a->{'name'} cmp $b->{'name'};
+        }
+        else
+        {
+          return $cmp;
+        }
+      }
+
       if ( $a->{'master_restart'} )
       {
         return 1;                 # Is greater
@@ -189,8 +202,8 @@
   my $slave_sh=        "$testdir/$tname-slave.sh";
   my $disabled_file=   "$testdir/$tname.disabled";
 
-  $tinfo->{'master_opt'}= $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
-  $tinfo->{'slave_opt'}=  $::glob_win32 ? ["--default-time-zone=+3:00"] : [];
+  $tinfo->{'master_opt'}= [];
+  $tinfo->{'slave_opt'}=  [];
   $tinfo->{'slave_mi'}=   [];
 
   if ( -f $master_opt_file )
@@ -213,7 +226,6 @@
         if ( defined $value )
         {
           $tinfo->{'timezone'}= $value;
-          $tinfo->{'skip'}= 1 if $::glob_win32; # FIXME server unsets TZ
           last MASTER_OPT;
         }
 

--- 1.5/mysql-test/lib/mtr_misc.pl	2005-08-17 14:39:47 +02:00
+++ 1.6/mysql-test/lib/mtr_misc.pl	2006-03-08 11:28:23 +01:00
@@ -13,6 +13,9 @@
 sub mtr_path_exists(@);
 sub mtr_script_exists(@);
 sub mtr_exe_exists(@);
+sub mtr_copy_dir($$);
+sub mtr_same_opts($$);
+sub mtr_cmp_opts($$);
 
 ##############################################################################
 #
@@ -108,5 +111,44 @@
   }
 }
 
+sub mtr_copy_dir($$) {
+  my $srcdir= shift;
+  my $dstdir= shift;
+
+  # Create destination directory
+  mkpath($dstdir);
+  find(\&mtr_copy_one_file, $dstdir);
+}
+
+sub mtr_copy_one_file {
+  print $File::Find::name, "\n";
+}
+
+sub mtr_same_opts ($$) {
+  my $l1= shift;
+  my $l2= shift;
+  return mtr_cmp_opts($l1,$l2) == 0;
+}
+
+sub mtr_cmp_opts ($$) {
+  my $l1= shift;
+  my $l2= shift;
+
+  my @l1= @$l1;
+  my @l2= @$l2;
+
+  return -1 if @l1 < @l2;
+  return  1 if @l1 > @l2;
+
+  while ( @l1 )                         # Same length
+  {
+    my $e1= shift @l1;
+    my $e2= shift @l2;
+    my $cmp= ($e1 cmp $e2);
+    return $cmp if $cmp != 0;
+  }
+
+  return 0;                             # They are the same
+}
 
 1;

--- 1.55/mysql-test/mysql-test-run.pl	2006-03-08 03:51:46 +01:00
+++ 1.59/mysql-test/mysql-test-run.pl	2006-03-08 18:31:00 +01:00
@@ -76,6 +76,7 @@
 #require 5.6.1;
 use File::Path;
 use File::Basename;
+use File::Copy;
 use Cwd;
 use Getopt::Long;
 use Sys::Hostname;
@@ -152,6 +153,7 @@
 our $path_timefile;
 our $path_manager_log;           # Used by mysqldadmin
 our $path_slave_load_tmpdir;     # What is this?!
+our $path_mysqltest_log;
 our $path_my_basedir;
 our $opt_vardir;                 # A path but set directly on cmd line
 our $opt_tmpdir;                 # A path but set directly on cmd line
@@ -239,7 +241,7 @@
 our $opt_sleep_time_for_delete=    10;
 our $opt_testcase_timeout;
 our $opt_suite_timeout;
-my  $default_testcase_timeout=     10; # 10 min max
+my  $default_testcase_timeout=     15; # 15 min max
 my  $default_suite_timeout=       120; # 2 hours max
 
 our $opt_socket;
@@ -258,6 +260,7 @@
 our $opt_user_test;
 
 our $opt_valgrind;
+our $opt_valgrind_mysqld;
 our $opt_valgrind_mysqltest;
 our $opt_valgrind_all;
 our $opt_valgrind_options;
@@ -476,8 +479,9 @@
   #
   if ( $ENV{'MTR_BUILD_THREAD'} )
   {
-    $opt_master_myport=   $ENV{'MTR_BUILD_THREAD'} * 10 + 10000;
-    $opt_slave_myport=    $opt_master_myport + 2; # and 3 4
+    # Up to two masters, up to three slaves
+    $opt_master_myport=   $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
+    $opt_slave_myport=    $opt_master_myport + 2;  # and 3 4
     $opt_ndbcluster_port= $opt_master_myport + 5;
   }
 
@@ -619,6 +623,7 @@
   # --------------------------------------------------------------------------
 
   $opt_tmpdir=       "$opt_vardir/tmp" unless $opt_tmpdir;
+  $opt_tmpdir =~ s,/+$,,;       # Remove ending slash if any
   # FIXME maybe not needed?
   $path_manager_log= "$opt_vardir/log/manager.log"
     unless $path_manager_log;
@@ -735,6 +740,7 @@
   #   "somestring" option is name/path of valgrind executable
 
   # Take executable path from any of them, if any
+  $opt_valgrind_mysqld= $opt_valgrind;
   $opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
   $opt_valgrind= $opt_valgrind_all       if $opt_valgrind_all;
 
@@ -844,6 +850,7 @@
   }
 
   $path_timefile=  "$opt_vardir/log/mysqltest-time";
+  $path_mysqltest_log=  "$opt_vardir/log/mysqltest.log";
 }
 
 
@@ -863,7 +870,8 @@
                                            "$glob_basedir/bin");
       $exe_mysqld=         mtr_exe_exists ("$path_client_bindir/mysqld-nt",
                                            "$path_client_bindir/mysqld",
-                                           "$path_client_bindir/mysqld-debug",);
+                                           "$path_client_bindir/mysqld-debug",
+                                           "$path_client_bindir/mysqld-max");
       $path_language=      mtr_path_exists("$glob_basedir/share/english/");
       $path_charsetsdir=   mtr_path_exists("$glob_basedir/share/charsets");
     }
@@ -885,7 +893,19 @@
     }
     else
     {
-      $exe_mysqltest=  mtr_exe_exists("$path_client_bindir/mysqltest");
+      if ( $opt_valgrind_mysqltest )
+      {
+        # client/mysqltest might be a libtool .sh script, so look for real exe
+        # to avoid valgrinding bash ;)
+        $exe_mysqltest=
+  	  mtr_exe_exists("$path_client_bindir/.libs/lt-mysqltest",
+		         "$path_client_bindir/.libs/mysqltest",
+		         "$path_client_bindir/mysqltest");
+      }
+      else
+      {
+        $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
+      }
       $exe_mysql_client_test=
         mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
 		       "/usr/bin/false");
@@ -995,6 +1015,7 @@
   $ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
   $ENV{'MYSQL_TEST_DIR'}=     $glob_mysql_test_dir;
   $ENV{'MYSQL_TEST_WINDIR'}=  $glob_mysql_test_dir;
+  $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
   $ENV{'MASTER_WINMYSOCK'}=   $master->[0]->{'path_mysock'};
   $ENV{'MASTER_MYSOCK'}=      $master->[0]->{'path_mysock'};
   $ENV{'MASTER_MYSOCK1'}=     $master->[1]->{'path_mysock'};
@@ -1006,6 +1027,8 @@
 # $ENV{'MYSQL_TCP_PORT'}=     '@MYSQL_TCP_PORT@'; # FIXME
   $ENV{'MYSQL_TCP_PORT'}=     3306;
 
+  $ENV{'NDBCLUSTER_PORT'}=    $opt_ndbcluster_port;
+
   if ( $glob_cygwin_perl )
   {
     foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
@@ -1025,7 +1048,7 @@
   print "Using SLAVE_MYPORT     = $ENV{SLAVE_MYPORT}\n";
   print "Using SLAVE_MYPORT1    = $ENV{SLAVE_MYPORT1}\n";
   print "Using SLAVE_MYPORT2    = $ENV{SLAVE_MYPORT2}\n";
-  print "Using NDBCLUSTER_PORT  = $opt_ndbcluster_port\n";
+  print "Using NDBCLUSTER_PORT  = $ENV{NDBCLUSTER_PORT}\n";
 }
 
 
@@ -1087,10 +1110,40 @@
 
   mtr_report("Removing Stale Files");
 
-  rmtree("$opt_vardir/log");
-  rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
-  rmtree("$opt_vardir/run");
-  rmtree("$opt_vardir/tmp");
+  if ( $opt_vardir eq "$glob_mysql_test_dir/var" )
+  {
+    #
+    # Running with "var" in mysql-test dir
+    #
+    if ( -l "$glob_mysql_test_dir/var" )
+    {
+      # Some users creates a soft link in mysql-test/var to another area
+      # - allow it
+      mtr_report("WARNING: Using the 'mysql-test/var' symlink");
+      rmtree("$opt_vardir/log");
+      rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
+      rmtree("$opt_vardir/run");
+      rmtree("$opt_vardir/tmp");
+    }
+    else
+    {
+      # Remove the entire "var" dir
+      rmtree("$opt_vardir/");
+    }
+  }
+  else
+  {
+    #
+    # Running with "var" in some other place
+    #
+
+    # Remove the var/ dir in mysql-test dir if any
+    # this could be an old symlink that shouldn't be there
+    rmtree("$glob_mysql_test_dir/var");
+
+    # Remove the "var" dir
+    rmtree("$opt_vardir/");
+  }
 
   mkpath("$opt_vardir/log");
   mkpath("$opt_vardir/run");
@@ -1114,14 +1167,22 @@
     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
-
-  if ( ! $glob_win32 and $opt_vardir ne "$glob_mysql_test_dir/var" )
+  # Make a link std_data_ln in var/ that points to std_data
+  if ( ! $glob_win32 )
   {
-    # FIXME why bother with the above, why not always remove all of var?!
-    rmtree("$glob_mysql_test_dir/var"); # Clean old var, FIXME or rename it?!
-    symlink($opt_vardir, "$glob_mysql_test_dir/var");
+    symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
+  }
+  else
+  {
+    # on windows, copy all files from std_data into var/std_data_ln
+    mkpath("$opt_vardir/std_data_ln");
+    opendir(DIR, "$glob_mysql_test_dir/std_data")
+      or mtr_error("Can't find the std_data directory: $!");
+    for my $elem ( readdir(DIR) ) {
+      next if -d "$glob_mysql_test_dir/std_data/$elem";
+      copy("$glob_mysql_test_dir/std_data/$elem", "$opt_vardir/std_data_ln/$elem");
+    }
+    closedir(DIR);
   }
 }
 
@@ -1480,11 +1541,33 @@
 
   if ( ! $glob_use_running_server and ! $glob_use_embedded_server )
   {
-    if ( $tinfo->{'master_restart'} or
-         $master->[0]->{'running_master_is_special'} )
+    # We try to find out if we are to restart the server
+    my $do_restart= 0;          # Assumes we don't have to
+
+    if ( $tinfo->{'master_sh'} )
+    {
+      $do_restart= 1;           # Always restart if script to run
+    }
+    elsif ( $master->[0]->{'running_master_is_special'} and
+            $master->[0]->{'running_master_is_special'}->{'timezone'} eq
+            $tinfo->{'timezone'} and
+            mtr_same_opts($master->[0]->{'running_master_is_special'}->{'master_opt'},
+                          $tinfo->{'master_opt'}) )
+    {
+      # If running master was started with special settings, but
+      # the current test requuires the same ones, we *don't* restart.
+      $do_restart= 0;
+    }
+    elsif ( $tinfo->{'master_restart'} or
+            $master->[0]->{'running_master_is_special'} )
+    {
+      $do_restart= 1;
+    }
+
+    if ( $do_restart )
     {
       stop_masters();
-      $master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped
+      delete $master->[0]->{'running_master_is_special'}; # Forget history
     }
 
     # ----------------------------------------------------------------------
@@ -1553,6 +1636,7 @@
       }
       if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} )
       {
+	# Test needs cluster, start an extra mysqld connected to cluster
         $master->[1]->{'pid'}=
           mysqld_start('master',1,$tinfo->{'master_opt'},[]);
         if ( ! $master->[1]->{'pid'} )
@@ -1564,7 +1648,8 @@
 
       if ( $tinfo->{'master_restart'} )
       {
-        $master->[0]->{'running_master_is_special'}= 1;
+        # Save this test case information, so next can examine it
+        $master->[0]->{'running_master_is_special'}= $tinfo;
       }
     }
 
@@ -1797,7 +1882,7 @@
   mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
   mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
 
-  if ( defined $opt_valgrind )
+  if ( defined $opt_valgrind_mysqld )
   {
     mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
     mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -1864,6 +1949,10 @@
     mtr_add_arg($args, "%s--skip-innodb", $prefix);
     mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
     mtr_add_arg($args, "%s--skip-slave-start", $prefix);
+
+    # Directory where slaves find the dumps generated by "load data"
+    # on the server. The path need to have constant length otherwise
+    # test results will vary, thus a relative path is used.
     mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
                 $path_slave_load_tmpdir);
     mtr_add_arg($args, "%s--socket=%s", $prefix,
@@ -2022,7 +2111,7 @@
 
   mtr_init_args(\$args);
 
-  if ( defined $opt_valgrind )
+  if ( defined $opt_valgrind_mysqld )
   {
     valgrind_arguments($args, \$exe);
   }
Thread
bk commit into 4.1 tree (kent:1.2465) BUG#12433kent8 Mar