MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:March 5 2009 10:52am
Subject:bzr commit into mysql-6.0-backup branch (ingo.struewing:2784)
View as plain text  
#At file:///home2/mydev/bzrroot/mysql-6.0-lcov/ based on revid:hema@stripped

 2784 Ingo Struewing	2009-03-05
      LCOV script
      
      This script runs a lcov analysis on a tree that has been built
      for coverage testing. It generates an HTML report.
      
      For more information run mysql-test/mysql-test-lcov.pl --help
     @ .bzrignore
        LCOV script
        Added result directory
     @ mysql-test/mysql-test-lcov.pl
        LCOV script
        New script to run the lcov analysis.

    added:
      mysql-test/mysql-test-lcov.pl
    modified:
      .bzrignore
=== modified file '.bzrignore'
--- a/.bzrignore	2009-02-26 13:07:12 +0000
+++ b/.bzrignore	2009-03-05 10:52:41 +0000
@@ -2017,3 +2017,4 @@ libmysqld/sql_join_cache.cc
 storage/maria/maria_non_trans_log
 libmysqld/examples/mysqltest.cc
 libmysqld/bml.cc
+mysql-test/mysql-test-lcov

=== added file 'mysql-test/mysql-test-lcov.pl'
--- a/mysql-test/mysql-test-lcov.pl	1970-01-01 00:00:00 +0000
+++ b/mysql-test/mysql-test-lcov.pl	2009-03-05 10:52:41 +0000
@@ -0,0 +1,151 @@
+#! /usr/bin/perl
+
+# Copyright (C) 2008 Sun Microsystems, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+#
+# Run lcov and genhtml to create a test coverage report.
+#
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+#
+# Constants.
+#
+my $RESULT_DIR= "mysql-test/mysql-test-lcov";
+
+#
+# Get command line options.
+#
+my $opt_quiet;
+my $opt_help;
+my $opt_purge;
+my $result= GetOptions
+  (
+   "quiet"       => \$opt_quiet,
+   "help"        => \$opt_help,
+   "purge"       => \$opt_purge,
+  );
+
+usage() if $opt_help;
+
+#
+# Global variables.
+#
+my $cmd;
+my $res;
+
+#
+# In verbose mode we output to STDERR as well as to STDOUT.
+# Avoid misplaced output due to buffering.
+#
+if (!$opt_quiet)
+{
+  select STDERR; $| = 1;      # make unbuffered
+  select STDOUT; $| = 1;      # make unbuffered
+}
+
+#
+# We need to change to the root directory of the source tree
+# so that we find all sources, object files, and gcov files from ".".
+#
+my $troot= `bzr root`;
+chomp $troot;
+if (!$troot || !chdir $troot)
+{
+  die "Failed to find tree root. " .
+      "(this tool must be run within a bzr work tree).\n";
+}
+
+#
+# Purge counters from old test runs.
+#
+if($opt_purge)
+{
+  $cmd= "find . -name '*.da' -o -name '*.gcda' -o -name '*.gcov' |
+         grep -v 'README\.gcov' |
+         xargs rm";
+  print STDERR "Running: $cmd\n" if !$opt_quiet;
+  $res= system($cmd);
+  exit($res ? ($? >> 8) : 0);
+}
+
+#
+# Check result directory.
+#
+if (!-d $RESULT_DIR)
+{
+  print STDERR "Creating result directory: $RESULT_DIR\n" if !$opt_quiet;
+  $res= system("mkdir $RESULT_DIR");
+  if ($res)
+  {
+    exit($res ? ($? >> 8) : 0);
+  }
+}
+
+#
+# LCOV
+#
+$cmd= "lcov -q -d . -c -o $RESULT_DIR/lcov.info";
+print STDERR "Running: $cmd\n" if !$opt_quiet;
+$res= system($cmd);
+if ($res)
+{
+  exit($res ? ($? >> 8) : 0);
+}
+
+#
+# GENHTML
+#
+$cmd= "genhtml -q --prefix=`pwd` -o $RESULT_DIR " .
+               "$RESULT_DIR/lcov.info";
+print STDERR "Running: $cmd\n" if !$opt_quiet;
+$res= system($cmd);
+if ($res)
+{
+  exit($res ? ($? >> 8) : 0);
+}
+print "Result is in $RESULT_DIR/index.html\n";
+
+#
+# Usage.
+#
+sub usage
+{
+  print <<"END";
+Usage: $0 [options]
+
+This program runs lcov for code coverage analysis, and genhtml to create
+an HTML report in $RESULT_DIR/index.html.
+
+Options:
+
+  -h    --help        This help.
+  -q    --quiet       Do not show commands run.
+  -p    --purge       Delete all test coverage information, to prepare for a
+                      new coverage test.
+
+Prior to running this tool, MySQL should be compiled with
+BUILD/compile-pentium-gcov, and the testsuite should be run.
+
+Also you need to install the lcov package, which contains the
+utilities lcov and genhtml.
+END
+
+  exit 1;
+}
+


Attachment: [text/bzr-bundle] bzr/ingo.struewing@sun.com-20090305105241-9m1f2wt5ul76mlnr.bundle
Thread
bzr commit into mysql-6.0-backup branch (ingo.struewing:2784)Ingo Struewing5 Mar