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

Use temporary file (instead of STDOUT) to communicate result from child process to parent process #5290

Conversation

sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Mar 25, 2023

I recently worked with an application that used an unusual combination of output buffering, custom error handling, custom exception handling, and custom shutdown handling.

The way this application works got in the way of writing edge-to-edge characterization tests for the application: trying to run such a test in a separate PHP process (using PHPUnit's process isolation functionality) did not work.

The application's custom error handler acted on E_DEPRECATED events emitted by the PHP interpreter for code generated by PHPUnit. This was taken care of in #5270.

The application's use of output buffering interfered with the way that PHPUnit currently communicated results from a child process to the parent process.

These changes made PHPUnit's process isolation functionality work in the context of that application. They also do not break any existing test. However, they feel like a short-term solution for an edge case problem.

Considering other problems such as #5230, I would much rather completely rethink how process isolation should work.

@sebastianbergmann sebastianbergmann added feature/test-runner CLI test runner feature/process-isolation Issues related to running tests in separate PHP processes labels Mar 25, 2023
@codecov
Copy link

codecov bot commented Mar 25, 2023

Codecov Report

Merging #5290 (9ea7248) into main (302327c) will increase coverage by 0.03%.
The diff coverage is 90.90%.

@@             Coverage Diff              @@
##               main    #5290      +/-   ##
============================================
+ Coverage     84.89%   84.92%   +0.03%     
+ Complexity     6110     6108       -2     
============================================
  Files           651      651              
  Lines         19355    19343      -12     
============================================
- Hits          16431    16428       -3     
+ Misses         2924     2915       -9     
Impacted Files Coverage Δ
src/Util/PHP/AbstractPhpProcess.php 85.04% <88.57%> (+5.70%) ⬆️
src/Framework/TestRunner.php 87.09% <100.00%> (+0.10%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sebastianbergmann sebastianbergmann force-pushed the do-not-use-stdout-to-communicate-result-from-child-process-to-parent-process branch from da067ac to 9ea7248 Compare May 10, 2023 05:02
@sebastianbergmann sebastianbergmann deleted the do-not-use-stdout-to-communicate-result-from-child-process-to-parent-process branch October 24, 2023 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/process-isolation Issues related to running tests in separate PHP processes feature/test-runner CLI test runner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant