summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Munch <bjorn.munch@oracle.com>2011-04-14 14:25:15 +0200
committerBjorn Munch <bjorn.munch@oracle.com>2011-04-14 14:25:15 +0200
commit255986a511d07b90cc2ab81579ef25aba7c8b48c (patch)
tree9d927b4a357ce0ac288b810b32568b211d6d752b
parent78b5a6324a0c1541e7da68e190cae7404bb21037 (diff)
downloadmariadb-git-255986a511d07b90cc2ab81579ef25aba7c8b48c.tar.gz
Bug #12360501 MTR --GCOV DOES NOT WORK WITH CMAKE BUILDS
Changed to use $bindir instead of $basedir Simplified search for files: find all *.gcno Also, .msg and .err files had been mixed up
-rw-r--r--mysql-test/lib/mtr_gcov.pl24
-rwxr-xr-xmysql-test/mysql-test-run.pl6
2 files changed, 13 insertions, 17 deletions
diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl
index d8fb1c0a07d..6f9e744a548 100644
--- a/mysql-test/lib/mtr_gcov.pl
+++ b/mysql-test/lib/mtr_gcov.pl
@@ -1,5 +1,5 @@
# -*- cperl -*-
-# Copyright (C) 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
+# 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
@@ -31,7 +31,7 @@ sub gcov_prepare ($) {
#
# Collect gcov statistics.
# Arguments:
-# $dir basedir, normally source directory
+# $dir basedir, normally build directory
# $gcov gcov utility program [path] name
# $gcov_msg message file name
# $gcov_err error file name
@@ -43,29 +43,25 @@ sub gcov_collect ($$$) {
my $start_dir= cwd();
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");
+ -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 ) {
- 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");
+ 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");
}
chdir($start_dir);
}
- print "gcov info in $gcov_msg, errors in $gcov_err\n";
+ print "gcov info in $dir/$gcov_msg, errors in $dir/$gcov_err\n";
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 0d227170476..2097bc8f63a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -210,8 +210,8 @@ our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
our $opt_gcov;
our $opt_gcov_exe= "gcov";
-our $opt_gcov_err= "mysql-test-gcov.msg";
-our $opt_gcov_msg= "mysql-test-gcov.err";
+our $opt_gcov_err= "mysql-test-gcov.err";
+our $opt_gcov_msg= "mysql-test-gcov.msg";
our $opt_gprof;
our %gprof_dirs;
@@ -507,7 +507,7 @@ sub main {
mtr_print_line();
if ( $opt_gcov ) {
- gcov_collect($basedir, $opt_gcov_exe,
+ gcov_collect($bindir, $opt_gcov_exe,
$opt_gcov_msg, $opt_gcov_err);
}