-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
phpunit on PHP 7.2 or 7.3 can exit with 0 status when there are test fails #34858
Comments
@PVince81 I noticed this behavior when looking at unit test results related to the This is a separate issue, but it is concerning that "we" can cause |
any update ? was the attempted PHPUnit update related to solving this ? |
I tried on PHPUnit6 and PHPUnit7 - the example way to induce failing tests (in original post at top) fails the test(s) but still exits with status 0, so bumping major versions of PHPUnit does not help. I started trying with PHPUnit8, but that has more backward-compatibility breaks, which requires more test code refactoring to make it run. And it only supports PHP7.2+ so it would be nowhere near being useable by us just yet anyway. So I will not spend time on that! Now that we dropped PHP5.6, the PHPUnit6 bump is good to have anyway. PHPUnit5 is a long way out of support. So I listed that as a task for "drop PHP5.6". The core PRs are ready. I have a passing PHPUnit7 PR in core master. That will be useful when we drop PHP7.0 - it can be easily applied to master and backported to stable10. So I will leave it there and mark it "blocked". We do not want to merge it just to master - that will create confusion between master and stable10 for no good reason. |
The next step for this issue could be:
|
@phil-davis In order to be 100% certain that a test succeeded, we should pass the results from phpunits log/output and base the assessment on this |
^ @patrickjahns yes, I have come to that conclusion - phpunit 6 and 7 have the same exit status misbehavior, so it has not been corrected in phpunit in the last few years. |
Maybe do this after we drop PHP7.0 and move up to phpunit7. |
I haven't seen this problem for a long time. We are on phpunit 9.5 now. |
See PR #34972 and #34857 for a demo of the behavior:
If I break
tests/lib/legacy/AppTest.php
(see first commit for dumb easy example), then thephpunit
test runs on drone:phpdbg
and collecting coverage (all the drone coverage build jobs correctly report the 6 purposely induced unit test fails and exit with non-zero status) e.g. https://drone.owncloud.com/owncloud/core/16325/29 and https://drone.owncloud.com/owncloud/core/16325/38phpunit
(also correctly reports the 6 purposely induced unit test fails... like the previous point) e.g. https://drone.owncloud.com/owncloud/core/16325/47phpunit
(the 6 purposely induced unit test fails are logged byphpunit
butphpunit
exits with status 0) this is a bad thingPR #34972 has a cut-down example of the offending behavior.
tests/lib/legacy/AppTest.php
so that we expect to get 6 test fails.tests/phpunit-autotest.xml
to not bother running unit tests that did not effect the resulttests/apps.php
so it only runs tests from thefiles
appapps/files/tests/Command/ScanTest.php
ScanTest
to just a single simplified test caseRunning this results in the above behavior - some PHP7.2 and PHP 7.3 unit test runs come out with a "pass" on drone when actually 6 tests failed.
PR #34857 also has:
ScanTest.php
out of the way, and puts the otherCommand
tests back. In drone job https://drone.owncloud.com/owncloud/core/16326 all the phpunit jobs correctly report failure of 6 unit tests.That demonstrates that it is something to do with
ScanTest
that messes upphpunit
on PHP 7.2 and 7.3The text was updated successfully, but these errors were encountered: