1# -*- cperl -*-
2# Copyright (c) 2004, 2006 MySQL AB, 2008 Sun Microsystems, Inc.
3# Use is subject to license terms.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; version 2 of the License.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1335  USA
17
18# This is a library file used by the Perl version of mysql-test-run,
19# and is part of the translation of the Bourne shell script with the
20# same name.
21
22use strict;
23
24# These are not to be prefixed with "mtr_"
25
26sub gcov_prepare ();
27sub gcov_collect ();
28
29##############################################################################
30#
31#
32#
33##############################################################################
34
35sub gcov_prepare () {
36
37  `find $::glob_basedir -name \*.gcov \
38    -or -name \*.da | xargs rm`;
39}
40
41# Used by gcov
42our @mysqld_src_dirs=
43  (
44   "strings",
45   "mysys",
46   "include",
47   "extra",
48   "regex",
49   "isam",
50   "merge",
51   "myisam",
52   "myisammrg",
53   "heap",
54   "sql",
55  );
56
57sub gcov_collect () {
58
59  print "Collecting source coverage info...\n";
60  -f $::opt_gcov_msg and unlink($::opt_gcov_msg);
61  -f $::opt_gcov_err and unlink($::opt_gcov_err);
62  foreach my $d ( @mysqld_src_dirs )
63  {
64    chdir("$::glob_basedir/$d");
65    foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
66    {
67      `$::opt_gcov $f 2>>$::opt_gcov_err  >>$::opt_gcov_msg`;
68    }
69    chdir($::glob_mysql_test_dir);
70  }
71  print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
72}
73
74
751;
76