Skip to content

Share source map with child processes for process isolation#6495

Merged
sebastianbergmann merged 4 commits into11.5from
share-source-with-child-processed-for-process-isolation
Feb 7, 2026
Merged

Share source map with child processes for process isolation#6495
sebastianbergmann merged 4 commits into11.5from
share-source-with-child-processed-for-process-isolation

Conversation

@sebastianbergmann
Copy link
Copy Markdown
Owner

Make the map generated in the parent process using SourceMapper::map() available in child processes to avoid generating the map using expensive filesystem operations more than once.

See #6493 for context and motivation.

Two new static methods are added to SourceMapper to enable serializing/deserializing the source map:

  • saveTo(string $path, Source $source): bool computes the source map via map(), serializes it, and writes it to a file in the system's temporary directory
  • loadFrom(string $path, Source $source): void Reads a serialized source map from a file and populates the static $files cache, skipping the expensive filesystem operations

The new static property SeparateProcessTestRunner::$sourceMapFile is used to cache the temporary file path across invocations (computed once, reused for all child processes). It is managed through the new private method sourceMapFileForChildProcess().

@sebastianbergmann sebastianbergmann self-assigned this Feb 7, 2026
@sebastianbergmann sebastianbergmann added type/performance Issues related to resource consumption (time and memory) feature/process-isolation Issues related to running tests in separate PHP processes version/11 Something affects PHPUnit 11 version/12 Something affects PHPUnit 12 feature/issues Issues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP code version/13 Something affects PHPUnit 13 labels Feb 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.39%. Comparing base (ad14159) to head (18d33c6).
⚠️ Report is 5 commits behind head on 11.5.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               11.5    #6495      +/-   ##
============================================
+ Coverage     95.38%   95.39%   +0.01%     
- Complexity     7154     7161       +7     
============================================
  Files           738      738              
  Lines         21864    21882      +18     
============================================
+ Hits          20854    20875      +21     
+ Misses         1010     1007       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianbergmann sebastianbergmann merged commit 121effe into 11.5 Feb 7, 2026
72 checks passed
@sebastianbergmann sebastianbergmann deleted the share-source-with-child-processed-for-process-isolation branch February 7, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/issues Issues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP code feature/process-isolation Issues related to running tests in separate PHP processes type/performance Issues related to resource consumption (time and memory) version/11 Something affects PHPUnit 11 version/12 Something affects PHPUnit 12 version/13 Something affects PHPUnit 13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant