最好的 C++ 是什么?与模板一起使用的代码覆盖率工具?

发布于 2024-12-09 09:42:36 字数 161 浏览 2 评论 0原文

我已经使用 gcov 来测试代码覆盖率,但是当涉及到模板化的 C++ 代码时,它的效果不太好。我广泛使用 boost::spirit 而 gcov 似乎只是忽略了模板化的 Spirit 代码。

另外我想知道是否有一个覆盖工具来显示线程如何相互交互,查明实际执行的可能的分支/竞争条件/执行流。

I have used gcov for testing code coverage, but when it comes to templated c++ code it doesn't work so well. I use boost::spirit extensively and gcov seems to simply ignore templated spirit code.

Also I am wondering if there is a coverage tool to show how threads interacts with each other, pinpointing the possible branches/race conditions/execution flows actually executed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

只为守护你 2024-12-16 09:42:36

TestCocoon 是一个值得尝试的好工具,比 gcov 更好,具有良好的工具和报告功能。正如 @vraj Pandya 在评论中提到的,TestCocoon 不再被维护。您可以使用兼容的 Squish Coco。但我无法说出它的价值。

现在,我使用 LLVM 覆盖工具

TestCocoon was a great tool to try, better than gcov with good tools and report facilities. As mentioned by @vraj Pandya in the comments, TestCocoon is no more maintained. You can use Squish Coco, which is compatible. I can't tell what it's worth though.

Nowadays, I use LLVM coverage tools.

动听の歌 2024-12-16 09:42:36

我开发一个大型产品,我们使用名为 BullsEye 的第三方应用程序进行覆盖率测试。它创造了奇迹。

I work on a large product and we used a third party app called BullsEye for coverage testing. It worked wonders.

迎风吟唱 2024-12-16 09:42:36

我们的 C++ 测试覆盖率工具提供了模板主体或至少那些模板的测试覆盖率在您指定的文件中定义的文件来覆盖。

它不区分模板的实例化。

如果您有一个多线程应用程序,并且您将工具配置为使用原子可写的标志(通常是 CPU 的自然字大小 [32 或 64 位]),则该工具将记录所有线程执行的分支。(如果如果您不这样做,您可能会在更新覆盖范围标志时出现线程竞争,并且可能会丢失一些覆盖范围。这不是该工具的缺陷;它是对存储保持探针的不同步访问的结果。数据。)

对于竞争检测,OP 需要找到竞争检测工具;测试覆盖率工具无法做到这一点。

Our C++ Test Coverage tool provides test coverage on template bodies, or at least those templates that are defined in files you specify for it to cover.

It doesn't distinguish instantiations of templates.

If you have a multi-threaded application, the tool will record the branches executed by all threads, if you configure the tool to use flags that are atomically writable (typically the natural word size of the CPU [32 or 64 bits]. (If you don't do this, you may end up with a thread race in updating the coverage flags and you can lose a bit of coverage. This isn't a defect of the tool; its a consequence of unsynchronized access to the storage holding probe data.)

For race detection, OP needs to find a race detection tool; test coverage tools won't do this.

魔法少女 2024-12-16 09:42:36

C++ 覆盖率验证器 提供模板的覆盖率数据。

跟踪所有线程的代码覆盖率。

C++ Coverage Validator provides coverage data for templates.

Code coverage is tracked for all threads.

╰ゝ天使的微笑 2024-12-16 09:42:36

Parasoft CPP 测试是用于各种分析(包括代码覆盖率和静态分析)的好工具。这也有利于深入研究多线程。

http://www.parasoft.com/jsp/products/cpptest.jsp

这里有 10 个优秀的代码覆盖开源工具:

https://web .archive.org/web/20181018002302/http://open-tube.com/10-code-coverage-tools-cc/

Parasoft CPP test is a good tool for various analysis including code coverage and static analysis. This is good for digging into multithreading as well.

http://www.parasoft.com/jsp/products/cpptest.jsp

Here are 10 good open soure tools for code coverage :

https://web.archive.org/web/20181018002302/http://open-tube.com/10-code-coverage-tools-c-c/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文