Commit 53ae72e2 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Monty

mtr uses dgcov for --gcov option

parent 00f462cf
# -*- cperl -*-
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
#
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
our $basedir;
sub gcov_prepare ($) {
my ($dir)= @_;
print "Purging gcov information from '$dir'...\n";
system("find $dir -name \*.gcov -o -name \*.da"
. " -o -name \*.gcda | xargs rm");
}
#
# Collect gcov statistics.
# Arguments:
# $dir basedir, normally build 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 using '$gcov'...$basedir\n";
-f "$dir/$gcov_msg" and unlink("$dir/$gcov_msg");
-f "$dir/$gcov_err" and unlink("$dir/$gcov_err");
my @dirs= `find "$dir" -type d -print | sort`;
#print "List of directories:\n@dirs\n";
foreach my $d ( @dirs ) {
chomp($d);
chdir($d) or next;
my @flist= glob("*.*.gcno");
print ("Collecting in '$d'...\n") if @flist;
foreach my $f (@flist) {
system("$gcov $f 2>>$dir/$gcov_err >>$dir/$gcov_msg");
system("perl", "$basedir/mysql-test/lib/process-purecov-annotations.pl", "$f.gcov");
}
chdir($start_dir);
}
print "gcov info in $dir/$gcov_msg, errors in $dir/$gcov_err\n";
}
1;
......@@ -104,7 +104,6 @@ use IO::Select;
require "mtr_process.pl";
require "mtr_io.pl";
require "mtr_gcov.pl";
require "mtr_gprof.pl";
require "mtr_misc.pl";
......@@ -248,11 +247,6 @@ our $opt_mem= $ENV{'MTR_MEM'};
our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
our $opt_gcov;
our $opt_gcov_src_dir=".";
our $opt_gcov_exe= "gcov";
our $opt_gcov_err= "mysql-test-gcov.err";
our $opt_gcov_msg= "mysql-test-gcov.msg";
our $opt_gprof;
our %gprof_dirs;
......@@ -383,11 +377,6 @@ sub main {
# --help will not reach here, so now it's safe to assume we have binaries
My::SafeProcess::find_bin();
if ( $opt_gcov ) {
gcov_prepare($basedir . "/" . $opt_gcov_src_dir);
}
print "vardir: $opt_vardir\n";
initialize_servers();
init_timers();
......@@ -431,6 +420,10 @@ sub main {
exit 0;
}
if ($opt_gcov) {
system './dgcov.pl --purge';
}
#######################################################################
my $num_tests= @$tests;
if ( $opt_parallel eq "auto" ) {
......@@ -555,15 +548,15 @@ sub main {
mtr_print_line();
if ( $opt_gcov ) {
gcov_collect($basedir . "/" . $opt_gcov_src_dir, $opt_gcov_exe,
$opt_gcov_msg, $opt_gcov_err);
}
print_total_times($opt_parallel) if $opt_report_times;
mtr_report_stats($prefix, $fail, $completed, $extra_warnings);
if ($opt_gcov) {
mtr_report("Running dgcov");
system "./dgcov.pl --generate > $opt_vardir/last_changes.dgcov";
}
if ( @$completed != $num_tests)
{
mtr_error("Not all tests completed (only ". scalar(@$completed) .
......@@ -1148,7 +1141,6 @@ sub command_line_setup {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gcov-src-dir=s' => \$opt_gcov_src_dir,
'gprof' => \$opt_gprof,
'valgrind|valgrind-all' => \$opt_valgrind,
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
......@@ -6180,9 +6172,6 @@ Misc options
actions. Disable facility with NUM=0.
gcov Collect coverage information after the test.
The result is a gcov file per source and header file.
gcov-src-dir=subdir Collect coverage only within the given subdirectory.
For example, if you're only developing the SQL layer,
it makes sense to use --gcov-src-dir=sql
gprof Collect profiling information using gprof.
experimental=<file> Refer to list of tests considered experimental;
failures will be marked exp-fail instead of fail.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment