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.
This commit is contained in:
parent
0151590d8f
commit
6638cf2e9e
@ -155,32 +155,34 @@ 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>) {
|
||||||
my $fname;
|
open FH, '<', "$gcov_file" or die "open(<$gcov_file): $!";
|
||||||
while (<FH>) {
|
my $fname;
|
||||||
chomp;
|
while (<FH>) {
|
||||||
if (/^function:/) {
|
chomp;
|
||||||
next;
|
if (/^function:/) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if (/^file:/) {
|
||||||
|
$fname=realpath($');
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
next if /^lcount:\d+,-\d+/; # whatever that means
|
||||||
|
unless (/^lcount:(\d+),(\d+)/ and $fname) {
|
||||||
|
warn "unknown line '$_' in $gcov_file";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
$cov{$fname}->{$1}+=$2;
|
||||||
}
|
}
|
||||||
if (/^file:/) {
|
close(FH);
|
||||||
$fname=realpath($');
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
next if /^lcount:\d+,-\d+/; # whatever that means
|
|
||||||
unless (/^lcount:(\d+),(\d+)/ and $fname) {
|
|
||||||
warn "unknown line '$_' after running '$cmd'";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
$cov{$fname}->{$1}+=$2;
|
|
||||||
}
|
}
|
||||||
close(FH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub write_coverage {
|
sub write_coverage {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user