paratest: "Coverage file /tmp/CV_L8DgkT is empty. This means a PHPUnit process has crashed." when running with "--coverage-clover"
Q | A |
---|---|
ParaTest version | 6.2.0 |
PHPUnit version | 9.5.2 |
PHP version | 7.4 |
Summary
“Coverage file /tmp/CV_L8DgkT is empty. This means a PHPUnit process has crashed.” when running with “–coverage-clover” on every CircleCI, AWS CodeBuild & Docker builds (works fine locally on mac)
Previously posted #397 - But looks like it was closed without a solution
Current behavior
1st test in the suite passes, second immediately fails with the previously mentioned error.
How to reproduce: command, code and error stack trace
Command being run: ./vendor/bin/paratest -p 8 --coverage-clover deployment/coverage.xml --verbose
Stacktrace of the error with the --verbose
flag added:
In CoverageMerger.php line 59:
[ParaTest\Coverage\EmptyCoverageFileException]
Coverage file /tmp/CV_L8DgkT is empty. This means a PHPUnit process has cra
shed.
Exception trace:
at /root/project/vendor/brianium/paratest/src/Coverage/CoverageMerger.php:59
ParaTest\Coverage\CoverageMerger->addCoverageFromFile() at /root/project/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php:118
ParaTest\Runners\PHPUnit\Runner->testIsStillRunning() at /root/project/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php:43
ParaTest\Runners\PHPUnit\Runner->doRun() at /root/project/vendor/brianium/paratest/src/Runners/PHPUnit/BaseRunner.php:81
ParaTest\Runners\PHPUnit\BaseRunner->run() at /root/project/vendor/brianium/paratest/src/Console/Commands/ParaTestCommand.php:84
ParaTest\Console\Commands\ParaTestCommand->execute() at /root/project/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /root/project/vendor/symfony/console/Application.php:971
Symfony\Component\Console\Application->doRunCommand() at /root/project/vendor/symfony/console/Application.php:290
Symfony\Component\Console\Application->doRun() at /root/project/vendor/symfony/console/Application.php:166
Symfony\Component\Console\Application->run() at /root/project/vendor/brianium/paratest/bin/paratest:37
Expected behavior
Test suite runs as expected and a code coverage report is compiled.
Additional information
Looking through the code, won’t this always happen?
TheCoverageMerger::addCoverageFromFile
function fails over on these conditions: ! is_file($coverageFile) || filesize($coverageFile) === 0
Which is previously calling ExecutableTest::touchTempFile
which will always be 0 size until data is added in (this is under the assumption that it is in fact a file, it just fails over on the size).
Apologies if the “Additional Information” is just my lack of understanding with the process.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 23 (5 by maintainers)
Yeah, thanks guys. Worked for me too with GitHub Actions:
I met the same problem. what is your Xdebug.mode? by default,it is devlop. when I change to
xdebug.mode=coverage
, paratest coverage test works! Here is my Xdebug config in php.iniI can confirm that setting
xdebug.mode=coverage
fixes the issue.Edit: …or it does not. I modified my CI pipeline like so:
After this change, it did work a few times - but then it failed on a later attempt. This error seems to come up somewhat randomly.