2
# Copyright (C) 2004, 2006 MySQL AB
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
# This is a library file used by the Perl version of mysql-test-run,
18
# and is part of the translation of the Bourne shell script with the
23
sub gcov_prepare ($) {
25
print "Purging gcov information from '$dir'...\n";
27
system("find $dir -name \*.gcov -o -name \*.da"
28
. " -o -name \*.gcda | grep -v 'README.gcov\$' | xargs rm");
32
# Collect gcov statistics.
34
# $dir basedir, normally source directory
35
# $gcov gcov utility program [path] name
36
# $gcov_msg message file name
37
# $gcov_err error file name
39
sub gcov_collect ($$$) {
40
my ($dir, $gcov, $gcov_msg, $gcov_err)= @_;
42
# Get current directory to return to later.
45
print "Collecting source coverage info using '$gcov'...\n";
46
-f "$start_dir/$gcov_msg" and unlink("$start_dir/$gcov_msg");
47
-f "$start_dir/$gcov_err" and unlink("$start_dir/$gcov_err");
49
my @dirs= `find "$dir" -type d -print | sort`;
50
#print "List of directories:\n@dirs\n";
52
foreach my $d ( @dirs ) {
57
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) {
61
print "Collecting in '$d'...\n";
64
system("$gcov $f 2>>$start_dir/$gcov_err >>$start_dir/$gcov_msg");
68
print "gcov info in $gcov_msg, errors in $gcov_err\n";