fix: enhance support for --parallel and --teamcity arguments by restoring --teamcity for ParaTest and fixing teamcity output concurrency

This commit is contained in:
Ilia Smirnov
2026-01-27 16:16:03 +01:00
parent dd01229d7b
commit e6f511302b
3 changed files with 21 additions and 6 deletions

View File

@ -127,7 +127,9 @@ final class Parallel implements HandlesArguments
$arguments $arguments
); );
$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput); $filteredArguments = $this->processTeamcityArguments($filteredArguments);
$exitCode = $this->paratestCommand()->run(new ArgvInput(array_values($filteredArguments)), new CleanConsoleOutput);
return CallsAddsOutput::execute($exitCode); return CallsAddsOutput::execute($exitCode);
} }
@ -197,4 +199,18 @@ final class Parallel implements HandlesArguments
return $this->popArgument('-p', $arguments); return $this->popArgument('-p', $arguments);
} }
/**
* @param string[] $arguments
* @return string[]
*/
public function processTeamcityArguments(array $arguments): array
{
$argv = new ArgvInput;
if ($argv->hasParameterOption('--teamcity')) {
$arguments[] = '--teamcity';
}
return $arguments;
}
} }

View File

@ -92,14 +92,13 @@ final class ResultPrinter
$this->teamcityLogFileHandle = $teamcityLogFileHandle; $this->teamcityLogFileHandle = $teamcityLogFileHandle;
} }
/** @param list<SplFileInfo> $teamcityFiles */
public function printFeedback( public function printFeedback(
SplFileInfo $progressFile, SplFileInfo $progressFile,
SplFileInfo $outputFile, SplFileInfo $outputFile,
array $teamcityFiles ?SplFileInfo $teamcityFile,
): void { ): void {
if ($this->options->needsTeamcity) { if ($this->options->needsTeamcity && $teamcityFile instanceof SplFileInfo) {
$teamcityProgress = $this->tailMultiple($teamcityFiles); $teamcityProgress = $this->tailMultiple([$teamcityFile]);
if ($this->teamcityLogFileHandle !== null) { if ($this->teamcityLogFileHandle !== null) {
fwrite($this->teamcityLogFileHandle, $teamcityProgress); fwrite($this->teamcityLogFileHandle, $teamcityProgress);

View File

@ -225,7 +225,7 @@ final class WrapperRunner implements RunnerInterface
$this->printer->printFeedback( $this->printer->printFeedback(
$worker->progressFile, $worker->progressFile,
$worker->unexpectedOutputFile, $worker->unexpectedOutputFile,
$this->teamcityFiles, $worker->teamcityFile ?? null,
); );
$worker->reset(); $worker->reset();
} }