For Developers‎ > ‎

Code Coverage

Accessing code coverage results within Visual Studio

  1. Install the Visual Studio Team Tools:
    • Make sure you have the Visual Studio Team Tools installed. Download the Visual Studio Team Tools from here: http://msdn.microsoft.com/en-us/vsts2008/bb684946.aspx
    • Even if you already have Visual Studio installed run setup.exe from the Team Tools that you just downloaded. When you do that, proceed with Visual Studio install. Select a 'Custom' install. When you are shown the screen to select components, de-select everything and then select just 'Team System Developer Tools'. Complete the installation.
    • Once you start your Visual Studio, it will now be equipped with the tools needed for viewing the code coverage results.
    • Copy the attached cov_tools.zip and extract it to your local disk at say c:\cov_tools\.
  2. Building:
    • Open a command prompt and add the following environment variable:
      set CHROME_BUILD_TYPE=_coverage
      This is very important as it enables the /PROFILE linker flag for all the sub-projects in Visual Studio. Without that your binaries will not be instrumented. 
    • Start Visual Studio from the same command prompt:
      <PATH to VS>\devenv.exe trunk\src\chrome\chrome.sln
      Now build Chrome in Release | Win32 mode.
  3. Generating the code coverage data
    • - Open a command prompt and run the following script from your trunk\src folder:
      third_party\python_24\python.exe tools\code_coverage\coverage.py --tools_path=c:\cov_tools\ --src_root=. --archive=<location> --revision=<current revision number of your source tree>
    • The script above will run the tests under the list windows_tests (this is a variable in the python script and you can edit to gauge the coverage of the tests you care about) and create a .coverage file for each of those tests in your archive location. 
  4. Viewing the results
    • Simply copy all of the .coverage files over to your trunk\src\chrome\Release\ folder and drag and drop the .coverage file (which needs to be in the same folder as symbols) into your Visual Studio.


ċ
cov_tools.zip
(3521k)
Niranjan Tulpule,
Nov 20, 2008, 1:47 PM
Comments