qa:testcoverage

This is an old revision of the document!


How to look at the test coverage for an extension - eg /ext/dom

  • Make sure that you have LTP installed, for Ubuntu:
    • sudo apt-get install ltp
    • sudo apt-get install lcov

Checkout the PHP53 code and build it

  • Checkout or download PHP53 into directory of your choice (in my case /home/zoe/BUILDS/php53_dev)
  • cd /home/zoe/BUILDS/php53_dev
  • ./buildconf
  • ./configure --enable-gcov
  • make

Check the coverage of a single extension

  • make a new directory somewhere (eg /home/zoe/TESTS/coverage) and cd to it
  • create a script (run_coverage) file to run the tests, eg
export TEST_PHP_EXECUTABLE=/home/zoe/BUILDS/php53_dev/sapi/cli/php
$TEST_PHP_EXECUTABLE /home/zoe/BUILDS/php53_dev/run-tests.php /home/zoe/BUILDS/php53_dev/ext/dom
  • ./run_coverage. This runs all the tests found under php53_dev/ext/dom
  • lcov --directory /home/zoe/BUILDS/php53_dev/ext/dom -c -o dom.info
  • genhtml dom.info -o dom_coverage. This will make a directory called dom_coverage with html coverage files in it.
  • View the coverage files :-)
qa/testcoverage.1209585206.txt.gz · Last modified: 2017/09/22 13:28 (external edit)