MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:February 27 2009 11:20am
Subject:bzr commit into mysql-5.1-bugteam branch (ingo.struewing:2827)
Bug#40446
View as plain text  
#At file:///home2/mydev/bzrroot/mysql-5.1-bug40446-1/ based on revid:bernt.johnsen@stripped

 2827 Ingo Struewing	2009-02-27
      Bug#40446 - mysql-test-run --gcov is broken
      
      Some variable values were missing and perl constructs failed.
      
      Initialized the variables and refactored the gcov functions.
     @ .bzrignore
        Bug#40446 - mysql-test-run --gcov is broken
        Added gcov log files.
     @ mysql-test/lib/mtr_gcov.pl
        Bug#40446 - mysql-test-run --gcov is broken
        Refactored the gcov functions.
     @ mysql-test/mysql-test-run.pl
        Bug#40446 - mysql-test-run --gcov is broken
        Initialized gcov variables.
        Added usage information.

    modified:
      .bzrignore
      mysql-test/lib/mtr_gcov.pl
      mysql-test/mysql-test-run.pl
=== modified file '.bzrignore'
--- a/.bzrignore	2008-12-13 19:42:12 +0000
+++ b/.bzrignore	2009-02-27 11:20:53 +0000
@@ -1295,6 +1295,8 @@ mysql-test/linux_sys_vars.inc
 mysql-test/load_sysvars.inc
 mysql-test/mtr
 mysql-test/mysql-test-run
+mysql-test/mysql-test-gcov.err
+mysql-test/mysql-test-gcov.msg
 mysql-test/mysql-test-run-shell
 mysql-test/mysql-test-run.log
 mysql-test/mysql_test_run_new

=== modified file 'mysql-test/lib/mtr_gcov.pl'
--- a/mysql-test/lib/mtr_gcov.pl	2008-09-05 12:06:22 +0000
+++ b/mysql-test/lib/mtr_gcov.pl	2009-02-27 11:20:53 +0000
@@ -22,40 +22,46 @@ use strict;
 
 sub gcov_prepare ($) {
   my ($dir)= @_;
+  print "Purging gcov information from '$dir'...\n";
 
-  `find $dir -name \*.gcov \
-    -or -name \*.da | xargs rm`;
+  system("find $dir -name \*.gcov -o -name \*.da"
+             . " -o -name \*.gcda | grep -v 'README.gcov\$' | xargs rm");
 }
 
-my @mysqld_src_dirs=
-  (
-   "strings",
-   "mysys",
-   "include",
-   "extra",
-   "regex",
-   "isam",
-   "merge",
-   "myisam",
-   "myisammrg",
-   "heap",
-   "sql",
-  );
-
+#
+# Collect gcov statistics.
+# Arguments:
+#   $dir       basedir, normally source directory
+#   $gcov      gcov utility program [path] name
+#   $gcov_msg  message file name
+#   $gcov_err  error file name
+#
 sub gcov_collect ($$$) {
   my ($dir, $gcov, $gcov_msg, $gcov_err)= @_;
 
+  # Get current directory to return to later.
   my $start_dir= cwd();
 
-  print "Collecting source coverage info...\n";
-  -f $gcov_msg and unlink($gcov_msg);
-  -f $gcov_err and unlink($gcov_err);
-  foreach my $d ( @mysqld_src_dirs )
-  {
-    chdir("$dir/$d");
-    foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
-    {
-      `$gcov $f 2>>$gcov_err  >>$gcov_msg`;
+  print "Collecting source coverage info using '$gcov'...\n";
+  -f "$start_dir/$gcov_msg" and unlink("$start_dir/$gcov_msg");
+  -f "$start_dir/$gcov_err" and unlink("$start_dir/$gcov_err");
+
+  my @dirs= `find "$dir" -type d -print | sort`;
+  #print "List of directories:\n@dirs\n";
+
+  foreach my $d ( @dirs ) {
+    my $dir_reported= 0;
+    chomp($d);
+    chdir($d) or next;
+
+    foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) {
+      $f =~ /(.*)\.[ch]c?/;
+      -f "$1.gcno" or next;
+      if (!$dir_reported) {
+	print "Collecting in '$d'...\n";
+	$dir_reported= 1;
+      }
+      system("$gcov $f 2>>$start_dir/$gcov_err >>$start_dir/$gcov_msg");
     }
     chdir($start_dir);
   }

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-02-13 15:27:33 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-02-27 11:20:53 +0000
@@ -163,8 +163,9 @@ our $opt_force;
 our $opt_mem= $ENV{'MTR_MEM'};
 
 our $opt_gcov;
-our $opt_gcov_err;
-our $opt_gcov_msg;
+our $opt_gcov_exe= "gcov";
+our $opt_gcov_err= "mysql-test-gcov.msg";
+our $opt_gcov_msg= "mysql-test-gcov.err";
 
 our $glob_debugger= 0;
 our $opt_gdb;
@@ -396,7 +397,7 @@ sub main {
   mtr_print_line();
 
   if ( $opt_gcov ) {
-    gcov_collect($basedir, $opt_gcov,
+    gcov_collect($basedir, $opt_gcov_exe,
 		 $opt_gcov_msg, $opt_gcov_err);
   }
 
@@ -5057,6 +5058,8 @@ Misc options
                         to turn off.
 
   sleep=SECONDS         Passed to mysqltest, will be used as fixed sleep time
+  gcov                  Collect coverage information after the test.
+                        The result is a gcov file per source and header file.
 
 HERE
   exit(1);


Attachment: [text/bzr-bundle] bzr/ingo.struewing@sun.com-20090227112053-qgrwxf8zulkgq5eg.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (ingo.struewing:2827)Bug#40446Ingo Struewing27 Feb