List:Internals« Previous MessageNext Message »
From:Kent Boortz Date:September 16 2005 11:09pm
Subject:bk commit into 4.1 tree (kent:1.2443) BUG#13280
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of kboortz. When kboortz 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.2443 05/09/17 01:09:32 kent@stripped +1 -0
  mysql-test-run.pl:
    Enabled --valgrind to work (bug#13280)

  mysql-test/mysql-test-run.pl
    1.42 05/09/17 00:49:34 kent@stripped +73 -49
    Enabled --valgrind to work (bug#13280)

# 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:	build.mysql.com
# Root:	/users/kboortz/daily/work/mysql-4.1

--- 1.41/mysql-test/mysql-test-run.pl	Thu Sep  1 17:19:14 2005
+++ 1.42/mysql-test/mysql-test-run.pl	Sat Sep 17 00:49:34 2005
@@ -237,8 +237,10 @@
 
 our $opt_sleep_time_after_restart=  1;
 our $opt_sleep_time_for_delete=    10;
-our $opt_testcase_timeout=          5; # 5 min max
-our $opt_suite_timeout=           120; # 2 hours max
+our $opt_testcase_timeout;
+our $opt_suite_timeout;
+my  $default_testcase_timeout=     10; # 10 min max
+my  $default_suite_timeout=       120; # 2 hours max
 
 our $opt_socket;
 
@@ -509,8 +511,8 @@
              # Coverage, profiling etc
              'gcov'                     => \$opt_gcov,
              'gprof'                    => \$opt_gprof,
-             'valgrind'                 => \$opt_valgrind,
-             'valgrind-all'             => \$opt_valgrind_all,
+             'valgrind:s'               => \$opt_valgrind,
+             'valgrind-all:s'           => \$opt_valgrind_all,
              'valgrind-options=s'       => \$opt_valgrind_options,
 
              # Misc
@@ -688,29 +690,36 @@
     $opt_with_ndbcluster= 0;
   }
 
-  # FIXME
+  # The ":s" in the argument spec, means we have three different cases
+  #
+  #   undefined    option not set
+  #   ""           option set with no argument
+  #   "somestring" option is name/path of valgrind executable
+
+  if ( defined $opt_valgrind_all and ! $opt_valgrind )
+  {
+    $opt_valgrind= $opt_valgrind_all;
+  }
+
+  if ( ! $opt_testcase_timeout )
+  {
+    $opt_testcase_timeout= $default_testcase_timeout;
+    $opt_testcase_timeout*= 10 if defined $opt_valgrind;
+  }
+
+  if ( ! $opt_suite_timeout )
+  {
+    $opt_suite_timeout= $default_suite_timeout;
+    $opt_suite_timeout*= 4 if defined $opt_valgrind;
+  }
 
-  #if ( $opt_valgrind or $opt_valgrind_all )
-  #{
-    # VALGRIND=`which valgrind` # this will print an error if not found FIXME
-    # Give good warning to the user and stop
-  #  if ( ! $VALGRIND )
-  #  {
-  #    print "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org.\n"
-  #    exit 1
-  #  }
+  if ( defined $opt_valgrind )
+  {
+    $opt_sleep_time_after_restart= 10;
+    $opt_sleep_time_for_delete= 60;
     # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
-  #  valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
-  #  VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16"
-  #  $opt_extra_mysqld_opt.= " --skip-safemalloc --skip-bdb";
-  #  SLEEP_TIME_AFTER_RESTART=10
-  #  $opt_sleep_time_for_delete=  60
-  #  $glob_use_running_server= ""
-  #  if ( "$1"=  "--valgrind-all" )
-  #  {
-  #    VALGRIND="$VALGRIND -v --show-reachable=yes"
-  #  }
-  #}
+    #  valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
+  }
 
   if ( ! $opt_user )
   {
@@ -1703,7 +1712,7 @@
   mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
   mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
 
-  if ( $opt_valgrind )
+  if ( defined $opt_valgrind )
   {
     mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
     mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -1928,29 +1937,9 @@
 
   mtr_init_args(\$args);
 
-  if ( $opt_valgrind )
+  if ( defined $opt_valgrind )
   {
-
-    mtr_add_arg($args, "--tool=memcheck");
-    mtr_add_arg($args, "--alignment=8");
-    mtr_add_arg($args, "--leak-check=yes");
-    mtr_add_arg($args, "--num-callers=16");
-
-    if ( $opt_valgrind_all )
-    {
-      mtr_add_arg($args, "-v");
-      mtr_add_arg($args, "--show-reachable=yes");
-    }
-
-    if ( $opt_valgrind_options )
-    {
-      # FIXME split earlier and put into @glob_valgrind_*
-      mtr_add_arg($args, split(' ', $opt_valgrind_options));
-    }
-
-    mtr_add_arg($args, $exe);
-
-    $exe=  $opt_valgrind;
+    valgrind_arguments($args, \$exe);
   }
 
   mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info);
@@ -2121,6 +2110,11 @@
 
   mtr_init_args(\$args);
 
+  if ( defined $opt_valgrind )
+  {
+    valgrind_arguments($args, \$exe);
+  }
+
   mtr_add_arg($args, "--no-defaults");
   mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
   mtr_add_arg($args, "--database=test");
@@ -2205,6 +2199,34 @@
   return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
 }
 
+
+sub valgrind_arguments {
+  my $args= shift;
+  my $exe=  shift;
+
+  mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
+  mtr_add_arg($args, "--alignment=8");
+  mtr_add_arg($args, "--leak-check=yes");
+  mtr_add_arg($args, "--num-callers=16");
+
+  if ( defined $opt_valgrind_all )
+  {
+    mtr_add_arg($args, "-v");
+    mtr_add_arg($args, "--show-reachable=yes");
+  }
+
+  if ( $opt_valgrind_options )
+  {
+    # FIXME split earlier and put into @glob_valgrind_*
+    mtr_add_arg($args, split(' ', $opt_valgrind_options));
+  }
+
+  mtr_add_arg($args, $$exe);
+
+  $$exe= $opt_valgrind || "valgrind";
+}
+
+
 ##############################################################################
 #
 #  Usage
@@ -2271,7 +2293,9 @@
 
   gcov                  FIXME
   gprof                 FIXME
-  valgrind              FIXME
+  valgrind[=exe]        Run the "mysqltest" executable as well as the "mysqld"
+                        server using valgrind, optionally specifying the
+                        executable path/name
   valgrind-all          FIXME
   valgrind-options=ARGS Extra options to give valgrind
 
Thread
bk commit into 4.1 tree (kent:1.2443) BUG#13280Kent Boortz17 Sep