1

使用 gcovr 3.2 我正在尝试为我使用 Xcode 5.0 开发和运行的一组单元测试生成代码覆盖率报告。

我已成功配置 Xcode 以在执行测试后生成 .gcda 文件,并且我能够使用 CoverStory 查看结果。

但是,当我尝试使用 gcovr 生成报告时,什么也没有生成。打开详细开关后,我可以看到它扫描目录中的 gcda/gcno 文件并找到我期望的文件。我尝试了各种开关并将文件放在不同的目录中,但没有任何运气。

此处提出了类似的问题Gcovr 为 0 个文件生成覆盖率数据,但尚未发布解决方案。我已经提供了更多细节,希望能得到答复。

这是我得到的输出。

$ ls
t1-map.d    t1-map.dia  t1-map.gcda t1-map.gcno t1-map.o

$ gcovr -v -r .

Scanning directory . for gcda/gcno files...
Found 2 files (and will process 1)
Running gcov: 'gcov /Users/Test/temp/coverage/t1-map.gcda --branch-counts --branch-probabilities --preserve-paths --object-directory /Users/Test/temp/coverage' in '/Users/Test/temp/coverage'
Parsing coverage data for file /Users/Test/dev/boost/boost/system/error_code.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/system/error_code.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/system/system_error.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/system/system_error.hpp
Parsing coverage data for file /Users/Test/dev/analysis-pipeline/analysis-services/src/t1-map.cpp
  Filtering coverage data for file /Users/Test/dev/analysis-pipeline/analysis-services/src/t1-map.cpp
Parsing coverage data for file /Users/Test/dev/boost/boost/variant/variant.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/variant/variant.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/aligned_storage.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/aligned_storage.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/variant/static_visitor.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/variant/static_visitor.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/variant/detail/visitation_impl.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/variant/detail/visitation_impl.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/variant/detail/cast_storage.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/variant/detail/cast_storage.hpp
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory
Parsing coverage data for file /Users/Test/dev/boost/boost/variant/detail/initializer.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/variant/detail/initializer.hpp
Parsing coverage data for file /Users/Test/dev/analysis-pipeline/common/include/common/lm-fitter.inl
  Filtering coverage data for file /Users/Test/dev/analysis-pipeline/common/include/common/lm-fitter.inl
Parsing coverage data for file /Users/Test/development/software/utilities/include/utilities/numerical-recipes/utilities.h
  Filtering coverage data for file /Users/Test/development/software/utilities/include/utilities/numerical-recipes/utilities.h
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iosfwd
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iosfwd
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/sstream
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/sstream
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/string
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/string
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/streambuf
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/streambuf
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/algorithm
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/type_traits
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/type_traits
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iterator
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iterator
Parsing coverage data for file /Users/Test/dev/boost/boost/log/utility/formatting_ostream.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/utility/formatting_ostream.hpp
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ios
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ios
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__locale
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__locale
Parsing coverage data for file /Users/Test/dev/boost/boost/log/detail/attachable_sstream_buf.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/detail/attachable_sstream_buf.hpp
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ostream
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/ostream
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/locale
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/locale
Parsing coverage data for file /Users/Test/development/software/utilities/include/utilities/numerical-recipes/mrqmin.inl
  Filtering coverage data for file /Users/Test/development/software/utilities/include/utilities/numerical-recipes/mrqmin.inl
Parsing coverage data for file /Users/Test/development/software/utilities/include/utilities/numerical-recipes/mrqcof.inl
  Filtering coverage data for file /Users/Test/development/software/utilities/include/utilities/numerical-recipes/mrqcof.inl
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/cmath
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/cmath
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/vector
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/vector
Parsing coverage data for file /Users/Test/dev/boost/boost/log/utility/string_literal.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/utility/string_literal.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/variant/get.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/variant/get.hpp
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/exception
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/exception
Parsing coverage data for file /Users/Test/dev/boost/boost/throw_exception.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/throw_exception.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/exception/exception.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/exception/exception.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/utility/addressof.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/utility/addressof.hpp
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__split_buffer
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/__split_buffer
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/limits
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/limits
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/typeinfo
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/typeinfo
Parsing coverage data for file /Users/Test/dev/boost/boost/log/sources/record_ostream.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/sources/record_ostream.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/move/utility.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/move/utility.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/sources/basic_logger.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/sources/basic_logger.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/core/core.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/core/core.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/smart_ptr/shared_ptr.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/smart_ptr/shared_ptr.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/detail/locks.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/detail/locks.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/core/record.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/core/record.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/sources/threading_models.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/sources/threading_models.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/detail/light_rw_mutex.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/detail/light_rw_mutex.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/sources/severity_feature.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/sources/severity_feature.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/parameter/keyword.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/parameter/keyword.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/parameter/aux_/default.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/parameter/aux_/default.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/parameter/aux_/tagged_argument.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/parameter/aux_/tagged_argument.hpp
Parsing coverage data for file /Users/Test/dev/boost/boost/log/attributes/named_scope.hpp
  Filtering coverage data for file /Users/Test/dev/boost/boost/log/attributes/named_scope.hpp
Parsing coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/stdexcept
  Filtering coverage data for file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/stdexcept
Gathered coveraged data for 0 files
------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
------------------------------------------------------------------------------
TOTAL                                          0       0    --%
------------------------------------------------------------------------------
4

1 回答 1

3

对于任何可能感兴趣的人,我最终想通了。

从目录 /Users/Test/development 我输入了以下命令:

gcovr --html --html-details -o output-file-name.html -v -g -k -r ~/development/ .

源文件位于“~/development/”下的各个目录中。在我之前的尝试中,似乎找不到源文件。

于 2014-08-26T11:10:36.443 回答