Skip to content

Commit ef26ead

Browse files
committed
Bugfix: propagate function exclusion count from child process, fix link to first TLA line in 'file table' flat view.
Signed-off-by: Henry Cox <[email protected]>
1 parent f9b1561 commit ef26ead

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

bin/genhtml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3836,7 +3836,9 @@ sub new
38363836
defined($lne->differential_function()));
38373837
}
38383838
if (defined($main::show_dateBins) &&
3839-
!$self->isProjectFile()) {
3839+
%$lineCovData && # haven't filtered out everything
3840+
!$self->isProjectFile()
3841+
) {
38403842
lcovutil::info("no owner/date info for '$filepath'\n");
38413843
}
38423844
return $self;
@@ -8309,6 +8311,10 @@ sub write_file_table_entry(*$$@)
83098311
$primary_key ne 'name' &&
83108312
defined($file_link) &&
83118313
$file_link ne "") {
8314+
if ($main::flat) {
8315+
$file_link =
8316+
File::Spec->catfile($fileSummary->relativeDir(), $file_link);
8317+
}
83128318
$namecode =
83138319
"<a href=\"$file_link\" title=\"Click to go to $full_path source detail\">"
83148320
. $obj_name . "</a>";

lib/lcovutil.pm

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,8 @@ sub initial_state
16551655
foreach my $patType (\@lcovutil::exclude_file_patterns,
16561656
\@lcovutil::include_file_patterns,
16571657
\@lcovutil::file_subst_patterns,
1658-
\@omit_line_patterns
1658+
\@lcovutil::omit_line_patterns,
1659+
\@lcovutil::exclude_function_patterns
16591660
) {
16601661
foreach my $p (@$patType) {
16611662
$p->[-1] = 0;
@@ -1696,7 +1697,8 @@ sub compute_update
16961697
foreach my $patType (\@lcovutil::exclude_file_patterns,
16971698
\@lcovutil::include_file_patterns,
16981699
\@lcovutil::file_subst_patterns,
1699-
\@omit_line_patterns
1700+
\@lcovutil::omit_line_patterns,
1701+
\@lcovutil::exclude_function_patterns
17001702
) {
17011703
my @count;
17021704
foreach my $p (@$patType) {
@@ -1751,7 +1753,8 @@ sub update_state
17511753
foreach my $patType (\@lcovutil::exclude_file_patterns,
17521754
\@lcovutil::include_file_patterns,
17531755
\@lcovutil::file_subst_patterns,
1754-
\@omit_line_patterns
1756+
\@lcovutil::omit_line_patterns,
1757+
\@lcovutil::exclude_function_patterns
17551758
) {
17561759
my $count = shift;
17571760
die("unexpected pattern count") unless $#$count == $#$patType;
@@ -1976,7 +1979,8 @@ sub is_filter_enabled
19761979
|| defined($lcovutil::cov_filter[$lcovutil::FILTER_EXCLUDE_BRANCH])
19771980
|| defined(
19781981
$lcovutil::cov_filter[$lcovutil::FILTER_TRIVIAL_FUNCTION]) ||
1979-
0 != scalar(@lcovutil::omit_line_patterns));
1982+
0 != scalar(@lcovutil::omit_line_patterns) ||
1983+
0 != scalar(@lcovutil::exclude_function_patterns));
19801984
}
19811985

19821986
sub parse_cov_filters(@)
@@ -2022,18 +2026,22 @@ sub summarize_cov_filters
20222026
"\n " . $histogram->[1] . " coverpoint" .
20232027
($histogram->[1] > 1 ? "s" : "") . "\n");
20242028
}
2025-
my $patternCount = scalar(@omit_line_patterns);
2026-
if ($patternCount) {
2027-
my $omitCount = 0;
2028-
foreach my $p (@omit_line_patterns) {
2029-
$omitCount += $p->[-1];
2029+
foreach my $q (['omit-lines', 'line', \@omit_line_patterns],
2030+
['erase-functions', 'function', \@exclude_function_patterns]) {
2031+
my ($opt, $type, $patterns) = @$q;
2032+
my $patternCount = scalar(@$patterns);
2033+
if ($patternCount) {
2034+
my $omitCount = 0;
2035+
foreach my $p (@$patterns) {
2036+
$omitCount += $p->[-1];
2037+
}
2038+
info(-1,
2039+
"Omitted %d total $type%s matching %d '--$opt' pattern%s\n",
2040+
$omitCount,
2041+
$omitCount == 1 ? '' : 's',
2042+
$patternCount,
2043+
$patternCount == 1 ? '' : 's');
20302044
}
2031-
info(-1,
2032-
"Omitted %d total line%s matching %d '--omit-lines' pattern%s\n",
2033-
$omitCount,
2034-
$omitCount == 1 ? '' : 's',
2035-
$patternCount,
2036-
$patternCount == 1 ? '' : 's');
20372045
}
20382046
}
20392047

@@ -2055,7 +2063,7 @@ sub reenable_cov_filters
20552063
{
20562064
my $data = shift;
20572065
my $filters = $data->[0];
2058-
# disable but return current status - so the can be re-enabled
2066+
# re-enable in the same order
20592067
for (my $i = 0; $i < scalar(@$filters); $i++) {
20602068
$cov_filter[$i] = $filters->[$i];
20612069
}
@@ -5843,8 +5851,11 @@ sub _mergeParallelChunk
58435851
my $now = Time::HiRes::gettimeofday();
58445852
$lcovutil::profileData{filt_undump}{$chunkId} = $now - $start;
58455853

5846-
for (my $i = scalar(@{$store->[0]}) - 1; $i >= 0; --$i) {
5847-
$store->[0]->[$i]->[-1] += $save->[0]->[$i];
5854+
foreach my $patType (@{$store->[0]}) {
5855+
my $svType = shift(@{$save->[0]});
5856+
foreach my $p (@$patType) {
5857+
$p->[-1] += shift(@$svType);
5858+
}
58485859
}
58495860
for (my $i = scalar(@{$store->[1]}) - 1; $i >= 0; --$i) {
58505861
$store->[1]->[$i]->[-2] += $save->[1]->[$i]->[0];
@@ -5869,9 +5880,9 @@ sub _mergeParallelChunk
58695880
}
58705881
} else {
58715882
lcovutil::report_parallel_error('filter',
5872-
$ERROR_PARALLEL, $child, $childstatus,
5873-
"serialized data '$dumped' not presetnt",
5874-
, keys(%$children));
5883+
$ERROR_PARALLEL, $child, $childstatus,
5884+
"serialized data '$dumped' not present",
5885+
, keys(%$children));
58755886
}
58765887

58775888
foreach my $f ($dumped) {
@@ -5960,11 +5971,12 @@ sub _processParallelChunk
59605971
};
59615972
my $end = Time::HiRes::gettimeofday();
59625973
# collect pattern counts
5974+
my @pcounts;
59635975
foreach my $l (@{$save->[0]}) {
5964-
foreach my $p (@$l) {
5965-
$p = $p->[-1];
5966-
}
5976+
my @c = map({ $_->[-1] } @$l); # grap the counts
5977+
push(@pcounts, \@c);
59675978
}
5979+
$save->[0] = \@pcounts;
59685980
# filter counts
59695981
foreach my $f (@{$save->[1]}) {
59705982
$f = [$f->[-2], $f->[-1]];
@@ -5981,7 +5993,6 @@ sub _processParallelChunk
59815993
my $h = $f->hdl();
59825994
print($h $d->[1]);
59835995
}
5984-
my @counts;
59855996
my $dumpf = File::Spec->catfile($tmp, "dumper_$$");
59865997
my $then = Time::HiRes::gettimeofday();
59875998
$lcovutil::profileData{filt_proc}{$chunkId} = $then - $forkAt;
@@ -5995,7 +6006,7 @@ sub _processParallelChunk
59956006
};
59966007
if ($@) {
59976008
lcovutil::ignorable_error($lcovutil::ERROR_PARALLEL,
5998-
"Child $$ serialize failed: $!");
6009+
"Child $$ serialize failed: $@");
59996010
}
60006011
return $status;
60016012
}

0 commit comments

Comments
 (0)