diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | mysql-test/dgcov.pl | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dcc2a75587..af025a0312f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,7 +249,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF) IF (ENABLE_GCOV) - MY_CHECK_AND_SET_COMPILER_FLAG("-fprofile-arcs -ftest-coverage -lgcov" DEBUG) + MY_CHECK_AND_SET_COMPILER_FLAG("--coverage" DEBUG) ENDIF() MY_CHECK_AND_SET_COMPILER_FLAG(-ggdb3 DEBUG) diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl index fbc5540e697..47ffaca04ef 100755 --- a/mysql-test/dgcov.pl +++ b/mysql-test/dgcov.pl @@ -68,8 +68,11 @@ if ($opt_purge) system($cmd)==0 or die "system($cmd): $? $!"; exit 0; } - +my $gcov_vers= `gcov -v`; +$gcov_vers=~ s/\D//g; +$gcov_vers= substr($gcov_vers, 0, 1); find(\&gcov_one_file, $root); +undef $gcov_vers; find(\&write_coverage, $root) if $opt_generate; exit 0 if $opt_only_gcov; @@ -162,7 +165,16 @@ sub gcov_one_file { } # now, read the generated file - open FH, '<', "$_.gcov" or die "open(<$_.gcov): $!"; + if($gcov_vers<7) + { + open FH, '<', "$_.gcov" or die "open(<$_.gcov): $!"; + } + else + { + my $f=substr $_, 0, -5; + open FH, '<', "$f.gcov" or die "open(<$f.gcov): $!"; + undef $f; + } my $fname; while (<FH>) { chomp; |