[英]Codecov: gcov code coverage for a C++ library
I am writting a small C++ static library.我正在写一个小的 C++ 静态库。 Within GitHub Actions I have a "unit test" workflow which compiles and runs a test program and the code coverage is submitted to the Codecov service afterwards.
在 GitHub Actions 中,我有一个“单元测试”工作流,它编译并运行一个测试程序,然后将代码覆盖率提交给Codecov服务。 It runs:
g++ test.cpp library/library.cpp --coverage -o test
, then ./test
, followed by gcov -o . test.cpp
它运行:
g++ test.cpp library/library.cpp --coverage -o test
,然后是./test
,然后是gcov -o . test.cpp
gcov -o . test.cpp
. gcov -o . test.cpp
。 In the next step the results are submitted to my Codecov account with a standard bash <(curl -s https://codecov.io/bash)
(having a CODECOV_TOKEN
set as an env. variable).在下一步中,结果将使用标准
bash <(curl -s https://codecov.io/bash)
(将CODECOV_TOKEN
设置为环境变量)提交到我的Codecov帐户。 Everything works fine up to this point.到目前为止一切正常。
However, in the coverage I see reports for both .cpp
and .h
files inslide the library directory but also a coverage of the test.cpp
.但是,在覆盖率中,我看到
.cpp
和.h
文件的报告都插入了库目录,但也看到了test.cpp
的覆盖率。 I am not interested in the coverage of my test code and it is skewing the statistics.我对我的测试代码的覆盖率不感兴趣,它歪曲了统计数据。 Is there any way to submit only coverage reports of the library files?
有没有办法只提交库文件的覆盖率报告?
没有简单的方法可以在gcov
级别排除文件,但我通过限制codecov
提交解决了这个问题: https : codecov
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.