List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:October 7 2010 11:34am
Subject:bzr commit into mysql-5.5-mtr branch (bjorn.munch:3098) Bug#55968
View as plain text  
#At file:///home/bm136801/my/cleanvar-55/ based on revid:bjorn.munch@stripped

 3098 Bjorn Munch	2010-10-07
      Bug #55968 MTR does not clean up properly and chokes on its discharge
      Added --clean-vardir to empty vardir if no failures
      Also added variable $MTR_CLEAN_VARDIR

    modified:
      mysql-test/mysql-test-run.pl
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-09-30 10:53:36 +0000
+++ b/mysql-test/mysql-test-run.pl	2010-10-07 11:32:32 +0000
@@ -195,6 +195,7 @@ sub using_extern { return (keys %opts_ex
 our $opt_fast= 0;
 our $opt_force;
 our $opt_mem= $ENV{'MTR_MEM'};
+our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
 
 our $opt_gcov;
 our $opt_gcov_exe= "gcov";
@@ -476,6 +477,8 @@ sub main {
 
   mtr_report_stats("Completed", $completed);
 
+  remove_vardir_subs() if $opt_clean_vardir;
+
   exit(0);
 }
 
@@ -946,6 +949,7 @@ sub command_line_setup {
              'tmpdir=s'                 => \$opt_tmpdir,
              'vardir=s'                 => \$opt_vardir,
              'mem'                      => \$opt_mem,
+	     'clean-vardir'             => \$opt_clean_vardir,
              'client-bindir=s'          => \$path_client_bindir,
              'client-libdir=s'          => \$path_client_libdir,
 
@@ -2202,6 +2206,12 @@ sub environment_setup {
 }
 
 
+sub remove_vardir_subs() {
+  foreach my $sdir ( glob("$opt_vardir/*") ) {
+    mtr_verbose("Removing subdir $sdir");
+    rmtree($sdir);
+  }
+}
 
 #
 # Remove var and any directories in var/ created by previous
@@ -2246,11 +2256,7 @@ sub remove_stale_vardir () {
 	mtr_error("The destination for symlink $opt_vardir does not exist")
 	  if ! -d readlink($opt_vardir);
 
-	foreach my $bin ( glob("$opt_vardir/*") )
-	{
-	  mtr_verbose("Removing bin $bin");
-	  rmtree($bin);
-	}
+	remove_vardir_subs();
       }
     }
     else
@@ -5502,6 +5508,8 @@ Options to control directories to use
                         for tmpfs (/dev/shm)
                         The option can also be set using environment
                         variable MTR_MEM=[DIR]
+  clean-vardir          Clean vardir if tests were successful and if
+                        running in "memory". Otherwise this option is ignored
   client-bindir=PATH    Path to the directory where client binaries are located
   client-libdir=PATH    Path to the directory where client libraries are located
 


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20101007113232-weg8364djnvtzjqi.bundle
Thread
bzr commit into mysql-5.5-mtr branch (bjorn.munch:3098) Bug#55968Bjorn Munch7 Oct