Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 C++ code coverage merge executables

My c++ unit tests use gtest framework so every test is a separate executable. I'm running the CodeCoverage.exe tool to get the raw coverage data of each executable run. When I open the results in Visual Studio, each executable run appears in a separate branch and the results can't be merged together.
Is there any way to make this work?

One thing I've tried is to specify /session:uniq in the command line for both runs but that didn't have any effect.

like image 668
shoosh Avatar asked Jun 06 '26 21:06

shoosh


1 Answers

Does it help you to capture via vsperfcmd.exe?

  1. Build your gtest with /profile flag specified to the linker
  2. Instrument your gtest exe with Visual Studio coverage instrumentation
    • vsinstr.exe gtest.exe /COVERAGE
  3. Launch the code coverage capture tool
    • vsperfmon.exe /COVERAGE /OUTPUT:gtest.coverage
  4. Run the gtest
  5. Stop the capture tool
    • vsperfcmd.exe -shutdown
  6. Launch the output file (gtest.coverage) to see the output in Visual Studio
like image 57
jws Avatar answered Jun 09 '26 11:06

jws



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!