批量运行VS代码覆盖率工具 [英] Batch running of VS code coverage tools

查看:96
本文介绍了批量运行VS代码覆盖率工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我出现了一个批处理文件,以生成此

I came up a batch file to generate code coverage file as is written in this post.

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

但是,运行批处理文件时出现此错误消息。

However, I got this error message when I run the batch file.

我必须手动运行 vsperfcmd / shutdown 来完成它。
可能有什么问题?

I had to run vsperfcmd /shutdown manually to finish it. What might be wrong?

推荐答案

这只是时间问题。

start vsperfmon / coverage /output:run.coverage 命令在一个单独的进程中启动vsperfmon.exe。

The start vsperfmon /coverage /output:run.coverage command starts up vsperfmon.exe in a separate process.

同时,您的脚本继续运行 hello 。如果 hello 是一个非常简单的程序,则它有可能在vsperfmon.exe运行并完全初始化之前执行并完成。如果您的脚本在监视器启动和运行之前命中 vsperfcmd / shutdown ,您将得到所显示的错误。

Concurrently, your script goes on to run hello. If hello is a really simple program, it is possible that it executes and completes before vsperfmon.exe is running and fully initialized. If your script hits vsperfcmd /shutdown before the monitor is up and running, you will get the error you're showing.

vsperfcmd 只是 vsperfmon 的控制器/启动器,因此您可以在批处理文件中专门使用它:

vsperfcmd is just a controller/launcher for vsperfmon, so you can use that exclusively in your batch file:

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

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

In this case, the first call to vsperfcmd will block until the monitor is up and fully running.

这篇关于批量运行VS代码覆盖率工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆