Skip to content

Commit

Permalink
Coverage (Percona-QA#382)
Browse files Browse the repository at this point in the history
* Fix: Regex for new file mode.
     Reduce severity of Gcov file with embedded constructor names check
  • Loading branch information
saikumar-vs authored Apr 20, 2023
1 parent d1ab1b0 commit b500446
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Coverage/dgcov.pl
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,19 @@

while(<FH>) {
next if /^function /; # Skip function summaries.
next if (/^-------/) or (/^_ZN*/); # TODO :: Handle embedded constructor calls.
croak "Unexpected line '$_'\n in $gcov_file"
next if (/^-------/) or (/^_Z*/); # TODO :: Handle embedded constructor calls.
carp "Unexpected line '$_'\n in $gcov_file"
unless /^([^:]+):[ \t]*(\d+):(.*)$/;
($cov, $lineno, $code, $full) = ($1, $2, $3, $_);
check_purecov($code, $gcov_file, $lineno);

foreach (@{$data->{$file}}) {
if ($lineno eq $_ and $cov =~/#####/) {

if (defined $data->{$file}->[0] && $lineno eq $data->{$file}->[0]){
shift @{$data->{$file}};
if ($cov =~/#####/ and (!defined $annotation)) {
$uncovered++;
$instrumented++;
$printer->("|$full");
} elsif ($lineno eq $_ and $cov =~ /^[ \t]*[0-9]+$/ ) {
} elsif ($cov =~ /^[ \t]*[0-9]+$/ ) {
$instrumented++;
}
}
Expand Down Expand Up @@ -316,6 +317,8 @@ sub get_diff_lines {
push @$modified, [m => $3, $3];
} elsif(/^@@\s[+-](\d+)\s[+-](\d+)\s@@$/) {
push @$modified, [m => $2, $2];
} elsif(/^new file mode.*/) {
# Ingnore new file mode, we handle for now as modified.
} elsif(/^@@\s/) {
# Ignore diffs with 0 lines changed.
} elsif(/^[ +-]|^$/) {
Expand Down

0 comments on commit b500446

Please sign in to comment.