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 compare two different results
33 our $version_info = 'gcov_resultcompare: 1.2 ';
35 our $help; # Help option flag
36 our $version; # Version option flag
44 sub read_gcov_function_file
($);
46 # Parse command line options
51 "version" => \
$version
58 # Check for help option
65 # Check for version option
68 print("$version_info\n");
72 # check if enough parameters
75 # print("No input filenames specified\n");
76 # print_usage(*STDERR);
91 # ------------------------------------------------------------------------------
93 my %origlist = read_gcov_function_file
($orig);
94 my %cmplist = read_gcov_function_file
($compare);
99 while (($key, $value) = each %origlist)
101 my $cmpvalue = $cmplist{$key};
103 if ($cmpvalue != 0.00)
107 if ($cmpvalue > $value && $value < 90.0)
109 print "$key, $value, CMP:$cmpvalue\n";
115 # --------------------------------------------------------------------------------
116 # Read the gcov function (gcov -f) file
117 # and compare line by line with the export function list
118 # so we get a list of functions, which are only exported, and not all stuff.
120 sub read_gcov_function_file
($)
127 open(INPUT_HANDLE
, $file)
128 or die("ERROR: cannot open $file!\n");
130 while ($line = <INPUT_HANDLE
>)
133 # sample line (for reg exp:)
134 # 100.00 rtl_ustr_toDouble
135 if ($line =~ /^(.{6}) (\w+)$/ )
140 $list{$value} = $percent;
147 # ----------------------------------------------------------------------------
150 local *HANDLE
= $_[0];
151 my $tool_name = basename
($0);
153 print(HANDLE
<<END_OF_USAGE);
155 Usage: $tool_name [OPTIONS] INPUTFILE
157 -o Original File, which gives the main values
158 if here a value is smaller than in compare, the found value is a candidate for better check.
161 -h, --help Print this help, then exit
162 -v, --version Print version number, then exit