c++ - How to use MS code coverage tool in command line? -
i have following c++ code.
#include <iostream> using namespace std; int testfunction(int input) { if (input > 0) { return 1; } else { return 0; } } int main() { testfunction(-1); testfunction(1); } i compiled execution
cl /zi hello.cpp -link /profile then, instrument execution , generated .coverage binary.
vsinstr -coverage hello.exe start vsperfmon -coverage -output:mytestrun.coverage vsperfcmd -shutdown when open coverage file in vs2010, got nothing in results.

what might wrong? followed instructions in this post.
you need run program after monitor starts:
> vsinstr /coverage hello.exe> start vsperfmon /coverage /output:mytestrun.coverage> hello.exe> vsperfcmd /shutdown
when run step 3, should see notification in vsperfmon.exe hello.exe has started.
if plan on doing multiple test runs, need run steps 2-4. in other words, need instrument binary (step 1) once after it's built.
Comments
Post a Comment