提交 cb076b7c authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Update gyp and lcov deps

上级 22cc15a5
language: cpp language: cpp
compiler: matrix:
- clang include:
- os: linux
compiler: clang
- os: osx
compiler: clang
- python: 2.7
language: python
before_install: pip install flake8
script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
- python: 3.7
language: python
before_install: pip install flake8
script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
before_install: ./buildbot/travis-checkout.sh before_install: ./buildbot/travis-checkout.sh
script: ./buildbot/travis-test.sh script: ./buildbot/travis-test.sh
os:
- linux
- osx
branches: branches:
only: only:
- master - master
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import os import os
import random import random
import sys
import gyp.common import gyp.common
...@@ -56,8 +57,11 @@ def MakeGuid(name, seed='msvs_new'): ...@@ -56,8 +57,11 @@ def MakeGuid(name, seed='msvs_new'):
determine the GUID to refer to explicitly. It also means that the GUID will determine the GUID to refer to explicitly. It also means that the GUID will
not change when the project for a target is rebuilt. not change when the project for a target is rebuilt.
""" """
to_hash = str(seed) + str(name)
to_hash = to_hash.encode('utf-8')
# Calculate a MD5 signature for the seed and name. # Calculate a MD5 signature for the seed and name.
d = _new_md5(str(seed) + str(name)).hexdigest().upper() d = _new_md5(to_hash).hexdigest().upper()
# Convert most of the signature to GUID form (discard the rest) # Convert most of the signature to GUID form (discard the rest)
guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20] guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20]
+ '-' + d[20:32] + '}') + '-' + d[20:32] + '}')
...@@ -71,6 +75,8 @@ class MSVSSolutionEntry(object): ...@@ -71,6 +75,8 @@ class MSVSSolutionEntry(object):
# Sort by name then guid (so things are in order on vs2008). # Sort by name then guid (so things are in order on vs2008).
return cmp((self.name, self.get_guid()), (other.name, other.get_guid())) return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
def __lt__(self, other):
return (self.name, self.get_guid()) < (other.name, other.get_guid())
class MSVSFolder(MSVSSolutionEntry): class MSVSFolder(MSVSSolutionEntry):
"""Folder in a Visual Studio project or solution.""" """Folder in a Visual Studio project or solution."""
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import re import re
import os import os
import locale import locale
import sys
try: try:
# reduce moved to functools in python3. # reduce moved to functools in python3.
...@@ -121,10 +122,12 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, ...@@ -121,10 +122,12 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
xml_string = XmlToString(content, encoding, pretty) xml_string = XmlToString(content, encoding, pretty)
if win32 and os.linesep != '\r\n': if win32 and os.linesep != '\r\n':
xml_string = xml_string.replace('\n', '\r\n') xml_string = xml_string.replace('\n', '\r\n')
default_encoding = locale.getdefaultlocale()[1]
default_encoding = locale.getdefaultlocale()[1] if default_encoding and default_encoding.upper() != encoding.upper():
if default_encoding and default_encoding.upper() != encoding.upper(): try:
xml_string = xml_string.decode(default_encoding).encode(encoding) xml_string = xml_string.decode(default_encoding).encode(encoding)
except AttributeError:
pass
# Get the old content # Get the old content
try: try:
......
...@@ -2712,7 +2712,7 @@ def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name): ...@@ -2712,7 +2712,7 @@ def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name):
platform_name = None platform_name = None
msvs_windows_sdk_version = None msvs_windows_sdk_version = None
for configuration in spec['configurations'].itervalues(): for configuration in spec['configurations'].values():
platform_name = platform_name or _ConfigPlatform(configuration) platform_name = platform_name or _ConfigPlatform(configuration)
msvs_windows_sdk_version = (msvs_windows_sdk_version or msvs_windows_sdk_version = (msvs_windows_sdk_version or
_ConfigWindowsTargetPlatformVersion(configuration, version)) _ConfigWindowsTargetPlatformVersion(configuration, version))
......
...@@ -621,7 +621,7 @@ class NinjaWriter(object): ...@@ -621,7 +621,7 @@ class NinjaWriter(object):
args = action['action'] args = action['action']
depfile = action.get('depfile', None) depfile = action.get('depfile', None)
if depfile: if depfile:
depfile = self.ExpandSpecial(depfile, self.base_to_build) depfile = self.ExpandSpecial(depfile)
pool = 'console' if int(action.get('ninja_use_console', 0)) else None pool = 'console' if int(action.get('ninja_use_console', 0)) else None
rule_name, _ = self.WriteNewNinjaRule(name, args, description, rule_name, _ = self.WriteNewNinjaRule(name, args, description,
is_cygwin, env, pool, is_cygwin, env, pool,
......
...@@ -16,8 +16,25 @@ ...@@ -16,8 +16,25 @@
'outputs': [ 'outputs': [
'output.txt', 'output.txt',
], ],
'depfile': 'depfile.d', 'depfile': 'depfile_action.d',
'action': [ ] 'action': [
'python', 'touch.py', '<(PRODUCT_DIR)/<(_depfile)',
],
'msvs_cygwin_shell': 0,
},
{
'action_name': 'depfile_action_intermediate_dir',
'inputs': [
'input.txt',
],
'outputs': [
'output-intermediate.txt',
],
'depfile': '<(INTERMEDIATE_DIR)/depfile_action_intermediate_dir.d',
'action': [
'python', 'touch.py', '<(_depfile)',
],
'msvs_cygwin_shell': 0,
}, },
], ],
}, },
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"""Verifies that depfile fields are output in ninja rules.""" """Verifies that depfile fields are output in ninja rules."""
import TestGyp import TestGyp
import os
test = TestGyp.TestGyp() test = TestGyp.TestGyp()
...@@ -14,7 +15,16 @@ if test.format == 'ninja': ...@@ -14,7 +15,16 @@ if test.format == 'ninja':
test.run_gyp('depfile.gyp') test.run_gyp('depfile.gyp')
contents = open(test.built_file_path('obj/depfile_target.ninja')).read() contents = open(test.built_file_path('obj/depfile_target.ninja')).read()
expected = 'depfile = depfile.d' expected = [
if expected not in contents: 'depfile = depfile_action.d',
test.fail_test() 'depfile = ' + os.path.join(
'obj', 'depfile_target.gen/depfile_action_intermediate_dir.d'),
]
test.must_contain_all_lines(contents, expected)
test.build('depfile.gyp')
test.built_file_must_exist('depfile_action.d')
test.built_file_must_exist(
'obj/depfile_target.gen/depfile_action_intermediate_dir.d')
test.pass_test() test.pass_test()
#!/usr/bin/env python
#
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
"""Cross-platform touch."""
for fname in sys.argv[1:]:
if os.path.exists(fname):
os.utime(fname, None)
else:
if not os.path.exists(os.path.join('.', os.path.dirname(fname))):
os.makedirs(os.path.dirname(fname))
open(fname, 'w').close()
...@@ -63,8 +63,9 @@ list [1]. ...@@ -63,8 +63,9 @@ list [1].
Contribution format Contribution format
=================== ===================
To contribute a change, please create a patch using the diff utility with the To contribute a change, please create a patch using 'git format-patch'.
following command line options: Alternatively you can use the diff utility with the following command line
options:
diff -Naurp diff -Naurp
......
...@@ -15,6 +15,10 @@ VERSION := $(shell bin/get_version.sh --version) ...@@ -15,6 +15,10 @@ VERSION := $(shell bin/get_version.sh --version)
RELEASE := $(shell bin/get_version.sh --release) RELEASE := $(shell bin/get_version.sh --release)
FULL := $(shell bin/get_version.sh --full) FULL := $(shell bin/get_version.sh --full)
# Set this variable during 'make install' to specify the Perl interpreter used in
# installed scripts, or leave empty to keep the current interpreter.
export LCOV_PERL_PATH := /usr/bin/perl
PREFIX := /usr/local PREFIX := /usr/local
CFG_DIR := $(PREFIX)/etc CFG_DIR := $(PREFIX)/etc
......
------------------------------------------------- -------------------------------------------------
- README file for the LTP GCOV extension (LCOV) - - README file for the LTP GCOV extension (LCOV) -
- Last changes: 2015-10-05 - - Last changes: 2016-12-19 -
------------------------------------------------- -------------------------------------------------
Description Description
......
#!/bin/bash #!/usr/bin/env bash
# #
# Usage: copy_dates.sh SOURCE TARGET # Usage: copy_dates.sh SOURCE TARGET
# #
......
#!/usr/bin/perl -w #!/usr/bin/env perl
# #
# Copyright (c) International Business Machines Corp., 2002 # Copyright (c) International Business Machines Corp., 2002
# #
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
# #
use strict; use strict;
use warnings;
use File::Basename; use File::Basename;
use Getopt::Long; use Getopt::Long;
use Cwd qw/abs_path/; use Cwd qw/abs_path/;
......
#!/usr/bin/perl -w #!/usr/bin/env perl
# #
# Copyright (c) International Business Machines Corp., 2002,2012 # Copyright (c) International Business Machines Corp., 2002,2012
# #
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
# #
use strict; use strict;
use warnings;
use File::Basename; use File::Basename;
use File::Temp qw(tempfile); use File::Temp qw(tempfile);
use Getopt::Long; use Getopt::Long;
...@@ -154,6 +155,9 @@ our $BR_CLOSE = 5; ...@@ -154,6 +155,9 @@ our $BR_CLOSE = 5;
our $BR_SUB = 0; our $BR_SUB = 0;
our $BR_ADD = 1; our $BR_ADD = 1;
# Block value used for unnamed blocks
our $UNNAMED_BLOCK = vec(pack('b*', 1 x 32), 0, 32);
# Error classes which users may specify to ignore during processing # Error classes which users may specify to ignore during processing
our $ERROR_SOURCE = 0; our $ERROR_SOURCE = 0;
our %ERROR_ID = ( our %ERROR_ID = (
...@@ -234,7 +238,7 @@ sub write_test_table_epilog(*); ...@@ -234,7 +238,7 @@ sub write_test_table_epilog(*);
sub write_source($$$$$$$); sub write_source($$$$$$$);
sub write_source_prolog(*); sub write_source_prolog(*);
sub write_source_line(*$$$$$$); sub write_source_line(*$$$$$);
sub write_source_epilog(*); sub write_source_epilog(*);
sub write_frameset(*$$$); sub write_frameset(*$$$);
...@@ -287,6 +291,7 @@ our @opt_ignore_errors; # Ignore certain error classes during processing ...@@ -287,6 +291,7 @@ our @opt_ignore_errors; # Ignore certain error classes during processing
our @ignore; our @ignore;
our $opt_config_file; # User-specified configuration file location our $opt_config_file; # User-specified configuration file location
our %opt_rc; our %opt_rc;
our $opt_missed; # List/sort lines by missed counts
our $charset = "UTF-8"; # Default charset for HTML pages our $charset = "UTF-8"; # Default charset for HTML pages
our @fileview_sortlist; our @fileview_sortlist;
our @fileview_sortname = ("", "-sort-l", "-sort-f", "-sort-b"); our @fileview_sortname = ("", "-sort-l", "-sort-f", "-sort-b");
...@@ -374,6 +379,7 @@ if ($config || %opt_rc) ...@@ -374,6 +379,7 @@ if ($config || %opt_rc)
"genhtml_charset" => \$charset, "genhtml_charset" => \$charset,
"genhtml_desc_html" => \$rc_desc_html, "genhtml_desc_html" => \$rc_desc_html,
"genhtml_demangle_cpp" => \$demangle_cpp, "genhtml_demangle_cpp" => \$demangle_cpp,
"genhtml_missed" => \$opt_missed,
"lcov_function_coverage" => \$lcov_func_coverage, "lcov_function_coverage" => \$lcov_func_coverage,
"lcov_branch_coverage" => \$lcov_branch_coverage, "lcov_branch_coverage" => \$lcov_branch_coverage,
}); });
...@@ -420,6 +426,7 @@ if (!GetOptions("output-directory|o=s" => \$output_directory, ...@@ -420,6 +426,7 @@ if (!GetOptions("output-directory|o=s" => \$output_directory,
"config-file=s" => \$opt_config_file, "config-file=s" => \$opt_config_file,
"rc=s%" => \%opt_rc, "rc=s%" => \%opt_rc,
"precision=i" => \$default_precision, "precision=i" => \$default_precision,
"missed" => \$opt_missed,
)) ))
{ {
print(STDERR "Use $tool_name --help to get usage information\n"); print(STDERR "Use $tool_name --help to get usage information\n");
...@@ -621,6 +628,7 @@ HTML output: ...@@ -621,6 +628,7 @@ HTML output:
--(no-)sort Enable (disable) sorted coverage views --(no-)sort Enable (disable) sorted coverage views
--demangle-cpp Demangle C++ function names --demangle-cpp Demangle C++ function names
--precision NUM Set precision of coverage rate --precision NUM Set precision of coverage rate
--missed Show miss counts as negative numbers
For more information see: $lcov_url For more information see: $lcov_url
END_OF_USAGE END_OF_USAGE
...@@ -1620,6 +1628,7 @@ sub read_info_file($) ...@@ -1620,6 +1628,7 @@ sub read_info_file($)
($1, $2, $3, $4); ($1, $2, $3, $4);
last if (!$br_coverage); last if (!$br_coverage);
$block = -1 if ($block == $UNNAMED_BLOCK);
$sumbrcount->{$line} .= $sumbrcount->{$line} .=
"$block,$branch,$taken:"; "$block,$branch,$taken:";
...@@ -2621,9 +2630,18 @@ sub get_date_string() ...@@ -2621,9 +2630,18 @@ sub get_date_string()
my $hour; my $hour;
my $min; my $min;
my $sec; my $sec;
my @timeresult;
if (defined $ENV{'SOURCE_DATE_EPOCH'})
{
@timeresult = gmtime($ENV{'SOURCE_DATE_EPOCH'});
}
else
{
@timeresult = localtime();
}
($year, $month, $day, $hour, $min, $sec) = ($year, $month, $day, $hour, $min, $sec) =
(localtime())[5, 4, 3, 2, 1, 0]; @timeresult[5, 4, 3, 2, 1, 0];
return sprintf("%d-%02d-%02d %02d:%02d:%02d", $year+1900, $month+1, return sprintf("%d-%02d-%02d %02d:%02d:%02d", $year+1900, $month+1,
$day, $hour, $min, $sec); $day, $hour, $min, $sec);
...@@ -3732,6 +3750,10 @@ END_OF_HTML ...@@ -3732,6 +3750,10 @@ END_OF_HTML
$class = $rate_name[classify_rate($found, $hit, $class = $rate_name[classify_rate($found, $hit,
$med, $hi)]; $med, $hi)];
} }
if ($opt_missed) {
# Show negative number of items without coverage
$hit = -($found - $hit);
}
write_html($handle, <<END_OF_HTML); write_html($handle, <<END_OF_HTML);
<td class="coverPer$class">$rate</td> <td class="coverPer$class">$rate</td>
<td class="coverNum$class">$hit / $found</td> <td class="coverNum$class">$hit / $found</td>
...@@ -4137,16 +4159,15 @@ sub format_count($$) ...@@ -4137,16 +4159,15 @@ sub format_count($$)
# #
# write_source_line(filehandle, line_num, source, hit_count, converted, # write_source_line(filehandle, line_num, source, hit_count, converted,
# brdata, add_anchor) # brdata)
# #
# Write formatted source code line. Return a line in a format as needed # Write formatted source code line. Return a line in a format as needed
# by gen_png() # by gen_png()
# #
sub write_source_line(*$$$$$$) sub write_source_line(*$$$$$)
{ {
my ($handle, $line, $source, $count, $converted, $brdata, my ($handle, $line, $source, $count, $converted, $brdata) = @_;
$add_anchor) = @_;
my $source_format; my $source_format;
my $count_format; my $count_format;
my $result; my $result;
...@@ -4183,11 +4204,8 @@ sub write_source_line(*$$$$$$) ...@@ -4183,11 +4204,8 @@ sub write_source_line(*$$$$$$)
# Write out a line number navigation anchor every $nav_resolution # Write out a line number navigation anchor every $nav_resolution
# lines if necessary # lines if necessary
if ($add_anchor) $anchor_start = "<a name=\"$_[1]\">";
{ $anchor_end = "</a>";
$anchor_start = "<a name=\"$_[1]\">";
$anchor_end = "</a>";
}
# ************************************************************* # *************************************************************
...@@ -4632,10 +4650,57 @@ END_OF_HTML ...@@ -4632,10 +4650,57 @@ END_OF_HTML
write_header_epilog(*HTML_HANDLE, $base_dir); write_header_epilog(*HTML_HANDLE, $base_dir);
} }
sub get_sorted_by_rate($$)
{
my ($hash, $type) = @_;
if ($type == $SORT_LINE) {
# Sort by line coverage
return sort({$hash->{$a}[7] <=> $hash->{$b}[7]} keys(%{$hash}));
} elsif ($type == $SORT_FUNC) {
# Sort by function coverage;
return sort({$hash->{$a}[8] <=> $hash->{$b}[8]} keys(%{$hash}));
} elsif ($type == $SORT_BRANCH) {
# Sort by br coverage;
return sort({$hash->{$a}[9] <=> $hash->{$b}[9]} keys(%{$hash}));
}
}
sub get_sorted_by_missed($$)
{
my ($hash, $type) = @_;
if ($type == $SORT_LINE) {
# Sort by number of instrumented lines without coverage
return sort(
{
($hash->{$b}[0] - $hash->{$b}[1]) <=>
($hash->{$a}[0] - $hash->{$a}[1])
} keys(%{$hash}));
} elsif ($type == $SORT_FUNC) {
# Sort by number of instrumented functions without coverage
return sort(
{
($hash->{$b}[2] - $hash->{$b}[3]) <=>
($hash->{$a}[2] - $hash->{$a}[3])
} keys(%{$hash}));
} elsif ($type == $SORT_BRANCH) {
# Sort by number of instrumented branches without coverage
return sort(
{
($hash->{$b}[4] - $hash->{$b}[5]) <=>
($hash->{$a}[4] - $hash->{$a}[5])
} keys(%{$hash}));
}
}
# #
# get_sorted_keys(hash_ref, sort_type) # get_sorted_keys(hash_ref, sort_type)
# #
# hash_ref: filename -> stats
# stats: [ lines_found, lines_hit, fn_found, fn_hit, br_found, br_hit,
# link_name, line_rate, fn_rate, br_rate ]
#
sub get_sorted_keys($$) sub get_sorted_keys($$)
{ {
...@@ -4644,15 +4709,10 @@ sub get_sorted_keys($$) ...@@ -4644,15 +4709,10 @@ sub get_sorted_keys($$)
if ($type == $SORT_FILE) { if ($type == $SORT_FILE) {
# Sort by name # Sort by name
return sort(keys(%{$hash})); return sort(keys(%{$hash}));
} elsif ($type == $SORT_LINE) { } elsif ($opt_missed) {
# Sort by line coverage return get_sorted_by_missed($hash, $type);
return sort({$hash->{$a}[7] <=> $hash->{$b}[7]} keys(%{$hash})); } else {
} elsif ($type == $SORT_FUNC) { return get_sorted_by_rate($hash, $type);
# Sort by function coverage;
return sort({$hash->{$a}[8] <=> $hash->{$b}[8]} keys(%{$hash}));
} elsif ($type == $SORT_BRANCH) {
# Sort by br coverage;
return sort({$hash->{$a}[9] <=> $hash->{$b}[9]} keys(%{$hash}));
} }
} }
...@@ -5067,7 +5127,6 @@ sub write_source($$$$$$$) ...@@ -5067,7 +5127,6 @@ sub write_source($$$$$$$)
my $funcdata = $_[5]; my $funcdata = $_[5];
my $sumbrcount = $_[6]; my $sumbrcount = $_[6];
my $datafunc = get_hash_reverse($funcdata); my $datafunc = get_hash_reverse($funcdata);
my $add_anchor;
my @file; my @file;
if ($_[2]) if ($_[2])
...@@ -5118,25 +5177,11 @@ sub write_source($$$$$$$) ...@@ -5118,25 +5177,11 @@ sub write_source($$$$$$$)
"$line_number\n"); "$line_number\n");
} }
$add_anchor = 0;
if ($frames) {
if (($line_number - 1) % $nav_resolution == 0) {
$add_anchor = 1;
}
}
if ($func_coverage) {
if ($line_number == 1) {
$add_anchor = 1;
} elsif (defined($datafunc->{$line_number +
$func_offset})) {
$add_anchor = 1;
}
}
push (@result, push (@result,
write_source_line(HTML_HANDLE, $line_number, write_source_line(HTML_HANDLE, $line_number,
$_, $count_data{$line_number}, $_, $count_data{$line_number},
$converted->{$line_number}, $converted->{$line_number},
$sumbrcount->{$line_number}, $add_anchor)); $sumbrcount->{$line_number}));
} }
close(SOURCE_HANDLE); close(SOURCE_HANDLE);
......
#!/usr/bin/perl -w #!/usr/bin/env perl
# #
# Copyright (c) International Business Machines Corp., 2002,2012 # Copyright (c) International Business Machines Corp., 2002,2012
# #
...@@ -50,12 +50,18 @@ ...@@ -50,12 +50,18 @@
# #
use strict; use strict;
use warnings;
use File::Basename; use File::Basename;
use File::Spec::Functions qw /abs2rel catdir file_name_is_absolute splitdir use File::Spec::Functions qw /abs2rel catdir file_name_is_absolute splitdir
splitpath catpath/; splitpath catpath/;
use File::Temp qw(tempfile tempdir);
use File::Copy qw(copy);
use Getopt::Long; use Getopt::Long;
use Digest::MD5 qw(md5_base64); use Digest::MD5 qw(md5_base64);
use Cwd qw/abs_path/; use Cwd qw/abs_path/;
use PerlIO::gzip;
use JSON qw(decode_json);
if( $^O eq "msys" ) if( $^O eq "msys" )
{ {
require File::Spec::Win32; require File::Spec::Win32;
...@@ -68,6 +74,7 @@ our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php"; ...@@ -68,6 +74,7 @@ our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
our $gcov_tool = "gcov"; our $gcov_tool = "gcov";
our $tool_name = basename($0); our $tool_name = basename($0);
our $GCOV_VERSION_8_0_0 = 0x80000;
our $GCOV_VERSION_4_7_0 = 0x40700; our $GCOV_VERSION_4_7_0 = 0x40700;
our $GCOV_VERSION_3_4_0 = 0x30400; our $GCOV_VERSION_3_4_0 = 0x30400;
our $GCOV_VERSION_3_3_0 = 0x30300; our $GCOV_VERSION_3_3_0 = 0x30300;
...@@ -161,13 +168,13 @@ sub solve_relative_path($$); ...@@ -161,13 +168,13 @@ sub solve_relative_path($$);
sub read_gcov_header($); sub read_gcov_header($);
sub read_gcov_file($); sub read_gcov_file($);
sub info(@); sub info(@);
sub process_intermediate($$$);
sub map_llvm_version($); sub map_llvm_version($);
sub version_to_str($); sub version_to_str($);
sub get_gcov_version(); sub get_gcov_version();
sub system_no_output($@); sub system_no_output($@);
sub read_config($); sub read_config($);
sub apply_config($); sub apply_config($);
sub get_exclusion_data($);
sub apply_exclusion_data($$); sub apply_exclusion_data($$);
sub process_graphfile($$); sub process_graphfile($$);
sub filter_fn_name($); sub filter_fn_name($);
...@@ -182,7 +189,7 @@ sub sort_uniq(@); ...@@ -182,7 +189,7 @@ sub sort_uniq(@);
sub sort_uniq_lex(@); sub sort_uniq_lex(@);
sub graph_cleanup($); sub graph_cleanup($);
sub graph_find_base($); sub graph_find_base($);
sub graph_from_bb($$$); sub graph_from_bb($$$$);
sub graph_add_order($$$); sub graph_add_order($$$);
sub read_bb_word(*;$); sub read_bb_word(*;$);
sub read_bb_value(*;$); sub read_bb_value(*;$);
...@@ -262,6 +269,8 @@ our $gcno_split_crc; ...@@ -262,6 +269,8 @@ our $gcno_split_crc;
our $func_coverage = 1; our $func_coverage = 1;
our $br_coverage = 0; our $br_coverage = 0;
our $rc_auto_base = 1; our $rc_auto_base = 1;
our $rc_intermediate = "auto";
our $intermediate;
our $excl_line = "LCOV_EXCL_LINE"; our $excl_line = "LCOV_EXCL_LINE";
our $excl_br_line = "LCOV_EXCL_BR_LINE"; our $excl_br_line = "LCOV_EXCL_BR_LINE";
...@@ -329,6 +338,7 @@ if ($config || %opt_rc) ...@@ -329,6 +338,7 @@ if ($config || %opt_rc)
"geninfo_compat" => \$opt_compat, "geninfo_compat" => \$opt_compat,
"geninfo_adjust_src_path" => \$rc_adjust_src_path, "geninfo_adjust_src_path" => \$rc_adjust_src_path,
"geninfo_auto_base" => \$rc_auto_base, "geninfo_auto_base" => \$rc_auto_base,
"geninfo_intermediate" => \$rc_intermediate,
"lcov_function_coverage" => \$func_coverage, "lcov_function_coverage" => \$func_coverage,
"lcov_branch_coverage" => \$br_coverage, "lcov_branch_coverage" => \$br_coverage,
"lcov_excl_line" => \$excl_line, "lcov_excl_line" => \$excl_line,
...@@ -458,16 +468,45 @@ if (system_no_output(3, $gcov_tool, "--help") == -1) ...@@ -458,16 +468,45 @@ if (system_no_output(3, $gcov_tool, "--help") == -1)
} }
($gcov_version, $gcov_version_string) = get_gcov_version(); ($gcov_version, $gcov_version_string) = get_gcov_version();
$gcov_caps = get_gcov_capabilities();
# Determine intermediate mode
if ($rc_intermediate eq "0") {
$intermediate = 0;
} elsif ($rc_intermediate eq "1") {
$intermediate = 1;
} elsif (lc($rc_intermediate) eq "auto") {
# Use intermediate format if supported by gcov
$intermediate = ($gcov_caps->{'intermediate-format'} ||
$gcov_caps->{'json-format'}) ? 1 : 0;
} else {
die("ERROR: invalid value for geninfo_intermediate: ".
"'$rc_intermediate'\n");
}
if ($intermediate) {
info("Using intermediate gcov format\n");
if ($opt_derive_func_data) {
warn("WARNING: --derive-func-data is not compatible with ".
"intermediate format - ignoring\n");
$opt_derive_func_data = 0;
}
}
# Determine gcov options # Determine gcov options
$gcov_caps = get_gcov_capabilities();
push(@gcov_options, "-b") if ($gcov_caps->{'branch-probabilities'} && push(@gcov_options, "-b") if ($gcov_caps->{'branch-probabilities'} &&
($br_coverage || $func_coverage)); ($br_coverage || $func_coverage));
push(@gcov_options, "-c") if ($gcov_caps->{'branch-counts'} && push(@gcov_options, "-c") if ($gcov_caps->{'branch-counts'} &&
$br_coverage); $br_coverage);
push(@gcov_options, "-a") if ($gcov_caps->{'all-blocks'} && push(@gcov_options, "-a") if ($gcov_caps->{'all-blocks'} &&
$opt_gcov_all_blocks && $br_coverage); $opt_gcov_all_blocks && $br_coverage &&
push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'}); !$intermediate);
if ($gcov_caps->{'hash-filenames'})
{
push(@gcov_options, "-x");
} else {
push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'});
}
# Determine compatibility modes # Determine compatibility modes
parse_compat_modes($opt_compat); parse_compat_modes($opt_compat);
...@@ -592,7 +631,7 @@ foreach my $entry (@data_directory) { ...@@ -592,7 +631,7 @@ foreach my $entry (@data_directory) {
gen_info($entry); gen_info($entry);
} }
if ($initial && $br_coverage) { if ($initial && $br_coverage && !$intermediate) {
warn("Note: --initial does not generate branch coverage ". warn("Note: --initial does not generate branch coverage ".
"data\n"); "data\n");
} }
...@@ -761,6 +800,7 @@ sub gen_info($) ...@@ -761,6 +800,7 @@ sub gen_info($)
my $prefix; my $prefix;
my $type; my $type;
my $ext; my $ext;
my $tempdir;
if ($initial) { if ($initial) {
$type = "graph"; $type = "graph";
...@@ -791,16 +831,22 @@ sub gen_info($) ...@@ -791,16 +831,22 @@ sub gen_info($)
$prefix = ""; $prefix = "";
} }
$tempdir = tempdir(CLEANUP => 1);
# Process all files in list # Process all files in list
foreach $file (@file_list) { foreach $file (@file_list) {
# Process file # Process file
if ($initial) { if ($intermediate) {
process_intermediate($file, $prefix, $tempdir);
} elsif ($initial) {
process_graphfile($file, $prefix); process_graphfile($file, $prefix);
} else { } else {
process_dafile($file, $prefix); process_dafile($file, $prefix);
} }
} }
unlink($tempdir);
# Report whether files were excluded. # Report whether files were excluded.
if (%excluded_files) { if (%excluded_files) {
info("Excluded data for %d files due to include/exclude options\n", info("Excluded data for %d files due to include/exclude options\n",
...@@ -1051,10 +1097,12 @@ sub process_dafile($$) ...@@ -1051,10 +1097,12 @@ sub process_dafile($$)
# Try to find base directory automatically if requested by user # Try to find base directory automatically if requested by user
if ($rc_auto_base) { if ($rc_auto_base) {
$base_dir = find_base_from_graph($base_dir, $instr, $graph); $base_dir = find_base_from_source($base_dir,
[ keys(%{$instr}), keys(%{$graph}) ]);
} }
($instr, $graph) = adjust_graph_filenames($base_dir, $instr, $graph); adjust_source_filenames($instr, $base_dir);
adjust_source_filenames($graph, $base_dir);
# Set $object_dir to real location of object files. This may differ # Set $object_dir to real location of object files. This may differ
# from $da_dir if the graph file is just a link to the "real" object # from $da_dir if the graph file is just a link to the "real" object
...@@ -1483,7 +1531,9 @@ sub solve_relative_path($$) ...@@ -1483,7 +1531,9 @@ sub solve_relative_path($$)
$result =~ s/\/\//\//g; $result =~ s/\/\//\//g;
# Remove . # Remove .
$result =~ s/\/\.\//\//g; while ($result =~ s/\/\.\//\//g)
{
}
$result =~ s/\/\.$/\//g; $result =~ s/\/\.$/\//g;
# Remove trailing / # Remove trailing /
...@@ -1900,7 +1950,7 @@ sub read_gcov_file($) ...@@ -1900,7 +1950,7 @@ sub read_gcov_file($)
# Also remove CR from line-end # Also remove CR from line-end
s/\015$//; s/\015$//;
if (/^\s*(\d+|\$+):\s*(\d+)-block\s+(\d+)\s*$/) { if (/^\s*(\d+|\$+|\%+):\s*(\d+)-block\s+(\d+)\s*$/) {
# Block information - used to group related # Block information - used to group related
# branches # branches
$last_line = $2; $last_line = $2;
...@@ -1934,6 +1984,9 @@ sub read_gcov_file($) ...@@ -1934,6 +1984,9 @@ sub read_gcov_file($)
{ {
my ($count, $line, $code) = ($1, $2, $3); my ($count, $line, $code) = ($1, $2, $3);
# Skip instance-specific counts
next if ($line <= (scalar(@result) / 3));
$last_line = $line; $last_line = $line;
$last_block = $UNNAMED_BLOCK; $last_block = $UNNAMED_BLOCK;
# Check for exclusion markers # Check for exclusion markers
...@@ -1963,6 +2016,9 @@ sub read_gcov_file($) ...@@ -1963,6 +2016,9 @@ sub read_gcov_file($)
} }
} }
# Strip unexecuted basic block marker
$count =~ s/\*$//;
# <exec count>:<line number>:<source code> # <exec count>:<line number>:<source code>
if ($line eq "0") if ($line eq "0")
{ {
...@@ -2002,6 +2058,453 @@ sub read_gcov_file($) ...@@ -2002,6 +2058,453 @@ sub read_gcov_file($)
} }
#
# read_intermediate_text(gcov_filename, data)
#
# Read gcov intermediate text format in GCOV_FILENAME and add the resulting
# data to DATA in the following format:
#
# data: source_filename -> file_data
# file_data: concatenated lines of intermediate text data
#
sub read_intermediate_text($$)
{
my ($gcov_filename, $data) = @_;
my $fd;
my $filename;
open($fd, "<", $gcov_filename) or
die("ERROR: Could not read $gcov_filename: $!\n");
while (my $line = <$fd>) {
if ($line =~ /^file:(.*)$/) {
$filename = $1;
chomp($filename);
} elsif (defined($filename)) {
$data->{$filename} .= $line;
}
}
close($fd);
}
#
# read_intermediate_json(gcov_filename, data, basedir_ref)
#
# Read gcov intermediate JSON format in GCOV_FILENAME and add the resulting
# data to DATA in the following format:
#
# data: source_filename -> file_data
# file_data: GCOV JSON data for file
#
# Also store the value for current_working_directory to BASEDIR_REF.
#
sub read_intermediate_json($$$)
{
my ($gcov_filename, $data, $basedir_ref) = @_;
my $fd;
my $text;
my $json;
open($fd, "<:gzip", $gcov_filename) or
die("ERROR: Could not read $gcov_filename: $!\n");
local $/;
$text = <$fd>;
close($fd);
$json = decode_json($text);
if (!defined($json) || !exists($json->{"files"}) ||
ref($json->{"files"} ne "ARRAY")) {
die("ERROR: Unrecognized JSON output format in ".
"$gcov_filename\n");
}
$$basedir_ref = $json->{"current_working_directory"};
for my $file (@{$json->{"files"}}) {
my $filename = $file->{"file"};
$data->{$filename} = $file;
}
}
#
# intermediate_text_to_info(fd, data, srcdata)
#
# Write DATA in info format to file descriptor FD.
#
# data: filename -> file_data:
# file_data: concatenated lines of intermediate text data
#
# srcdata: filename -> [ excl, brexcl, checksums ]
# excl: lineno -> 1 for all lines for which to exclude all data
# brexcl: lineno -> 1 for all lines for which to exclude branch data
# checksums: lineno -> source code checksum
#
# Note: To simplify processing, gcov data is not combined here, that is counts
# that appear multiple times for the same lines/branches are not added.
# This is done by lcov/genhtml when reading the data files.
#
sub intermediate_text_to_info($$$)
{
my ($fd, $data, $srcdata) = @_;
my $branch_num = 0;
my $c;
return if (!%{$data});
print($fd "TN:$test_name\n");
for my $filename (keys(%{$data})) {
my ($excl, $brexcl, $checksums);
if (defined($srcdata->{$filename})) {
($excl, $brexcl, $checksums) = @{$srcdata->{$filename}};
}
print($fd "SF:$filename\n");
for my $line (split(/\n/, $data->{$filename})) {
if ($line =~ /^lcount:(\d+),(\d+),?/) {
# lcount:<line>,<count>
# lcount:<line>,<count>,<has_unexecuted_blocks>
if ($checksum && exists($checksums->{$1})) {
$c = ",".$checksums->{$1};
} else {
$c = "";
}
print($fd "DA:$1,$2$c\n") if (!$excl->{$1});
# Intermediate text format does not provide
# branch numbers, and the same branch may appear
# multiple times on the same line (e.g. in
# template instances). Synthesize a branch
# number based on the assumptions:
# a) the order of branches is fixed across
# instances
# b) an instance starts with an lcount line
$branch_num = 0;
} elsif ($line =~ /^function:(\d+),(\d+),([^,]+)$/) {
next if (!$func_coverage || $excl->{$1});
# function:<line>,<count>,<name>
print($fd "FN:$1,$3\n");
print($fd "FNDA:$2,$3\n");
} elsif ($line =~ /^function:(\d+),\d+,(\d+),([^,]+)$/) {
next if (!$func_coverage || $excl->{$1});
# function:<start_line>,<end_line>,<count>,
# <name>
print($fd "FN:$1,$3\n");
print($fd "FNDA:$2,$3\n");
} elsif ($line =~ /^branch:(\d+),(taken|nottaken|notexec)/) {
next if (!$br_coverage || $excl->{$1} ||
$brexcl->{$1});
# branch:<line>,taken|nottaken|notexec
if ($2 eq "taken") {
$c = 1;
} elsif ($2 eq "nottaken") {
$c = 0;
} else {
$c = "-";
}
print($fd "BRDA:$1,0,$branch_num,$c\n");
$branch_num++;
}
}
print($fd "end_of_record\n");
}
}
#
# intermediate_json_to_info(fd, data, srcdata)
#
# Write DATA in info format to file descriptor FD.
#
# data: filename -> file_data:
# file_data: GCOV JSON data for file
#
# srcdata: filename -> [ excl, brexcl, checksums ]
# excl: lineno -> 1 for all lines for which to exclude all data
# brexcl: lineno -> 1 for all lines for which to exclude branch data
# checksums: lineno -> source code checksum
#
# Note: To simplify processing, gcov data is not combined here, that is counts
# that appear multiple times for the same lines/branches are not added.
# This is done by lcov/genhtml when reading the data files.
#
sub intermediate_json_to_info($$$)
{
my ($fd, $data, $srcdata) = @_;
my $branch_num = 0;
return if (!%{$data});
print($fd "TN:$test_name\n");
for my $filename (keys(%{$data})) {
my ($excl, $brexcl, $checksums);
my $file_data = $data->{$filename};
if (defined($srcdata->{$filename})) {
($excl, $brexcl, $checksums) = @{$srcdata->{$filename}};
}
print($fd "SF:$filename\n");
# Function data
if ($func_coverage) {
for my $d (@{$file_data->{"functions"}}) {
my $line = $d->{"start_line"};
my $count = $d->{"execution_count"};
my $name = $d->{"name"};
next if (!defined($line) || !defined($count) ||
!defined($name) || $excl->{$line});
print($fd "FN:$line,$name\n");
print($fd "FNDA:$count,$name\n");
}
}
# Line data
for my $d (@{$file_data->{"lines"}}) {
my $line = $d->{"line_number"};
my $count = $d->{"count"};
my $c;
my $branches = $d->{"branches"};
my $unexec = $d->{"unexecuted_block"};
next if (!defined($line) || !defined($count) ||
$excl->{$line});
if (defined($unexec) && $unexec && $count == 0) {
$unexec = 1;
} else {
$unexec = 0;
}
if ($checksum && exists($checksums->{$line})) {
$c = ",".$checksums->{$line};
} else {
$c = "";
}
print($fd "DA:$line,$count$c\n");
$branch_num = 0;
# Branch data
if ($br_coverage && !$brexcl->{$line}) {
for my $b (@$branches) {
my $brcount = $b->{"count"};
if (!defined($brcount) || $unexec) {
$brcount = "-";
}
print($fd "BRDA:$line,0,$branch_num,".
"$brcount\n");
$branch_num++;
}
}
}
print($fd "end_of_record\n");
}
}
sub get_output_fd($$)
{
my ($outfile, $file) = @_;
my $fd;
if (!defined($outfile)) {
open($fd, ">", "$file.info") or
die("ERROR: Cannot create file $file.info: $!\n");
} elsif ($outfile eq "-") {
open($fd, ">&STDOUT") or
die("ERROR: Cannot duplicate stdout: $!\n");
} else {
open($fd, ">>", $outfile) or
die("ERROR: Cannot write to file $outfile: $!\n");
}
return $fd;
}
#
# print_gcov_warnings(stderr_file, is_graph, map)
#
# Print GCOV warnings in file STDERR_FILE to STDERR. If IS_GRAPH is non-zero,
# suppress warnings about missing as these are expected. Replace keys found
# in MAP with their values.
#
sub print_gcov_warnings($$$)
{
my ($stderr_file, $is_graph, $map) = @_;
my $fd;
if (!open($fd, "<", $stderr_file)) {
warn("WARNING: Could not open GCOV stderr file ".
"$stderr_file: $!\n");
return;
}
while (my $line = <$fd>) {
next if ($is_graph && $line =~ /cannot open data file/);
for my $key (keys(%{$map})) {
$line =~ s/\Q$key\E/$map->{$key}/g;
}
print(STDERR $line);
}
close($fd);
}
#
# process_intermediate(file, dir, tempdir)
#
# Create output for a single file (either a data file or a graph file) using
# gcov's intermediate option.
#
sub process_intermediate($$$)
{
my ($file, $dir, $tempdir) = @_;
my ($fdir, $fbase, $fext);
my $data_file;
my $errmsg;
my %data;
my $fd;
my $base;
my $srcdata;
my $is_graph = 0;
my ($out, $err, $rc);
my $json_basedir;
my $json_format;
info("Processing %s\n", abs2rel($file, $dir));
$file = solve_relative_path($cwd, $file);
($fdir, $fbase, $fext) = split_filename($file);
$is_graph = 1 if (".$fext" eq $graph_file_extension);
if ($is_graph) {
# Process graph file - copy to temp directory to prevent
# accidental processing of associated data file
$data_file = "$tempdir/$fbase$graph_file_extension";
if (!copy($file, $data_file)) {
$errmsg = "ERROR: Could not copy file $file";
goto err;
}
} else {
# Process data file in place
$data_file = $file;
}
# Change directory
if (!chdir($tempdir)) {
$errmsg = "Could not change to directory $tempdir: $!";
goto err;
}
# Run gcov on data file
($out, $err, $rc) = system_no_output(1 + 2 + 4, $gcov_tool,
$data_file, @gcov_options, "-i");
defined($out) && unlink($out);
if (defined($err)) {
print_gcov_warnings($err, $is_graph, {
$data_file => $file,
});
unlink($err);
}
if ($rc) {
$errmsg = "GCOV failed for $file";
goto err;
}
if ($is_graph) {
# Remove graph file copy
unlink($data_file);
}
# Parse resulting file(s)
for my $gcov_filename (glob("*.gcov")) {
read_intermediate_text($gcov_filename, \%data);
unlink($gcov_filename);
}
for my $gcov_filename (glob("*.gcov.json.gz")) {
read_intermediate_json($gcov_filename, \%data, \$json_basedir);
unlink($gcov_filename);
$json_format = 1;
}
if (!%data) {
warn("WARNING: GCOV did not produce any data for $file\n");
return;
}
# Determine base directory
if (defined($base_directory)) {
$base = $base_directory;
} elsif (defined($json_basedir)) {
$base = $json_basedir;
} else {
$base = $fdir;
if (is_compat($COMPAT_MODE_LIBTOOL)) {
# Avoid files from .libs dirs
$base =~ s/\.libs$//;
}
# Try to find base directory automatically if requested by user
if ($rc_auto_base) {
$base = find_base_from_source($base, [ keys(%data) ]);
}
}
# Apply base file name to relative source files
adjust_source_filenames(\%data, $base);
# Remove excluded source files
filter_source_files(\%data);
# Get data on exclusion markers and checksums if requested
if (!$no_markers || $checksum) {
$srcdata = get_all_source_data(keys(%data));
}
# Generate output
$fd = get_output_fd($output_filename, $file);
if ($json_format) {
intermediate_json_to_info($fd, \%data, $srcdata);
} else {
intermediate_text_to_info($fd, \%data, $srcdata);
}
close($fd);
chdir($cwd);
return;
err:
if ($ignore[$ERROR_GCOV]) {
warn("WARNING: $errmsg!\n");
} else {
die("ERROR: $errmsg!\n")
}
}
# Map LLVM versions to the version of GCC gcov which they emulate. # Map LLVM versions to the version of GCC gcov which they emulate.
sub map_llvm_version($) sub map_llvm_version($)
...@@ -2136,8 +2639,12 @@ sub int_handler() ...@@ -2136,8 +2639,12 @@ sub int_handler()
# #
# MODE & 1: suppress STDOUT # MODE & 1: suppress STDOUT
# MODE & 2: suppress STDERR # MODE & 2: suppress STDERR
# MODE & 4: redirect to temporary files instead of suppressing
# #
# Return 0 on success, non-zero otherwise. # Return (stdout, stderr, rc):
# stdout: path to tempfile containing stdout or undef
# stderr: path to tempfile containing stderr or undef
# 0 on success, non-zero otherwise
# #
sub system_no_output($@) sub system_no_output($@)
...@@ -2146,14 +2653,31 @@ sub system_no_output($@) ...@@ -2146,14 +2653,31 @@ sub system_no_output($@)
my $result; my $result;
local *OLD_STDERR; local *OLD_STDERR;
local *OLD_STDOUT; local *OLD_STDOUT;
my $stdout_file;
my $stderr_file;
my $fd;
# Save old stdout and stderr handles # Save old stdout and stderr handles
($mode & 1) && open(OLD_STDOUT, ">>&", "STDOUT"); ($mode & 1) && open(OLD_STDOUT, ">>&", "STDOUT");
($mode & 2) && open(OLD_STDERR, ">>&", "STDERR"); ($mode & 2) && open(OLD_STDERR, ">>&", "STDERR");
# Redirect to /dev/null if ($mode & 4) {
($mode & 1) && open(STDOUT, ">", "/dev/null"); # Redirect to temporary files
($mode & 2) && open(STDERR, ">", "/dev/null"); if ($mode & 1) {
($fd, $stdout_file) = tempfile(UNLINK => 1);
open(STDOUT, ">", $stdout_file) || warn("$!\n");
close($fd);
}
if ($mode & 2) {
($fd, $stderr_file) = tempfile(UNLINK => 1);
open(STDERR, ">", $stderr_file) || warn("$!\n");
close($fd);
}
} else {
# Redirect to /dev/null
($mode & 1) && open(STDOUT, ">", "/dev/null");
($mode & 2) && open(STDERR, ">", "/dev/null");
}
debug("system(".join(' ', @_).")\n"); debug("system(".join(' ', @_).")\n");
system(@_); system(@_);
...@@ -2166,8 +2690,18 @@ sub system_no_output($@) ...@@ -2166,8 +2690,18 @@ sub system_no_output($@)
# Restore old handles # Restore old handles
($mode & 1) && open(STDOUT, ">>&", "OLD_STDOUT"); ($mode & 1) && open(STDOUT, ">>&", "OLD_STDOUT");
($mode & 2) && open(STDERR, ">>&", "OLD_STDERR"); ($mode & 2) && open(STDERR, ">>&", "OLD_STDERR");
# Remove empty output files
if (defined($stdout_file) && -z $stdout_file) {
unlink($stdout_file);
$stdout_file = undef;
}
if (defined($stderr_file) && -z $stderr_file) {
unlink($stderr_file);
$stderr_file = undef;
}
return $result; return ($stdout_file, $stderr_file, $result);
} }
...@@ -2245,23 +2779,28 @@ sub apply_config($) ...@@ -2245,23 +2779,28 @@ sub apply_config($)
# #
# get_exclusion_data(filename) # get_source_data(filename)
# #
# Scan specified source code file for exclusion markers and return # Scan specified source code file for exclusion markers and checksums. Return
# linenumber -> 1 # ( excl, brexcl, checksums ) where
# for all lines which should be excluded. # excl: lineno -> 1 for all lines for which to exclude all data
# brexcl: lineno -> 1 for all lines for which to exclude branch data
# checksums: lineno -> source code checksum
# #
sub get_exclusion_data($) sub get_source_data($)
{ {
my ($filename) = @_; my ($filename) = @_;
my %list; my %list;
my $flag = 0; my $flag = 0;
my %brdata;
my $brflag = 0;
my %checksums;
local *HANDLE; local *HANDLE;
if (!open(HANDLE, "<", $filename)) { if (!open(HANDLE, "<", $filename)) {
warn("WARNING: could not open $filename\n"); warn("WARNING: could not open $filename\n");
return undef; return;
} }
while (<HANDLE>) { while (<HANDLE>) {
if (/$EXCL_STOP/) { if (/$EXCL_STOP/) {
...@@ -2272,14 +2811,62 @@ sub get_exclusion_data($) ...@@ -2272,14 +2811,62 @@ sub get_exclusion_data($)
if (/$excl_line/ || $flag) { if (/$excl_line/ || $flag) {
$list{$.} = 1; $list{$.} = 1;
} }
if (/$EXCL_BR_STOP/) {
$brflag = 0;
} elsif (/$EXCL_BR_START/) {
$brflag = 1;
}
if (/$excl_br_line/ || $brflag) {
$brdata{$.} = 1;
}
if ($checksum) {
chomp();
$checksums{$.} = md5_base64($_);
}
} }
close(HANDLE); close(HANDLE);
if ($flag) { if ($flag || $brflag) {
warn("WARNING: unterminated exclusion section in $filename\n"); warn("WARNING: unterminated exclusion section in $filename\n");
} }
return \%list; return (\%list, \%brdata, \%checksums);
}
#
# get_all_source_data(filenames)
#
# Scan specified source code files for exclusion markers and return
# filename -> [ excl, brexcl, checksums ]
# excl: lineno -> 1 for all lines for which to exclude all data
# brexcl: lineno -> 1 for all lines for which to exclude branch data
# checksums: lineno -> source code checksum
#
sub get_all_source_data(@)
{
my @filenames = @_;
my %data;
my $failed = 0;
for my $filename (@filenames) {
my @d;
next if (exists($data{$filename}));
@d = get_source_data($filename);
if (@d) {
$data{$filename} = [ @d ];
} else {
$failed = 1;
}
}
if ($failed) {
warn("WARNING: some exclusion markers may be ignored\n");
}
return \%data;
} }
...@@ -2303,35 +2890,17 @@ sub apply_exclusion_data($$) ...@@ -2303,35 +2890,17 @@ sub apply_exclusion_data($$)
{ {
my ($instr, $graph) = @_; my ($instr, $graph) = @_;
my $filename; my $filename;
my %excl_data; my $excl_data;
my $excl_read_failed = 0;
# Collect exclusion marker data
foreach $filename (sort_uniq_lex(keys(%{$graph}), keys(%{$instr}))) {
my $excl = get_exclusion_data($filename);
# Skip and note if file could not be read
if (!defined($excl)) {
$excl_read_failed = 1;
next;
}
# Add to collection if there are markers
$excl_data{$filename} = $excl if (keys(%{$excl}) > 0);
}
# Warn if not all source files could be read ($excl_data) = get_all_source_data(keys(%{$graph}), keys(%{$instr}));
if ($excl_read_failed) {
warn("WARNING: some exclusion markers may be ignored\n");
}
# Skip if no markers were found # Skip if no markers were found
return ($instr, $graph) if (keys(%excl_data) == 0); return ($instr, $graph) if (!%$excl_data);
# Apply exclusion marker data to graph # Apply exclusion marker data to graph
foreach $filename (keys(%excl_data)) { foreach $filename (keys(%$excl_data)) {
my $function_data = $graph->{$filename}; my $function_data = $graph->{$filename};
my $excl = $excl_data{$filename}; my $excl = $excl_data->{$filename}->[0];
my $function; my $function;
next if (!defined($function_data)); next if (!defined($function_data));
...@@ -2369,9 +2938,9 @@ sub apply_exclusion_data($$) ...@@ -2369,9 +2938,9 @@ sub apply_exclusion_data($$)
} }
# Apply exclusion marker data to instr # Apply exclusion marker data to instr
foreach $filename (keys(%excl_data)) { foreach $filename (keys(%$excl_data)) {
my $line_data = $instr->{$filename}; my $line_data = $instr->{$filename};
my $excl = $excl_data{$filename}; my $excl = $excl_data->{$filename}->[0];
my $line; my $line;
my @new_data; my @new_data;
...@@ -2453,10 +3022,12 @@ sub process_graphfile($$) ...@@ -2453,10 +3022,12 @@ sub process_graphfile($$)
# Try to find base directory automatically if requested by user # Try to find base directory automatically if requested by user
if ($rc_auto_base) { if ($rc_auto_base) {
$base_dir = find_base_from_graph($base_dir, $instr, $graph); $base_dir = find_base_from_source($base_dir,
[ keys(%{$instr}), keys(%{$graph}) ]);
} }
($instr, $graph) = adjust_graph_filenames($base_dir, $instr, $graph); adjust_source_filenames($instr, $base_dir);
adjust_source_filenames($graph, $base_dir);
if (!$no_markers) { if (!$no_markers) {
# Apply exclusion marker data to graph file data # Apply exclusion marker data to graph file data
...@@ -2752,11 +3323,11 @@ sub parent_dir($) ...@@ -2752,11 +3323,11 @@ sub parent_dir($)
} }
# #
# find_base_from_graph(base_dir, instr, graph) # find_base_from_source(base_dir, source_files)
# #
# Try to determine the base directory of the graph file specified by INSTR # Try to determine the base directory of the object file built from
# and GRAPH. The base directory is the base for all relative filenames in # SOURCE_FILES. The base directory is the base for all relative filenames in
# the graph file. It is defined by the current working directory at time # the gcov data. It is defined by the current working directory at time
# of compiling the source file. # of compiling the source file.
# #
# This function implements a heuristic which relies on the following # This function implements a heuristic which relies on the following
...@@ -2766,16 +3337,16 @@ sub parent_dir($) ...@@ -2766,16 +3337,16 @@ sub parent_dir($)
# - files by the same name are not present in multiple parent directories # - files by the same name are not present in multiple parent directories
# #
sub find_base_from_graph($$$) sub find_base_from_source($$)
{ {
my ($base_dir, $instr, $graph) = @_; my ($base_dir, $source_files) = @_;
my $old_base; my $old_base;
my $best_miss; my $best_miss;
my $best_base; my $best_base;
my %rel_files; my %rel_files;
# Determine list of relative paths # Determine list of relative paths
foreach my $filename (keys(%{$instr}), keys(%{$graph})) { foreach my $filename (@$source_files) {
next if (file_name_is_absolute($filename)); next if (file_name_is_absolute($filename));
$rel_files{$filename} = 1; $rel_files{$filename} = 1;
...@@ -2814,17 +3385,17 @@ sub find_base_from_graph($$$) ...@@ -2814,17 +3385,17 @@ sub find_base_from_graph($$$)
} }
# #
# adjust_graph_filenames(base_dir, instr, graph) # adjust_source_filenames(hash, base_dir)
# #
# Make relative paths in INSTR and GRAPH absolute and apply # Transform all keys of HASH to absolute form and apply requested
# geninfo_adjust_src_path setting to graph file data. # transformations.
# #
sub adjust_graph_filenames($$$) sub adjust_source_filenames($$$)
{ {
my ($base_dir, $instr, $graph) = @_; my ($hash, $base_dir) = @_;
foreach my $filename (keys(%{$instr})) { foreach my $filename (keys(%{$hash})) {
my $old_filename = $filename; my $old_filename = $filename;
# Convert to absolute canonical form # Convert to absolute canonical form
...@@ -2836,28 +3407,50 @@ sub adjust_graph_filenames($$$) ...@@ -2836,28 +3407,50 @@ sub adjust_graph_filenames($$$)
} }
if ($filename ne $old_filename) { if ($filename ne $old_filename) {
$instr->{$filename} = delete($instr->{$old_filename}); $hash->{$filename} = delete($hash->{$old_filename});
} }
} }
}
foreach my $filename (keys(%{$graph})) {
my $old_filename = $filename;
# Make absolute #
# Convert to absolute canonical form # filter_source_files(hash)
$filename = solve_relative_path($base_dir, $filename); #
# Remove unwanted source file data from HASH.
#
# Apply adjustment sub filter_source_files($)
if (defined($adjust_src_pattern)) { {
$filename =~ s/$adjust_src_pattern/$adjust_src_replace/g; my ($hash) = @_;
foreach my $filename (keys(%{$hash})) {
# Skip external files if requested
goto del if (!$opt_external && is_external($filename));
# Apply include patterns
if (@include_patterns) {
my $keep;
foreach my $pattern (@include_patterns) {
if ($filename =~ (/^$pattern$/)) {
$keep = 1;
last;
}
}
goto del if (!$keep);
} }
if ($filename ne $old_filename) { # Apply exclude patterns
$graph->{$filename} = delete($graph->{$old_filename}); foreach my $pattern (@exclude_patterns) {
goto del if ($filename =~ (/^$pattern$/));
} }
} next;
return ($instr, $graph); del:
# Remove file data
delete($hash->{$filename});
$excluded_files{$filename} = 1;
}
} }
# #
...@@ -2943,9 +3536,13 @@ sub graph_find_base($) ...@@ -2943,9 +3536,13 @@ sub graph_find_base($)
} }
# #
# graph_from_bb(bb, fileorder, bb_filename) # graph_from_bb(bb, fileorder, bb_filename, fileorder_first)
# #
# Convert data from bb to the graph format and list of instrumented lines. # Convert data from bb to the graph format and list of instrumented lines.
#
# If FILEORDER_FIRST is set, use fileorder data to determine a functions
# base source file.
#
# Returns (instr, graph). # Returns (instr, graph).
# #
# bb : function name -> file data # bb : function name -> file data
...@@ -2963,9 +3560,9 @@ sub graph_find_base($) ...@@ -2963,9 +3560,9 @@ sub graph_find_base($)
# line data : [ line1, line2, ... ] # line data : [ line1, line2, ... ]
# #
sub graph_from_bb($$$) sub graph_from_bb($$$$)
{ {
my ($bb, $fileorder, $bb_filename) = @_; my ($bb, $fileorder, $bb_filename, $fileorder_first) = @_;
my $graph = {}; my $graph = {};
my $instr = {}; my $instr = {};
my $basefile; my $basefile;
...@@ -2982,7 +3579,8 @@ sub graph_from_bb($$$) ...@@ -2982,7 +3579,8 @@ sub graph_from_bb($$$)
$order = $fileorder->{$func}; $order = $fileorder->{$func};
# Account for lines in functions # Account for lines in functions
if (defined($basefile) && defined($filedata->{$basefile})) { if (defined($basefile) && defined($filedata->{$basefile}) &&
!$fileorder_first) {
# If the basefile contributes to this function, # If the basefile contributes to this function,
# account this function to the basefile. # account this function to the basefile.
$graph->{$basefile}->{$func} = $filedata->{$basefile}; $graph->{$basefile}->{$func} = $filedata->{$basefile};
...@@ -3144,7 +3742,8 @@ sub read_bb($) ...@@ -3144,7 +3742,8 @@ sub read_bb($)
} }
} }
close(HANDLE); close(HANDLE);
($instr, $graph) = graph_from_bb($bb, $fileorder, $bb_filename);
($instr, $graph) = graph_from_bb($bb, $fileorder, $bb_filename, 0);
graph_cleanup($graph); graph_cleanup($graph);
return ($instr, $graph); return ($instr, $graph);
...@@ -3332,7 +3931,8 @@ sub read_bbg($) ...@@ -3332,7 +3931,8 @@ sub read_bbg($)
} }
} }
close(HANDLE); close(HANDLE);
($instr, $graph) = graph_from_bb($bb, $fileorder, $bbg_filename); ($instr, $graph) = graph_from_bb($bb, $fileorder, $bbg_filename, 0);
graph_cleanup($graph); graph_cleanup($graph);
return ($instr, $graph); return ($instr, $graph);
...@@ -3510,7 +4110,7 @@ sub determine_gcno_split_crc($$$$) ...@@ -3510,7 +4110,7 @@ sub determine_gcno_split_crc($$$$)
# read_gcno_function_record(handle, graph, big_endian, rec_length, version) # read_gcno_function_record(handle, graph, big_endian, rec_length, version)
# #
# Read a gcno format function record from handle and add the relevant data # Read a gcno format function record from handle and add the relevant data
# to graph. Return (filename, function) on success, undef on error. # to graph. Return (filename, function, artificial) on success, undef on error.
# #
sub read_gcno_function_record(*$$$$$) sub read_gcno_function_record(*$$$$$)
...@@ -3520,6 +4120,7 @@ sub read_gcno_function_record(*$$$$$) ...@@ -3520,6 +4120,7 @@ sub read_gcno_function_record(*$$$$$)
my $function; my $function;
my $lineno; my $lineno;
my $lines; my $lines;
my $artificial;
graph_expect("function record"); graph_expect("function record");
# Skip ident and checksum # Skip ident and checksum
...@@ -3537,6 +4138,11 @@ sub read_gcno_function_record(*$$$$$) ...@@ -3537,6 +4138,11 @@ sub read_gcno_function_record(*$$$$$)
graph_expect("function name"); graph_expect("function name");
$function = read_gcno_string($handle, $big_endian); $function = read_gcno_string($handle, $big_endian);
return undef if (!defined($function)); return undef if (!defined($function));
if ($version >= $GCOV_VERSION_8_0_0) {
$artificial = read_gcno_value($handle, $big_endian,
"compiler-generated entity flag");
return undef if (!defined($artificial));
}
# Read filename # Read filename
graph_expect("filename"); graph_expect("filename");
$filename = read_gcno_string($handle, $big_endian); $filename = read_gcno_string($handle, $big_endian);
...@@ -3544,11 +4150,16 @@ sub read_gcno_function_record(*$$$$$) ...@@ -3544,11 +4150,16 @@ sub read_gcno_function_record(*$$$$$)
# Read first line number # Read first line number
$lineno = read_gcno_value($handle, $big_endian, "initial line number"); $lineno = read_gcno_value($handle, $big_endian, "initial line number");
return undef if (!defined($lineno)); return undef if (!defined($lineno));
# Skip column and ending line number
if ($version >= $GCOV_VERSION_8_0_0) {
graph_skip($handle, 4, "column number") or return undef;
graph_skip($handle, 4, "ending line number") or return undef;
}
# Add to list # Add to list
push(@{$bb->{$function}->{$filename}}, $lineno); push(@{$bb->{$function}->{$filename}}, $lineno);
graph_add_order($fileorder, $function, $filename); graph_add_order($fileorder, $function, $filename);
return ($filename, $function); return ($filename, $function, $artificial);
} }
# #
...@@ -3578,6 +4189,15 @@ sub map_gcno_version($) ...@@ -3578,6 +4189,15 @@ sub map_gcno_version($)
return $major << 16 | $minor << 8; return $major << 16 | $minor << 8;
} }
sub remove_fn_from_hash($$)
{
my ($hash, $fns) = @_;
foreach my $fn (@$fns) {
delete($hash->{$fn});
}
}
# #
# read_gcno(filename) # read_gcno(filename)
# #
...@@ -3609,6 +4229,8 @@ sub read_gcno($) ...@@ -3609,6 +4229,8 @@ sub read_gcno($)
my $graph; my $graph;
my $filelength; my $filelength;
my $version; my $version;
my $artificial;
my @artificial_fns;
local *HANDLE; local *HANDLE;
open(HANDLE, "<", $gcno_filename) or goto open_error; open(HANDLE, "<", $gcno_filename) or goto open_error;
...@@ -3631,6 +4253,10 @@ sub read_gcno($) ...@@ -3631,6 +4253,10 @@ sub read_gcno($)
debug(sprintf("found version 0x%08x\n", $version)); debug(sprintf("found version 0x%08x\n", $version));
# Skip stamp # Skip stamp
graph_skip(*HANDLE, 4, "file timestamp") or goto incomplete; graph_skip(*HANDLE, 4, "file timestamp") or goto incomplete;
if ($version >= $GCOV_VERSION_8_0_0) {
graph_skip(*HANDLE, 4, "support unexecuted blocks flag")
or goto incomplete;
}
while (!eof(HANDLE)) { while (!eof(HANDLE)) {
my $next_pos; my $next_pos;
my $curr_pos; my $curr_pos;
...@@ -3658,16 +4284,17 @@ sub read_gcno($) ...@@ -3658,16 +4284,17 @@ sub read_gcno($)
} }
# Process record # Process record
if ($tag == $tag_function) { if ($tag == $tag_function) {
($filename, $function) = read_gcno_function_record( ($filename, $function, $artificial) =
read_gcno_function_record(
*HANDLE, $bb, $fileorder, $big_endian, *HANDLE, $bb, $fileorder, $big_endian,
$length, $version); $length, $version);
goto incomplete if (!defined($function)); goto incomplete if (!defined($function));
push(@artificial_fns, $function) if ($artificial);
} elsif ($tag == $tag_lines) { } elsif ($tag == $tag_lines) {
# Read lines record # Read lines record
$filename = read_gcno_lines_record(*HANDLE, $filename = read_gcno_lines_record(*HANDLE,
$gcno_filename, $bb, $fileorder, $gcno_filename, $bb, $fileorder,
$filename, $function, $filename, $function, $big_endian);
$big_endian);
goto incomplete if (!defined($filename)); goto incomplete if (!defined($filename));
} else { } else {
# Skip record contents # Skip record contents
...@@ -3684,7 +4311,12 @@ sub read_gcno($) ...@@ -3684,7 +4311,12 @@ sub read_gcno($)
or goto incomplete; or goto incomplete;
} }
close(HANDLE); close(HANDLE);
($instr, $graph) = graph_from_bb($bb, $fileorder, $gcno_filename);
# Remove artificial functions from result data
remove_fn_from_hash($bb, \@artificial_fns);
remove_fn_from_hash($fileorder, \@artificial_fns);
($instr, $graph) = graph_from_bb($bb, $fileorder, $gcno_filename, 1);
graph_cleanup($graph); graph_cleanup($graph);
return ($instr, $graph); return ($instr, $graph);
...@@ -3730,12 +4362,14 @@ sub get_gcov_capabilities() ...@@ -3730,12 +4362,14 @@ sub get_gcov_capabilities()
'c' => 'branch-counts', 'c' => 'branch-counts',
'f' => 'function-summaries', 'f' => 'function-summaries',
'h' => 'help', 'h' => 'help',
'i' => 'intermediate-format',
'l' => 'long-file-names', 'l' => 'long-file-names',
'n' => 'no-output', 'n' => 'no-output',
'o' => 'object-directory', 'o' => 'object-directory',
'p' => 'preserve-paths', 'p' => 'preserve-paths',
'u' => 'unconditional-branches', 'u' => 'unconditional-branches',
'v' => 'version', 'v' => 'version',
'x' => 'hash-filenames',
); );
foreach (split(/\n/, $help)) { foreach (split(/\n/, $help)) {
......
#!/usr/bin/perl -w #!/usr/bin/env perl
# #
# Copyright (c) International Business Machines Corp., 2002 # Copyright (c) International Business Machines Corp., 2002
# #
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
# #
use strict; use strict;
use warnings;
use File::Basename; use File::Basename;
use Getopt::Long; use Getopt::Long;
use Cwd qw/abs_path/; use Cwd qw/abs_path/;
......
#!/bin/bash #!/usr/bin/env bash
# #
# Usage: get_changes.sh # Usage: get_changes.sh
# #
# Print lcov change log information as provided by Git # Print lcov change log information as provided by Git
TOOLDIR=$(cd $(dirname $0) ; pwd) TOOLDIR=$(cd $(dirname $0) >/dev/null ; pwd)
cd $TOOLDIR cd $TOOLDIR
......
#!/bin/bash #!/usr/bin/env bash
# #
# Usage: get_version.sh --version|--release|--full # Usage: get_version.sh --version|--release|--full
# #
# Print lcov version or release information as provided by Git, .version # Print lcov version or release information as provided by Git, .version
# or a fallback. # or a fallback.
TOOLDIR=$(cd $(dirname $0) ; pwd) TOOLDIR=$(cd $(dirname $0) >/dev/null ; pwd)
GITVER=$(cd $TOOLDIR ; git describe --tags 2>/dev/null) GITVER=$(cd $TOOLDIR ; git describe --tags 2>/dev/null)
if [ -z "$GITVER" ] ; then if [ -z "$GITVER" ] ; then
......
#!/bin/bash #!/usr/bin/env bash
# #
# install.sh [--uninstall] sourcefile targetfile [install options] # install.sh [--uninstall] sourcefile targetfile [install options]
# #
...@@ -36,6 +36,10 @@ do_install() ...@@ -36,6 +36,10 @@ do_install()
install -d $(dirname $TARGET) install -d $(dirname $TARGET)
install -p $PARAMS $SOURCE $TARGET install -p $PARAMS $SOURCE $TARGET
if [ -n "$LCOV_PERL_PATH" ] ; then
# Replace Perl interpreter specification
sed -e "1 s%^#\!.*perl.*$%#\!$LCOV_PERL_PATH%" -i $TARGET
fi
} }
...@@ -51,7 +55,7 @@ do_uninstall() ...@@ -51,7 +55,7 @@ do_uninstall()
# Does target exist? # Does target exist?
if test -r $TARGET ; then if test -r $TARGET ; then
# Is target of the same version as this package? # Is target of the same version as this package?
if diff -I '^our \$lcov_version' -I '^\.TH ' $SOURCE $TARGET >/dev/null; then if diff -I '^our \$lcov_version' -I '^\.TH ' -I '^#!' $SOURCE $TARGET >/dev/null; then
rm -f $TARGET rm -f $TARGET
else else
echo WARNING: Skipping uninstall for $TARGET - versions differ! >&2 echo WARNING: Skipping uninstall for $TARGET - versions differ! >&2
......
#!/usr/bin/perl -w #!/usr/bin/env perl
# #
# Copyright (c) International Business Machines Corp., 2002,2012 # Copyright (c) International Business Machines Corp., 2002,2012
# #
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
# #
use strict; use strict;
use warnings;
use File::Basename; use File::Basename;
use File::Path; use File::Path;
use File::Find; use File::Find;
...@@ -2153,7 +2154,7 @@ sub brcount_to_db($) ...@@ -2153,7 +2154,7 @@ sub brcount_to_db($)
{ {
my ($brcount) = @_; my ($brcount) = @_;
my $line; my $line;
my $db; my $db = {};
# Add branches to database # Add branches to database
foreach $line (keys(%{$brcount})) { foreach $line (keys(%{$brcount})) {
......
#!/usr/bin/perl -w #!/usr/bin/env perl
use strict; use strict;
use warnings;
use File::Basename; use File::Basename;
......
...@@ -96,6 +96,9 @@ genhtml_desc_html=0 ...@@ -96,6 +96,9 @@ genhtml_desc_html=0
# Specify the precision for coverage rates # Specify the precision for coverage rates
#genhtml_precision=1 #genhtml_precision=1
# Show missed counts instead of hit counts
#genhtml_missed=1
# Demangle C++ symbols # Demangle C++ symbols
#genhtml_demangle_cpp=1 #genhtml_demangle_cpp=1
...@@ -131,6 +134,9 @@ genhtml_desc_html=0 ...@@ -131,6 +134,9 @@ genhtml_desc_html=0
# when collecting coverage data. # when collecting coverage data.
geninfo_auto_base = 1 geninfo_auto_base = 1
# Use gcov intermediate format? Valid values are 0, 1, auto
geninfo_intermediate = auto
# Directory containing gcov kernel files # Directory containing gcov kernel files
# lcov_gcov_dir = /proc/gcov # lcov_gcov_dir = /proc/gcov
......
.TH gendesc 1 "LCOV 1.13" 2015\-10\-05 "User Manuals" .TH gendesc 1 "LCOV 1.14" 2016\-12\-19 "User Manuals"
.SH NAME .SH NAME
gendesc \- Generate a test case description file gendesc \- Generate a test case description file
.SH SYNOPSIS .SH SYNOPSIS
......
.TH genhtml 1 "LCOV 1.13" 2015\-10\-05 "User Manuals" .TH genhtml 1 "LCOV 1.14" 2018\-01\-30 "User Manuals"
.SH NAME .SH NAME
genhtml \- Generate HTML view from LCOV coverage data files genhtml \- Generate HTML view from LCOV coverage data files
.SH SYNOPSIS .SH SYNOPSIS
...@@ -66,6 +66,7 @@ genhtml \- Generate HTML view from LCOV coverage data files ...@@ -66,6 +66,7 @@ genhtml \- Generate HTML view from LCOV coverage data files
.br .br
.RB [ \-\-precision .RB [ \-\-precision
.IR num ] .IR num ]
.RB [ \-\-missed ]
.br .br
.IR tracefile(s) .IR tracefile(s)
.RE .RE
...@@ -561,6 +562,21 @@ option ...@@ -561,6 +562,21 @@ option
.IR genhtml_precision . .IR genhtml_precision .
.RE .RE
.B \-\-missed
.RS
Show counts of missed lines, functions, or branches
Use this option to change overview pages to show the count of lines, functions,
or branches that were not hit. These counts are represented by negative numbers.
When specified together with \-\-sort, file and directory views will be sorted
by missed counts.
This option can also be configured permanently using the configuration file
option
.IR genhtml_missed .
.RE
.SH FILES .SH FILES
.I /etc/lcovrc .I /etc/lcovrc
......
.TH geninfo 1 "LCOV 1.13" 2015\-10\-05 "User Manuals" .TH geninfo 1 "LCOV 1.14" 2017\-10\-10 "User Manuals"
.SH NAME .SH NAME
geninfo \- Generate tracefiles from .da files geninfo \- Generate tracefiles from .da files
.SH SYNOPSIS .SH SYNOPSIS
......
.TH genpng 1 "LCOV 1.13" 2015\-10\-05 "User Manuals" .TH genpng 1 "LCOV 1.14" 2016\-12\-19 "User Manuals"
.SH NAME .SH NAME
genpng \- Generate an overview image from a source file genpng \- Generate an overview image from a source file
.SH SYNOPSIS .SH SYNOPSIS
......
.TH lcov 1 "LCOV 1.13" 2015\-10\-05 "User Manuals" .TH lcov 1 "LCOV 1.14" 2017\-10\-10 "User Manuals"
.SH NAME .SH NAME
lcov \- a graphical GCOV front\-end lcov \- a graphical GCOV front\-end
.SH SYNOPSIS .SH SYNOPSIS
......
.TH lcovrc 5 "LCOV 1.13" 2015\-10\-05 "User Manuals" .TH lcovrc 5 "LCOV 1.14" 2018\-01\-30 "User Manuals"
.SH NAME .SH NAME
lcovrc \- lcov configuration file lcovrc \- lcov configuration file
...@@ -159,6 +159,11 @@ genhtml_desc_html=0 ...@@ -159,6 +159,11 @@ genhtml_desc_html=0
#genhtml_precision=1 #genhtml_precision=1
.br .br
# Show missed counts instead of hit counts
.br
#genhtml_missed=1
.br
# Demangle C++ symbols # Demangle C++ symbols
.br .br
#genhtml_demangle_cpp=1 #genhtml_demangle_cpp=1
...@@ -218,6 +223,11 @@ geninfo_compat_libtool = 0 ...@@ -218,6 +223,11 @@ geninfo_compat_libtool = 0
geninfo_auto_base = 1 geninfo_auto_base = 1
.br .br
# Use gcov intermediate format? Valid values are 0, 1, auto
.br
geninfo_intermediate = auto
.br
# Directory containing gcov kernel files # Directory containing gcov kernel files
.br .br
lcov_gcov_dir = /proc/gcov lcov_gcov_dir = /proc/gcov
...@@ -604,6 +614,16 @@ displaying coverage rates. ...@@ -604,6 +614,16 @@ displaying coverage rates.
Default is 1. Default is 1.
.PP .PP
.BR genhtml_missed " ="
.IR 0 | 1
.IP
If non-zero, the count of missed lines, functions, or branches is shown
as negative numbers in overview pages.
.br
Default is 0.
.PP
. .
.BR geninfo_gcov_tool " =" .BR geninfo_gcov_tool " ="
.I path_to_gcov .I path_to_gcov
...@@ -774,6 +794,25 @@ located, and in addition, is different between files of the same project. ...@@ -774,6 +794,25 @@ located, and in addition, is different between files of the same project.
Default is 1. Default is 1.
.PP .PP
.BR geninfo_intermediate " ="
.IR 0 | 1 | auto
.IP
Specify whether to use gcov intermediate format
.br
Use this option to control whether geninfo should use the gcov intermediate
format while collecting coverage data. The use of the gcov intermediate format
should increase processing speed. It also provides branch coverage data when
using the \-\-initial command line option.
.br
Valid values are 0 for off, 1 for on, and "auto" to let geninfo automatically
use immediate format when supported by gcov.
.br
Default is "auto".
.PP
.BR lcov_gcov_dir " =" .BR lcov_gcov_dir " ="
.I path_to_kernel_coverage_data .I path_to_kernel_coverage_data
.IP .IP
......
Summary: A graphical GCOV front-end Summary: A graphical GCOV front-end
Name: lcov Name: lcov
Version: 1.13 Version: 1.14
Release: 1 Release: 1
License: GPLv2+ License: GPLv2+
Group: Development/Tools Group: Development/Tools
......
#!/usr/bin/perl #!/usr/bin/env perl
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/usr/bin/perl #!/usr/bin/env perl
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/bin/bash #!/usr/bin/env bash
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
#!/usr/bin/perl #!/usr/bin/env perl
# #
# Copyright IBM Corp. 2017 # Copyright IBM Corp. 2017
# #
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论