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 {
|
||||
return unless /\.gcda$/;
|
||||
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;
|
||||
logv "Running: $cmd";
|
||||
system($cmd)==0 or die "system($cmd): $? $!";
|
||||
}
|
||||
|
||||
# now, read the generated file
|
||||
open FH, '<', "$_.gcov" or die "open(<$_.gcov): $!";
|
||||
my $fname;
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
if (/^function:/) {
|
||||
next;
|
||||
for my $gcov_file (<$_*.gcov>) {
|
||||
open FH, '<', "$gcov_file" or die "open(<$gcov_file): $!";
|
||||
my $fname;
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
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:/) {
|
||||
$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);
|
||||
}
|
||||
close(FH);
|
||||
}
|
||||
|
||||
sub write_coverage {
|
||||
|
Loading…
x
Reference in New Issue
Block a user