phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

Implement PcntlForkJobRunner

Open staabm opened this issue 4 months ago • 1 comments

running php phpunit tests/end-to-end/phar/tests/standard/GreeterTest.php -c tests/end-to-end/phar/phpunit.xml with a fork Time: 00:00.005, Memory: 16.00 MB with a subprocess Time: 00:00.031, Memory: 16.00 MB

Todo

  • [x] implement PcntlForkJobRunner
  • [ ] make CI run with pcntl
  • [ ] fix tests
  • [ ] add attribute parameter to RunTestsInSeparateProcesses, RunInSeparateProcess to opt-in fork-mode

staabm avatar Aug 03 '25 19:08 staabm

currently one test is failling:

1) /Users/staabm/workspace/phpunit/tests/end-to-end/regression/5592-process-isolation.phpt
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 
 --
 
-There was 1 risky test:
+There were 2 risky tests:
 
 1) PHPUnit\TestFixture\Issue5592Test::testRemovedErrorHandler
 Test code or tested code removed error handlers other than its own
@@ @@
 
 /Users/staabm/workspace/phpunit/tests/end-to-end/regression/5592/Issue5592Test.php:33
 
+2) PHPUnit\TestFixture\Issue5592Test::testRemovedExceptionHandler
+Test code or tested code removed exception handlers other than its own
+
+/Users/staabm/workspace/phpunit/tests/end-to-end/regression/5592/Issue5592Test.php:52
+
 FAILURES!
-Tests: 6, Assertions: 6, Failures: 4, Risky: 1.
+Tests: 6, Assertions: 6, Failures: 4, Risky: 2.

/Users/staabm/workspace/phpunit/tests/end-to-end/regression/5592-process-isolation.phpt:45
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:374
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:374
/Users/staabm/workspace/phpunit/src/TextUI/TestRunner.php:64
/Users/staabm/workspace/phpunit/src/TextUI/Application.php:228

FAILURES!
Tests: 4591, Assertions: 12200, Failures: 1, Skipped: 23, Incomplete: 1.

... I wonder why https://github.com/sebastianbergmann/phpunit/commit/0e4f6d82c1365c49c1332634d36d5c4d6d005bb5 started to ignore "Test code or tested code did not remove its own error handlers" when test run in isolation, but did not the same for "Test code or tested code removed error handlers other than its own" ?

edit: answered in https://github.com/sebastianbergmann/phpunit/commit/0e4f6d82c1365c49c1332634d36d5c4d6d005bb5#r163466240

staabm avatar Aug 03 '25 20:08 staabm