Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour change with PHP7.2/PCOV1.0.4 #19

Closed
LeSuisse opened this issue Jun 10, 2019 · 2 comments
Closed

Behaviour change with PHP7.2/PCOV1.0.4 #19

LeSuisse opened this issue Jun 10, 2019 · 2 comments

Comments

@LeSuisse
Copy link

Hi,

I seem to encounter an issue when using PCOV 1.0.4 with PHP 7.2 (CentOS 7 env with packages from Remi repository):

$ /opt/remi/php72/root/usr/bin/php -d pcov.directory=. src/vendor/bin/phpunit --debug --config=tests/phpunit/phpunit.xml --coverage-clover=/tmp/coverage.xml tests/phpunit/common/Include/
PHPUnit 8.2.0 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.19 with PCOV 1.0.4
Configuration: /tuleap/tests/phpunit/phpunit.xml

Test 'Tuleap\CookieManagerTest::testCookiePrefixIsSet' started
Test 'Tuleap\CookieManagerTest::testCookiePrefixIsSet' ended
Test 'Tuleap\CookieManagerTest::testItDoesNotSetCookiePrefixIfHTTPSIsNotAvailable' started
Test 'Tuleap\CookieManagerTest::testItDoesNotSetCookiePrefixIfHTTPSIsNotAvailable' ended
Test 'Tuleap\CookieManagerTest::testCookiesRemoval' started
Test 'Tuleap\CookieManagerTest::testCookiesRemoval' ended
Test 'Tuleap\CookieManagerTest::testItDeterminesIfACookieCanUseSecureFlag' started
Test 'Tuleap\CookieManagerTest::testItDeterminesIfACookieCanUseSecureFlag' ended
PHP Fatal error:  Uncaught TypeError: is_file() expects parameter 1 to be a valid path, string given in /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php:72
Stack trace:
#0 /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php(72): is_file('\x00filtertestcase...')
#1 /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php(37): PHPUnit\Util\GlobalState::processIncludedFilesAsString(Array)
#2 /tuleap/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(736): PHPUnit\Util\GlobalState::getIncludedFilesAsString()
#3 /tuleap/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(568): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#4 /tuleap/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(568): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#5 /tuleap/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(619): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#6 /tuleap/src/vendor/phpunit/phpunit/src/TextUI/Command.php(201): PHPUnit\TextUI in /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php on line 72

The same tests run fine when using PHP 7.2/PCOV1.0.3 or PHP 7.3/PCOV1.0.4.

The issue seems to be caused by the usage of the PHPUnit feature @runInSeparateProcess in the next test the testsuite is supposed to execute (https://github.com/Enalean/tuleap/blob/d03d01a75616907f55c4317370861679850b4741/tests/phpunit/common/Include/LoaderSchedulerTest.php#L52).

I also tried to reproduce the issue on a smaller repository than my usual codebase without luck so I'm guessing the number of files covered also play a role.

I have setup a repository to play the tests on Travis to try to ease the reproduction, I got a different output on the failure (different defaults?) but still, it only fails when using PHP7.2/PCOV1.0.4:
https://travis-ci.com/LeSuisse/issue-php72-pcov104/builds/114996334
https://github.com/LeSuisse/issue-php72-pcov104

$ php -d pcov.directory=. src/vendor/bin/phpunit --debug --config=tests/phpunit/phpunit.xml --coverage-clover=coverage.xml tests/phpunit/common/Include/
PHPUnit 8.2.0 by Sebastian Bergmann and contributors.
Runtime:       PHP 7.2.16 with PCOV 1.0.4
Configuration: /home/travis/build/LeSuisse/issue-php72-pcov104/tuleap/tests/phpunit/phpunit.xml
Test 'Tuleap\CookieManagerTest::testCookiePrefixIsSet' started
/home/travis/.travis/functions: line 104: 10129 Segmentation fault      (core dumped) php -d pcov.directory=. src/vendor/bin/phpunit --debug --config=tests/phpunit/phpunit.xml --coverage-clover=coverage.xml tests/phpunit/common/Include/
krakjoe added a commit that referenced this issue Jun 10, 2019
@krakjoe
Copy link
Owner

krakjoe commented Jun 10, 2019

Try tip of develop please ?

@krakjoe krakjoe mentioned this issue Jun 10, 2019
@LeSuisse
Copy link
Author

I confirm it now works as expected, thanks!

https://travis-ci.com/LeSuisse/issue-php72-pcov104/builds/115033178

LeSuisse added a commit to Enalean/docker-tuleap-test-phpunit that referenced this issue Jun 11, 2019
PCOV 1.0.5 got released with a fix for the issue
krakjoe/pcov#19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants