3 # $Id: gcov_result.pl,v 1.2 2003-06-11 16:36:30 vg Exp $
8 # Helper, to interpret the result and put the result via html in a database.
9 # Put into DB works via php.
20 our $version_info = 'gcov helper $Revision: 1.2 $ ';
22 our $help; # Help option flag
23 our $version; # Version option flag
26 our $usedFunctions; # name of all functions filename, which have a value > 0
27 our $nonusedFunctions; # name of all functions filename, which have a value == 0
28 our $complete; # name of all functions filename, which have a value == 100
29 our $incomplete; # name of all functions filename, which have a value > 0 && < 100
39 sub read_gcov_function_file
($);
40 sub create2DigitNumber
($);
42 # Parse command line options
45 "version" => \
$version,
47 "usedfunctions=s" => \
$usedFunctions,
48 "nonusedfunctions=s" => \
$nonusedFunctions,
49 "complete=s" => \
$complete,
50 "incomplete=s" => \
$incomplete,
51 "cwsname=s" => \
$cwsname,
54 "environment=s" => \
$environment,
55 "outputdir=s" => \
$outputDir
62 # Check for help option
69 # Check for version option
72 print("$version_info\n");
76 # check if enough parameters
79 # print("No input filename specified\n");
80 # print_usage(*STDERR);
84 # ------------------------------------------------------------------------------
86 my $sURL = "http://mahler.germany.sun.com/qadev/baselib/gcov_result_in_db_putter.php";
92 my $result = `cat $complete | wc -l`;
95 $sURL = $sURL . "$next" . "complete=$1";
99 if ($nonusedFunctions)
101 my $result = `cat $nonusedFunctions | wc -l`;
103 $result =~ / *(\d+)/;
104 $sURL = $sURL . "$next" . "notused=$1";
109 my $result = `cat $usedFunctions | wc -l`;
111 $result =~ / *(\d+)/;
112 $sURL = $sURL . "$next" . "used=$1";
117 my $result = `cat $incomplete | wc -l`;
119 $result =~ / *(\d+)/;
120 $sURL = $sURL . "$next" . "incomplete=$1";
127 $sURL = $sURL . "$next" . "cwsname=$cwsname";
133 $sURL = $sURL . "$next" . "major=$major";
139 $sURL = $sURL . "$next" . "minor=$minor";
146 $sURL = $sURL . "$next" . "environment=$environment";
150 my $year = localtime->year() + 1900;
151 my $month = create2DigitNumber
(localtime->mon() + 1);
152 my $day = create2DigitNumber
(localtime->mday());
153 $sURL = $sURL . "$next" . "date=$year-$month-$day";
160 $output = $outputDir;
163 # check if output ends with "/"
164 if ( $output =~ /\/$/ )
166 print "Output name ends with '/'\n";
170 print "Output name does not end with '/'\n";
171 $output = $output . "/";
173 $output = $output . "php_result.txt";
175 my $result = `wget -O $output "$sURL"`;
181 # ----------------------------------------------------------------------------
184 local *HANDLE
= $_[0];
185 my $tool_name = basename
($0);
187 print(HANDLE
<<END_OF_USAGE);
189 Usage: $tool_name [OPTIONS]
191 -u, --usedfunctions count of all functions, which have a value > 0
192 -n, --nonusedfunctions count of all functions, which have a value == 0
193 -co, --complete count of all functions, which have a value == 100
194 -i, --incomplete count of all functions, which have a value > 0 && < 100
196 -cw, --cwsname set cwsname
197 -ma, --major set major number
198 -mi, --minor set minor number
199 -e, --environment set environment
201 -o, --outputdir set the directory, where to store the wget result
203 -h, --help Print this help, then exit
204 -v, --version Print version number, then exit
209 # ------------------------------------------------------------------------------
210 sub create2DigitNumber($)
214 my $nDigitLen = length $digit;
224 $str = substr $digit, $nDigitLen - 2, 2;