Commit 721f2ab7 authored by Ingo Struewing's avatar Ingo Struewing

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.
parent 38f0462c
......@@ -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
......
......@@ -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);
}
......
......@@ -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);
......
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