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.

enter image description here

what might wrong? followed instructions in this post.

you need run program after monitor starts:

  1. > vsinstr /coverage hello.exe
  2. > start vsperfmon /coverage /output:mytestrun.coverage
  3. > hello.exe
  4. > 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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -