Skip to content

Commit 6e7bb98

Browse files
committed
MQE-2669: bin/mftf run:failed process used a lot of RAM during MTSv1 build
1 parent 37683bb commit 6e7bb98

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ protected function configure()
5959
*/
6060
protected function execute(InputInterface $input, OutputInterface $output): int
6161
{
62+
$this->testsFailedFile = $this->getTestsOutputDir() . self::FAILED_FILE;
63+
$this->testsReRunFile = $this->getTestsOutputDir() . "rerun_tests";
64+
$failedTestList = $this->readFailedTestFile($this->testsFailedFile);
65+
6266
$this->testsManifestFile= FilePathFormatter::format(TESTS_MODULE_PATH) .
6367
"_generated" .
6468
DIRECTORY_SEPARATOR .
@@ -67,6 +71,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6771
$testManifestList = $this->readTestManifestFile();
6872
$returnCode = 0;
6973
for ($i = 0; $i < count($testManifestList); $i++) {
74+
if (in_array($testManifestList[$i], $failedTestList) === false) {
75+
continue;
76+
}
7077
if ($this->pauseEnabled()) {
7178
$codeceptionCommand = self::CODECEPT_RUN_FUNCTIONAL . $testManifestList[$i] . ' --debug ';
7279
if ($i !== count($testManifestList) - 1) {
@@ -86,6 +93,7 @@ function ($type, $buffer) use ($output) {
8693
$output->write($buffer);
8794
}
8895
));
96+
$process->__destruct();
8997
}
9098

9199
if (file_exists($this->testsFailedFile)) {
@@ -121,7 +129,14 @@ private function readTestManifestFile()
121129
*/
122130
private function readFailedTestFile($filePath)
123131
{
124-
return file($filePath, FILE_IGNORE_NEW_LINES);
132+
$failedTests = file($filePath, FILE_IGNORE_NEW_LINES);
133+
if ($failedTests !== false) {
134+
foreach ($failedTests as $key => $failedTest) {
135+
list($filePath) = explode(":", $failedTest);
136+
$failedTests[$key] = $filePath;
137+
}
138+
}
139+
return $failedTests;
125140
}
126141

127142
/**

0 commit comments

Comments
 (0)