php-code-coverage: Code coverage appears broken on HHVM
Hi,
I use to have phpunit running with code coverage under 4.7.7 and not report any error. Although I cannot confirm if it did indeed produce meaningful output (since it was only executed on travis and sending the report to scrutinizer-ci), my guess is that it did.
However, it appears that changes that have been done in 2.2.x might have broken what used to not generate errors.
My guess would be that the change https://github.com/sebastianbergmann/php-code-coverage/commit/245f47cf97a1b075b4f8e2f66e36c6dec1565a06#diff-b2fbc27b0e544bbffcdfba89b3fb1dd4L99 changed the condition just enough to break.
It changed from PHP_SAPI === 'phpdbg'
(such that it would use phpdbg) to !$this->isHHVM() && PHP_SAPI === 'phpdbg';
. Thus, it prevents the use of the phpdbg driver and defaults to xdebug, which isn’t supported by hhvm.
Here’s an example callstack of the issue.
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.
Fatal error: Uncaught exception 'PHP_CodeCoverage_Exception' with message 'This driver requires Xdebug' in /home/travis/build/tomzx/ditto/vendor/phpunit/php-code-coverage/src/CodeCoverage/Driver/Xdebug.php:25
Stack trace:
#0 /home/travis/build/tomzx/ditto/vendor/phpunit/php-code-coverage/src/CodeCoverage.php(914): PHP_CodeCoverage_Driver_Xdebug->__construct()
#1 /home/travis/build/tomzx/ditto/vendor/phpunit/php-code-coverage/src/CodeCoverage.php(99): PHP_CodeCoverage->selectDriver()
#2 /home/travis/build/tomzx/ditto/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(360): PHP_CodeCoverage->__construct()
#3 /home/travis/build/tomzx/ditto/vendor/phpunit/phpunit/src/TextUI/Command.php(147): PHPUnit_TextUI_TestRunner->doRun()
#4 /home/travis/build/tomzx/ditto/vendor/phpunit/phpunit/src/TextUI/Command.php(99): PHPUnit_TextUI_Command->run()
#5 /home/travis/build/tomzx/ditto/vendor/phpunit/phpunit/phpunit(36): PHPUnit_TextUI_Command::main()
#6 {main}
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (8 by maintainers)
Looks good to me 👍.
hhvm @ 3.5.0 phpunit/phpunit @ 4.7.7 phpunit/php-code-coverage @ 2.2.1 sebastian/environment @ 1.3.2
For code coverage to work on travis, one needs to make sure to enable it (as it is not enabled by default it seems):
if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then echo 'xdebug.enable = On' >> /etc/hhvm/php.ini; fi