diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-07-19 22:02:10 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-07-20 10:24:12 +0200 |
commit | 6638cf2e9ea49c21a504c9f1b8e6460887930441 (patch) | |
tree | e906c591e637b72487445af949a3bd71722104a4 /mysql-test/dgcov.pl | |
parent | 0151590d8fd2c6492eddf00a6b8dbbb69d378177 (diff) | |
download | mariadb-git-6638cf2e9ea49c21a504c9f1b8e6460887930441.tar.gz |
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.
Diffstat (limited to 'mysql-test/dgcov.pl')
-rwxr-xr-x | mysql-test/dgcov.pl | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl index fbc5540e697..734f5c6ed7d 100755 --- a/mysql-test/dgcov.pl +++ b/mysql-test/dgcov.pl @@ -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; - } - 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; + 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; } - $cov{$fname}->{$1}+=$2; + close(FH); } - close(FH); } sub write_coverage { |