Commit 47c9056c authored by Magnus Svensson's avatar Magnus Svensson

Fix gcov in mtr.pl

parent 78789715
...@@ -20,25 +20,14 @@ ...@@ -20,25 +20,14 @@
use strict; use strict;
# These are not to be prefixed with "mtr_" sub gcov_prepare ($) {
my ($dir)= @_;
sub gcov_prepare (); `find $dir -name \*.gcov \
sub gcov_collect ();
##############################################################################
#
#
#
##############################################################################
sub gcov_prepare () {
`find $::glob_basedir -name \*.gcov \
-or -name \*.da | xargs rm`; -or -name \*.da | xargs rm`;
} }
# Used by gcov my @mysqld_src_dirs=
our @mysqld_src_dirs=
( (
"strings", "strings",
"mysys", "mysys",
...@@ -53,21 +42,24 @@ our @mysqld_src_dirs= ...@@ -53,21 +42,24 @@ our @mysqld_src_dirs=
"sql", "sql",
); );
sub gcov_collect () { sub gcov_collect ($$$) {
my ($dir, $gcov, $gcov_msg, $err)= @_;
my $start_dir= cwd();
print "Collecting source coverage info...\n"; print "Collecting source coverage info...\n";
-f $::opt_gcov_msg and unlink($::opt_gcov_msg); -f $gcov_msg and unlink($gcov_msg);
-f $::opt_gcov_err and unlink($::opt_gcov_err); -f $gcov_err and unlink($gcov_err);
foreach my $d ( @mysqld_src_dirs ) foreach my $d ( @mysqld_src_dirs )
{ {
chdir("$::glob_basedir/$d"); chdir("$dir/$d");
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
{ {
`$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`; `$gcov $f 2>>$gcov_err >>$gcov_msg`;
} }
chdir($::glob_mysql_test_dir); chdir($start_dir);
} }
print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n"; print "gcov info in $gcov_msg, errors in $gcov_err\n";
} }
......
...@@ -257,7 +257,7 @@ sub main { ...@@ -257,7 +257,7 @@ sub main {
command_line_setup(0); command_line_setup(0);
if ( $opt_gcov ) { if ( $opt_gcov ) {
gcov_prepare(); gcov_prepare($basedir);
} }
if (!$opt_suites) { if (!$opt_suites) {
...@@ -346,6 +346,11 @@ sub main { ...@@ -346,6 +346,11 @@ sub main {
mtr_print_line(); mtr_print_line();
if ( $opt_gcov ) {
gcov_collect($basedir, $opt_gcov,
$opt_gcov_msg, $opt_gcov_err);
}
mtr_report_stats($completed); mtr_report_stats($completed);
exit(0); exit(0);
...@@ -611,11 +616,6 @@ sub run_worker ($) { ...@@ -611,11 +616,6 @@ sub run_worker ($) {
command_line_setup($thread_num); command_line_setup($thread_num);
if ( $opt_gcov )
{
gcov_prepare();
}
setup_vardir(); setup_vardir();
check_running_as_root(); check_running_as_root();
mysql_install_db($thread_num); mysql_install_db($thread_num);
...@@ -649,16 +649,6 @@ sub run_worker ($) { ...@@ -649,16 +649,6 @@ sub run_worker ($) {
stop_all_servers(); stop_all_servers();
if ( $opt_gcov )
{
gcov_collect(); # collect coverage information
}
if ( $opt_gcov )
{
gcov_collect(); # collect coverage information
}
exit(1); exit(1);
} }
......
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