[WIP] fix xdebug coverage (part2): support XDEBUG_CC_UNUSED and XDEBUG_CC_DEAD_CODE
description
related to: #1589 and #7888
This pull request adds support for XDEBUG_CC_UNUSED and XDEBUG_CC_DEAD_CODE flags to xdebug_start_code_coverage() .
example
With this pull request, code coverage report for moneyphp/money can be generated with HHVM + PHPUnit as following: https://xkerman.github.io/hhvm-coverage-sample/hhvm/
Contrast coverage report genereated with PHP5.6 + PHPUnit: https://xkerman.github.io/hhvm-coverage-sample/php56/
Note: In order to generate coverage report with HHVM + PHPUnit, I need to apply the following patch to phpunit/php-code-coverage:
diff --git a/src/Driver/HHVM.php b/src/Driver/HHVM.php
index b35ea81..85dc6a9 100644
--- a/src/Driver/HHVM.php
+++ b/src/Driver/HHVM.php
@@ -24,6 +24,6 @@ class HHVM extends Xdebug
*/
public function start($determineUnusedAndDead = true)
{
- xdebug_start_code_coverage();
+ xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
}
2 weeks have passed since I submitted this pull request. @mofarrell could you review this?
@mofarrell has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Thanks, but I found there is a conflict. I will rebase this pull request.
@xKerman updated the pull request - view changes - changes since last import
@mofarrell has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@mofarrell It has been over 2 weeks since this pull request was imported to Phabricator. I would appreciate it if you let me know whether any updates are needed.
@xKerman Sorry this has taken so long. I kept checking back after test results had expired. This looks like it is working well, but I feel like it would be cleaner to do all the book keeping in a single map. Rather than merging them at the end.
@mofarrell Thanks for your code review and comments.
it would be cleaner to do all the book keeping in a single map. Rather than merging them at the end.
I see, I will try to change to use a single map (m_hits) for reporting code coverage.