visual-studio-2010 - 批量运行VS代码覆盖工具

标签 visual-studio-2010 code-coverage

我想出了一个批处理文件来生成代码覆盖率文件,如本文所述 post .

cl /Zi hello.cpp -link /Profile
vsinstr -coverage hello.exe
start vsperfmon /coverage /output:run.coverage
hello
vsperfcmd /shutdown

但是,当我运行批处理文件时收到此错误消息。

enter image description here

我不得不跑vsperfcmd /shutdown手动完成它。
可能有什么问题?

最佳答案

这只是一个时间问题。
start vsperfmon /coverage /output:run.coverage命令在单独的进程中启动 vsperfmon.exe。

同时,您的脚本继续运行 hello .如果 hello是一个非常简单的程序,它有可能在 vsperfmon.exe 运行和完全初始化之前执行并完成。如果您的脚本命中 vsperfcmd /shutdown在监视器启动并运行之前,您将收到所显示的错误。
vsperfcmd只是 vsperfmon 的 Controller /启动器,因此您可以在批处理文件中专门使用它:

cl /Zi hello.cpp -link /Profile
vsinstr -coverage hello.exe
vsperfcmd /start:coverage /output:run.coverage
hello
vsperfcmd /shutdown

在这种情况下,第一次调用 vsperfcmd将阻塞,直到监视器启动并完全运行。

关于visual-studio-2010 - 批量运行VS代码覆盖工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4958776/

相关文章:

nunit - 在FinalBuilder中为NUnit设置NCover

python - 使用 try- except-finally 和上下文管理器增加覆盖范围

java - 如何在保持代码覆盖率的同时进行 Junit 测试和预期异常

c# - 从类库中使用 Web 服务

visual-studio-2010 - Visual Studio 启动时间为 2012 年而非 2010 年

visual-studio - Visual Studio 2010 版本控制和错误跟踪功能

c++ - 如何将 curlpp 添加到我的项目中?

unit-testing - 在 Jest 中生成 HTML coverageReport 的命令行方式

code-coverage - Ember CLI 和代码覆盖率

visual-studio - 使用 Team Foundation Server 源代码管理回滚更改