sebastianbergmann / php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.
BSD 3-Clause "New" or "Revised" License
8.79k stars 373 forks source link

Tests freeze while running when using code coverage report #1041

Open max-paqt opened 1 month ago

max-paqt commented 1 month ago
Q A
php-code-coverage version 9.2.31
PHP version 8.2.21
Driver Xdebug
Xdebug version (if used) 3.3.2
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 9.6.18

When running our test suite phpunit consistently freezes after running ~1500 of the ~2000 tests.

When running with -vvv the only output indicates the last (before freezing) test started, and nothing else.

I tried a few different versions of phpunit, but it didn't improve things.

Running the suite while having code coverage disabled, this issue does not occur.

How could we debug this issue?

sebastianbergmann commented 1 month ago

When running with -vvv the only output indicates the last (before freezing) test started, and nothing else.

PHPUnit's test runner does not have a -vvv CLI option. And the --version / -v CLI options it does have do not have the effect you describe. Are you using an extension for / wrapper around PHPUnit's test runner? If that is the case, then my first advice would be to disable that.

Please note that Bugfix Support for PHPUnit 9 has ended and the only work I still do on this version is to keep it compatible with new versions of PHP (Life Support).

How could we debug this issue?

Off the top of my head, I do not know how to debug this.

max-paqt commented 1 month ago

PHPUnit's test runner does not have a -vvv CLI option. And the --version / -v CLI options it does have do not have the effect you describe.

My bad, I was using -v, -vvv & --debug mixed together to see if I could get any more debug info. But whichever flag it was, it did not provide much info anyway so not too relevant I'd say.

We do normally use a wrapper, but disabled that to confirm whether it was an issue in the wrapper, or lower down the chain.

Please note that Bugfix Support for PHPUnit 9 has ended and the only work I still do on this version is to keep it compatible with new versions of PHP (Life Support).

Tested this with phpunit v10 as well, which had the same issue for me.

In case it may be relevant, we only encountered the issue while running the tests in a Github runner, not while running it on our own machines inside a docker container.