-
Notifications
You must be signed in to change notification settings - Fork 288
Description
Describe the bug
The issue occurs in our CI (jenkins), when trying to generate reports for several coverage data at the same time (one report per configuration).
To Reproduce
Steps to reproduce the behavior:
- gitclone the project, the root directory contains (mainly) CMakeLists.txt, source folder
- build the source for several configurations, the root directory now contains builds/conf1, builds/conf2, ...
- launch tests in parallel to produce coverage data, gcda/gcno files are in the builds/conf1, builds/conf2, etc...
- launch gcovr in parallel to produce coverage reports, see it fails
- command line (that can probably be improved ?) for configX is like
gcovr \
--gcov-executable /usr/bin/gcov \
--root /my/project/root \
--object-directory /my/project/root/builds/configX \
--exclude ".*/tests/src/.*" \
--exclude ".*/unit_tests/src/.*" \
--exclude ".*/func_tests/src/.*" \
--branches \
--exclude-unreachable-branches \
--exclude-throw-branches \
--sort-percentage \
--html --html-details /my/project/root/builds/configX/coverage-reports/gcovr/index.html \
--xml --xml-pretty --output /my/project/root/builds/configX/coverage-reports/gcov-results.xml \
# end of argsExpected behavior
Calling gcovr on different object directory, at the same time, should not be an issue.
Gcovr 5.0 did not have the issue. Tracing behaviour changes (with --verbose call shows that gcovr 5.0 calls gcov in some temporary directory
Running gcov: '/usr/bin/gcov /my/project/root/builds/configX/src/lib1/CMakeFiles/mylib.dir/src/SomeSrc.cpp.gcda \
--branch-counts \
--branch-probabilities \
--preserve-paths \
--object-directory /my/project/root/builds/configX/src/lib1/CMakeFiles/mylib.dir/src' in '/tmp/tmp1sck169l'
while 5.1 and later calls gcov in the project source tree (that is quite ... unpretty ;)) ...
(DEBUG) Running gcov: '/usr/bin/gcov /my/project/root/builds/configX/src/lib1/CMakeFiles/mylib.dir/src/SomeSrc.cpp.gcda \
--branch-counts \
--branch-probabilities \
--demangled-names \
--hash-filenames \
--object-directory /my/project/root/builds/configX/src/lib1/CMakeFiles/mylib.dir/src' in '/my/project/root'
Working directly in the (same) source tree should then trigger some race condition between gcov generated .gcov files
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Linux Debian 11.6 (same behaviour on 9.13)
- GCC version 10.3.0
- GCOVR version 5.1, 5.2, 6.0
- Project directory layout:
. <- root
├── builds
│ ├── config1 <- object-directory for config1
│ │ ├── cmake
│ │ ├── CMakeFiles
│ │ ├── coverage-reports
│ │ │ ├── gcovr
│ │ │ └── lcov
│ │ └── src
│ └── config2 <- object-directory for config2
│ ├── cmake
│ ├── CMakeFiles
│ ├── coverage-reports
│ │ ├── gcovr
│ │ └── lcov
│ └── src
├── cmake
├── scripts
└── src
├── exe
├── lib1
├── lib2
└── unit_tests
Additional context
Note that enabling/disabling gcov parallel calls does not modify the behaviour.