mirror of
https://github.com/pestphp/pest.git
synced 2026-09-05 14:23:34 +02:00
Prevent memory exhaustion when generating TIA graphs with PCOV (#1875)
* fix(tia): preserve memory limit during pcov restart * chore: update test expectations * fix: stabilize tia replay test in ci
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Pest\Restarters\PcovRestarter;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
it('preserves the active memory limit in the restarted process', function (): void {
|
||||
$originalMemoryLimit = ini_get('memory_limit');
|
||||
|
||||
try {
|
||||
ini_set('memory_limit', '1234M');
|
||||
|
||||
$command = new ReflectionMethod(PcovRestarter::class, 'command')
|
||||
->invoke(new PcovRestarter, __DIR__, ['-r', 'fwrite(STDOUT, (string) ini_get("memory_limit"));']);
|
||||
|
||||
assert(is_array($command));
|
||||
|
||||
$process = new Process($command);
|
||||
$process->mustRun();
|
||||
|
||||
expect($process->getOutput())->toBe('1234M');
|
||||
} finally {
|
||||
ini_set('memory_limit', (string) $originalMemoryLimit);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user