Commit 6638cf2e authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-20787 Script dgcov.pl does not work

For every file.gcda file, gcov <7.x created file.cc.gcda.gcov.
While gcov 7.x and 8.x create file.cc.gcov
And sometimes otherfile.h.gcov or otherfile.ic.gcov, for included files.

(gcov 9.x+ creates .json.gz files, see MDEV-26102)

So, we use `gcov -l` that will create file.cc.gcda##file.cc.gcov,
file.cc.gcda##otherfile.h.gcov, etc. And we search and parse all
those file.cc.gcda*.gcov files.
parent 0151590d
...@@ -155,14 +155,15 @@ END ...@@ -155,14 +155,15 @@ END
sub gcov_one_file { sub gcov_one_file {
return unless /\.gcda$/; return unless /\.gcda$/;
unless ($opt_skip_gcov) { unless ($opt_skip_gcov) {
$cmd= "gcov -i '$_' 2>/dev/null >/dev/null"; $cmd= "gcov -il '$_' 2>/dev/null >/dev/null";
print STDERR ++$file_no,"\r" if not $opt_verbose and -t STDERR; print STDERR ++$file_no,"\r" if not $opt_verbose and -t STDERR;
logv "Running: $cmd"; logv "Running: $cmd";
system($cmd)==0 or die "system($cmd): $? $!"; system($cmd)==0 or die "system($cmd): $? $!";
} }
# now, read the generated file # now, read the generated file
open FH, '<', "$_.gcov" or die "open(<$_.gcov): $!"; for my $gcov_file (<$_*.gcov>) {
open FH, '<', "$gcov_file" or die "open(<$gcov_file): $!";
my $fname; my $fname;
while (<FH>) { while (<FH>) {
chomp; chomp;
...@@ -175,12 +176,13 @@ sub gcov_one_file { ...@@ -175,12 +176,13 @@ sub gcov_one_file {
} }
next if /^lcount:\d+,-\d+/; # whatever that means next if /^lcount:\d+,-\d+/; # whatever that means
unless (/^lcount:(\d+),(\d+)/ and $fname) { unless (/^lcount:(\d+),(\d+)/ and $fname) {
warn "unknown line '$_' after running '$cmd'"; warn "unknown line '$_' in $gcov_file";
next; next;
} }
$cov{$fname}->{$1}+=$2; $cov{$fname}->{$1}+=$2;
} }
close(FH); close(FH);
}
} }
sub write_coverage { sub write_coverage {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment