4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # This file incorporates work covered by the following license notice:
12 # Licensed to the Apache Software Foundation (ASF) under one or more
13 # contributor license agreements. See the NOTICE file distributed
14 # with this work for additional information regarding copyright
15 # ownership. The ASF licenses this file to you under the Apache
16 # License, Version 2.0 (the "License"); you may not use this file
17 # except in compliance with the License. You may obtain a copy of
18 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 # Helper, to interpret the result and put the result via html in a database.
24 # Put into DB works via php.
35 our $version_info = 'gcov helper: 1.2 ';
37 our $help; # Help option flag
38 our $version; # Version option flag
41 our $usedFunctions; # name of all functions filename, which have a value > 0
42 our $nonusedFunctions; # name of all functions filename, which have a value == 0
43 our $complete; # name of all functions filename, which have a value == 100
44 our $incomplete; # name of all functions filename, which have a value > 0 && < 100
54 sub read_gcov_function_file
($);
55 sub create2DigitNumber
($);
57 # Parse command line options
60 "version" => \
$version,
62 "usedfunctions=s" => \
$usedFunctions,
63 "nonusedfunctions=s" => \
$nonusedFunctions,
64 "complete=s" => \
$complete,
65 "incomplete=s" => \
$incomplete,
66 "cwsname=s" => \
$cwsname,
69 "environment=s" => \
$environment,
70 "outputdir=s" => \
$outputDir
77 # Check for help option
84 # Check for version option
87 print("$version_info\n");
91 # check if enough parameters
94 # print("No input filename specified\n");
95 # print_usage(*STDERR);
99 # ------------------------------------------------------------------------------
101 my $sURL = "http://mahler.germany.sun.com/qadev/baselib/gcov_result_in_db_putter.php";
107 my $result = `cat $complete | wc -l`;
109 $result =~ / *(\d+)/;
110 $sURL = $sURL . "$next" . "complete=$1";
114 if ($nonusedFunctions)
116 my $result = `cat $nonusedFunctions | wc -l`;
118 $result =~ / *(\d+)/;
119 $sURL = $sURL . "$next" . "notused=$1";
124 my $result = `cat $usedFunctions | wc -l`;
126 $result =~ / *(\d+)/;
127 $sURL = $sURL . "$next" . "used=$1";
132 my $result = `cat $incomplete | wc -l`;
134 $result =~ / *(\d+)/;
135 $sURL = $sURL . "$next" . "incomplete=$1";
142 $sURL = $sURL . "$next" . "cwsname=$cwsname";
148 $sURL = $sURL . "$next" . "major=$major";
154 $sURL = $sURL . "$next" . "minor=$minor";
161 $sURL = $sURL . "$next" . "environment=$environment";
165 my $year = localtime->year() + 1900;
166 my $month = create2DigitNumber
(localtime->mon() + 1);
167 my $day = create2DigitNumber
(localtime->mday());
168 $sURL = $sURL . "$next" . "date=$year-$month-$day";
175 $output = $outputDir;
178 # check if output ends with "/"
179 if ( $output =~ /\/$/ )
181 print "Output name ends with '/'\n";
185 print "Output name does not end with '/'\n";
186 $output = $output . "/";
188 $output = $output . "php_result.txt";
190 my $result = `wget -O $output "$sURL"`;
196 # ----------------------------------------------------------------------------
199 local *HANDLE
= $_[0];
200 my $tool_name = basename
($0);
202 print(HANDLE
<<END_OF_USAGE);
204 Usage: $tool_name [OPTIONS]
206 -u, --usedfunctions count of all functions, which have a value > 0
207 -n, --nonusedfunctions count of all functions, which have a value == 0
208 -co, --complete count of all functions, which have a value == 100
209 -i, --incomplete count of all functions, which have a value > 0 && < 100
211 -cw, --cwsname set cwsname
212 -ma, --major set major number
213 -mi, --minor set minor number
214 -e, --environment set environment
216 -o, --outputdir set the directory, where to store the wget result
218 -h, --help Print this help, then exit
219 -v, --version Print version number, then exit
224 # ------------------------------------------------------------------------------
225 sub create2DigitNumber($)
229 my $nDigitLen = length $digit;
239 $str = substr $digit, $nDigitLen - 2, 2;