mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
mtr uses dgcov for --gcov option
This commit is contained in:
@ -1,71 +0,0 @@
|
|||||||
# -*- 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_process.pl";
|
||||||
require "mtr_io.pl";
|
require "mtr_io.pl";
|
||||||
require "mtr_gcov.pl";
|
|
||||||
require "mtr_gprof.pl";
|
require "mtr_gprof.pl";
|
||||||
require "mtr_misc.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_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
|
||||||
|
|
||||||
our $opt_gcov;
|
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 $opt_gprof;
|
||||||
our %gprof_dirs;
|
our %gprof_dirs;
|
||||||
|
|
||||||
@ -383,11 +377,6 @@ sub main {
|
|||||||
# --help will not reach here, so now it's safe to assume we have binaries
|
# --help will not reach here, so now it's safe to assume we have binaries
|
||||||
My::SafeProcess::find_bin();
|
My::SafeProcess::find_bin();
|
||||||
|
|
||||||
if ( $opt_gcov ) {
|
|
||||||
gcov_prepare($basedir . "/" . $opt_gcov_src_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print "vardir: $opt_vardir\n";
|
print "vardir: $opt_vardir\n";
|
||||||
initialize_servers();
|
initialize_servers();
|
||||||
init_timers();
|
init_timers();
|
||||||
@ -431,6 +420,10 @@ sub main {
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_gcov) {
|
||||||
|
system './dgcov.pl --purge';
|
||||||
|
}
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
my $num_tests= @$tests;
|
my $num_tests= @$tests;
|
||||||
if ( $opt_parallel eq "auto" ) {
|
if ( $opt_parallel eq "auto" ) {
|
||||||
@ -555,15 +548,15 @@ sub main {
|
|||||||
|
|
||||||
mtr_print_line();
|
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;
|
print_total_times($opt_parallel) if $opt_report_times;
|
||||||
|
|
||||||
mtr_report_stats($prefix, $fail, $completed, $extra_warnings);
|
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)
|
if ( @$completed != $num_tests)
|
||||||
{
|
{
|
||||||
mtr_error("Not all tests completed (only ". scalar(@$completed) .
|
mtr_error("Not all tests completed (only ". scalar(@$completed) .
|
||||||
@ -1148,7 +1141,6 @@ sub command_line_setup {
|
|||||||
|
|
||||||
# Coverage, profiling etc
|
# Coverage, profiling etc
|
||||||
'gcov' => \$opt_gcov,
|
'gcov' => \$opt_gcov,
|
||||||
'gcov-src-dir=s' => \$opt_gcov_src_dir,
|
|
||||||
'gprof' => \$opt_gprof,
|
'gprof' => \$opt_gprof,
|
||||||
'valgrind|valgrind-all' => \$opt_valgrind,
|
'valgrind|valgrind-all' => \$opt_valgrind,
|
||||||
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
|
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
|
||||||
@ -6180,9 +6172,6 @@ Misc options
|
|||||||
actions. Disable facility with NUM=0.
|
actions. Disable facility with NUM=0.
|
||||||
gcov Collect coverage information after the test.
|
gcov Collect coverage information after the test.
|
||||||
The result is a gcov file per source and header file.
|
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.
|
gprof Collect profiling information using gprof.
|
||||||
experimental=<file> Refer to list of tests considered experimental;
|
experimental=<file> Refer to list of tests considered experimental;
|
||||||
failures will be marked exp-fail instead of fail.
|
failures will be marked exp-fail instead of fail.
|
||||||
|
Reference in New Issue
Block a user