summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnel Husakovic <anel@mariadb.org>2020-10-05 23:39:07 +0200
committerAnel Husakovic <anel@mariadb.org>2020-10-06 00:00:58 +0200
commit8c34a242aa2d4e8e894fa7b2e07e02021a7df9d2 (patch)
treeb509142e20d87abf6abed38c1455711dc6d662d2
parent01ffccd6a4ec2af645b81bcfef8a02f031a492e5 (diff)
downloadmariadb-git-bb-10.2-MDEV-20787.tar.gz
MDEV-20787: Script dgcov.pl does not workbb-10.2-MDEV-20787
- This patch is done after doing test on 00f9df29224ada9cdbb796c99f4 where difference was found between versions of gcov. - This patch doesn't take gcov versions in account since is extracting filename of a `.gcov` file, which is generated with `gcov -i <source-file>.gcda` during `dgcov.pl --generate`. - There is a check if file exists. Reason for that is because some generated `gcov` files are outliers from above rule (that a file generated in intermediate format(gcov) has the same source name). Example 1: `aestables.cpp.gcda` is not generating `aestables.cpp.gcov`, but only the files used in #include `modes.hpp.gcov runtime.hpp.gcov` Example 2: `my_sha256.cc.gcda` is generating `my_sha.ic.gcov` - Make sure to test `MTR_BINDIR` which gets set during out-of-source build and generate error when running `./mysql-test/mtr --gcov alias` - During the testing: 10.1 results are stored in - `<basedir>//mysql-test-gcov.msg` and errors in - `<basedir>//mysql-test-gcov.err` 10.2 results should be stored in `./mysql-test/var/last_changes.dgcov`, but only empty results are obtained (tests `1st` and `alias`).
-rw-r--r--CMakeLists.txt2
-rwxr-xr-xmysql-test/dgcov.pl10
-rwxr-xr-xmysql-test/mysql-test-run.pl2
3 files changed, 10 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4734c6f7d5f..d536027c88e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,7 +256,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..f2bbdad4d20 100755
--- a/mysql-test/dgcov.pl
+++ b/mysql-test/dgcov.pl
@@ -161,8 +161,14 @@ sub gcov_one_file {
system($cmd)==0 or die "system($cmd): $? $!";
}
- # now, read the generated file
- open FH, '<', "$_.gcov" or die "open(<$_.gcov): $!";
+ (my $filename = $_)=~ s/\.[^.]+$//; # remove extension
+ my $gcov_file_path= $File::Find::dir."/$filename.gcov";
+ if (! -f $gcov_file_path)
+ {
+ return;
+ }
+ open FH, '<', "$gcov_file_path" or die "open(<$gcov_file_path): $!";
+
my $fname;
while (<FH>) {
chomp;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 178d65aca41..be51a79e0be 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1791,7 +1791,7 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Gcov flag
# --------------------------------------------------------------------------
- if ( ($opt_gcov or $opt_gprof) and ! $source_dist )
+ if ( ($opt_gcov or $opt_gprof) and (! $source_dist or -d $ENV{MTR_BINDIR}))
{
mtr_error("Coverage test needs the source - please use source dist");
}