CDash:Testing/Coverage

From KitwarePublic
Jump to navigationJump to search

To perform code coverage on CDash, you need to install xdebug as a module in your PHP installation. Once that is done you need to reconfigure PHP to automatically include two files: prepend_coverage.php and append_coverage.php. There are two ways to accomplish this.

Method 1: edit php.ini

edit the php.ini file, add these two lines, and restart apache:

auto_prepend_file =/path/to/CDashTesting/prepend_coverage.php
auto_append_file =/path/to/CDashTesting/build/append_coverage.php

Note that this method will cause all PHP files on your webserver to run through xdebug, causing a slight performance penalty.

Method 2: create a .htaccess file in CDash

This option is only available for computers using Apache for their web server.

Ensure that .htaccess files can be used on your host. To do so, you'll need to examine (and possibly edit) your host configuration file. On Ubuntu & Debian, this is typically

/etc/apache2/sites-available/default

Inside this file, replace

   AllowOverride None

with

   AllowOverride All

Then create a file named .htaccess in your top level CDash source directory. Its contents should be as follows:

php_value auto_prepend_file "/path/to/CDashTesting/prepend_coverage.php"
php_value auto_append_file "/path/to/CDashTesting/build/append_coverage.php"

Pitfalls to avoid when performing coverage with xdebug

For coverage to work, a CMake newer than 5/25/2010 at 4:00 pm will be needed.

Using XAMPP 1.7 on Windows Vista/7 You might need a different version of XDebug: http://xdebug.org/files/php_xdebug-2.1.0RC1-5.3-vc6.dll. The version shipped with XAMPP causes the server to crash: http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development#Edit_PHP.INI_File