Skip to content

Commit ceae745

Browse files
authored
MC/DC count in summary tables. (#440)
Signed-off-by: Henry Cox <[email protected]>
1 parent b6a0b6e commit ceae745

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

bin/genhtml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ sub append
973973
$record->branchCovCount($key, "age", $ageval));
974974
} elsif ($covType == MCDC_DATA) {
975975
$self->mcdcCovCount($key, "age", $ageval,
976-
$record->branchCovCount($key, "age", $ageval));
976+
$record->mcdcCovCount($key, "age", $ageval));
977977
} else {
978978
$self->functionCovCount($key, 'age', $ageval,
979979
$record->functionCovCount($key, "age", $ageval));
@@ -4773,7 +4773,7 @@ sub _countMcdcTlaData
47734773
$developer = $srcLine->owner();
47744774

47754775
if (defined($developer)) {
4776-
my $shash = $self->[BRANCH_OWNERS];
4776+
my $shash = $self->[MCDC_OWNERS];
47774777
if (!exists($shash->{$developer})) {
47784778
$shash->{$developer} = {};
47794779
$shash->{$developer}->{lines} = [];
@@ -5822,7 +5822,7 @@ sub new
58225822
# use 'current' count...
58235823
my ($tla, $b_count, $c_count) =
58245824
@{$expr->count($sense)};
5825-
die("unexpected branch TLA $tla for count $c_count at "
5825+
die("unexpected MC/DC TLA $tla for count $c_count at "
58265826
. $fileDetails->path()
58275827
. ":$line")
58285828
unless (
@@ -11719,8 +11719,17 @@ sub buildOwnerSummaryTable($$$$$$$$$$)
1171911719
my $first = 1;
1172011720
# owners are sorted from most uncovered lines to least
1172111721
foreach my $od (@$ownerList) {
11722-
my ($name, $lineData, $branchData) = @$od;
11723-
my $d = ($covType == SummaryInfo::LINE_DATA) ? $lineData : $branchData;
11722+
my ($name, $lineData, $branchData, $funcData, $mcdcData) = @$od;
11723+
my $d;
11724+
if ($covType == SummaryInfo::LINE_DATA) {
11725+
$d = $lineData;
11726+
} elsif ($covType == SummaryInfo::BRANCH_DATA) {
11727+
$d = $branchData;
11728+
} else {
11729+
die("unexpected type '$covType'")
11730+
unless ($covType == SummaryInfo::MCDC_DATA);
11731+
$d = $mcdcData;
11732+
}
1172411733
my ($missed, $found) = @$d;
1172511734

1172611735
# only put user in table if they are responsible for at least one point
@@ -12337,8 +12346,8 @@ END_OF_HTML
1233712346
if ($main::show_tla) {
1233812347
my @tlaRow =
1233912348
buildHeaderSummaryTableRow($summary, SummaryInfo::MCDC_DATA,
12340-
$fileDetail, \&SourceFile::nextBranchTlaGroup,
12341-
$tlaSummaryTypes);
12349+
$fileDetail, \&SourceFile::nextMcdcTlaGroup,
12350+
$tlaSummaryTypes);
1234212351
push(@dataRow, @tlaRow);
1234312352
}
1234412353
push(@row_right, \@dataRow)
@@ -12457,7 +12466,7 @@ END_OF_HTML
1245712466
$summary,
1245812467
SummaryInfo::MCDC_DATA,
1245912468
$fileDetail,
12460-
\&SourceFile::nextBranchInOwnerBin,
12469+
\&SourceFile::nextMcdcInOwnerBin,
1246112470
"MC/DC coverage ownership bins",
1246212471
$ownerBinDetailPage,
1246312472
scalar(@dataRow),

lib/lcovutil.pm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ sub munge_file_patterns
17091709
# sadly, substitutions aren't regexps and can't be precompiled
17101710
if (@file_subst_patterns) {
17111711
verify_regexp_patterns('--substitute', \@file_subst_patterns,
1712-
\$lcovutil::case_insensitive);
1712+
$lcovutil::case_insensitive);
17131713

17141714
# keep track of number of times this was applied
17151715
@file_subst_patterns = map({ [$_, 0]; } @file_subst_patterns);
@@ -7558,8 +7558,6 @@ sub _filterFile
75587558
return [$traceInfo, $modified];
75597559
}
75607560
}
7561-
# @todo: if MCDC has just one expression, then drop it -
7562-
# it is equivalent to branch coverage.
75637561
my $region = $cov_filter[$FILTER_EXCLUDE_REGION];
75647562
my $branch_region = $cov_filter[$FILTER_EXCLUDE_BRANCH];
75657563
my $range = $cov_filter[$lcovutil::FILTER_LINE_RANGE];
@@ -7818,6 +7816,7 @@ sub _filterFile
78187816
next unless $branch && ($branch->totals())[0] == 2;
78197817
$mcdc_count->remove($line);
78207818
++$mcdc_single->[-2]; # one MC/DC skipped
7819+
++$mcdc_single->[-1]; # one coverpoint
78217820

78227821
$mcdc->remove($line); # remove at top
78237822
$modified = 1;

0 commit comments

Comments
 (0)