You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ gcovr -k -v -r .
...
Filters for --root: (1)
- re.compile('/Users/hongkun/dev/git_projects/Temp/')
Filters for --filter: (1)
- DirectoryPrefixFilter(/Users/hongkun/dev/git_projects/Temp/)
Filters for --exclude: (0)
Filters for --gcov-filter: (1)
- AlwaysMatchFilter()
Filters for --gcov-exclude: (0)
Filters for --exclude-directories: (0)
Scanning directory . for gcda/gcno files...
Found 2 files (and will process 1)
Pool started with 1 threads
Processing file: /Users/hongkun/dev/git_projects/Temp/example.gcda
Running gcov: 'gcov /Users/hongkun/dev/git_projects/Temp/example.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /Users/hongkun/dev/git_projects/Temp' in '/var/folders/j8/p3thzgnx2_b51ctyv4sc0cf40000gn/T/tmpascthv56'
Finding source file corresponding to a gcov data file
currdir /Users/hongkun/dev/git_projects/Temp
gcov_fname /var/folders/j8/p3thzgnx2_b51ctyv4sc0cf40000gn/T/tmpascthv56/#Applications#Xcode.app#Contents#Developer#Toolchains#XcodeDefault.xctoolchain#usr#include#c++#v1#__locale.gcov
[' -', ' 0', 'Source', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale\n']
source_fname /Users/hongkun/dev/git_projects/Temp/example.gcda
root /Users/hongkun/dev/git_projects/Temp
fname /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale
...
$ ls
example.cpp example.gcda example.gcno program
gcovr with keep option is not working. i could not find example.cpp.gcov file in my source folder
It looks like gcovr will delete .gcov file. also it seems it writes it to /var folder
Version
$ gcovr --version
gcovr 4.1
Copyright 2013-2018 the gcovr authors
Copyright 2013 Sandia Corporation
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ gcov --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Optimized build.
Default target: x86_64-apple-darwin18.2.0
Host CPU: broadwell
The text was updated successfully, but these errors were encountered:
kunhong
changed the title
-keep option is not working
--keep option is not working
Nov 22, 2018
Thank you for the excellent bug report! This is a known issue for gcovr 4.x and is a duplicate of #285.
TL;DR: when we implemented parallelization, gcovr started copying the .gcov files to a tempdir so that the next run of gcov in the same directory would not overwrite them. So what gcovr should perhaps do is copy the files back to their original location, or to skip any copying when parallelization is not enabled.
But it turns out that the original behaviour was broken all along! When a header file is included into multiple translation units, gcov will write a .gcov file for that header each time it processes the coverage data of the translation unit. The last one wins, so coverage data in headers will likely be incomplete in any files that are kept.
There are a couple of alternatives how this could be fixed, I'm not sure yet:
update the docs to say that --keep can only be used with --use-gcov-files, so that any existing files are not touched. Any .gcov files that are created via gcovr would still be deleted.
copy the .gcov files back into the build directory, but warn if there is a conflict.
implement a new output format so that gcovr can write .gcov reports, though with the properly merged coverage data.
Let me know if you have any thoughts on what approach would be best, or if you'd like to implement a fix. Unfortunately, I won't be able to do any meaningful work on gcovr before ~January.
This is my simple program to test coverage
compile & run
run gcovr
gcovr with keep option is not working. i could not find example.cpp.gcov file in my source folder
It looks like gcovr will delete .gcov file. also it seems it writes it to /var folder
Version
The text was updated successfully, but these errors were encountered: