Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Automatically mark tests as flaky
  • Loading branch information
iluuu1994 committed Nov 15, 2023
2 parents 5aeada0 + 082219b commit 7bcfac9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2831,10 +2831,30 @@ function run_test(string $php, $file, array $env): string
return $restype[0] . 'ED';
}

function is_flaky(TestFile $test): bool
{
if ($test->hasSection('FLAKY')) {
return true;
}
if (!$test->hasSection('FILE')) {
return false;
}
$file = $test->getSection('FILE');
$flaky_functions = [
'disk_free_space',
'hrtime',
'microtime',
'sleep',
'usleep',
];
$regex = '(\b(' . implode('|', $flaky_functions) . ')\()i';
return preg_match($regex, $file) === 1;
}

function error_may_be_retried(TestFile $test, string $output): bool
{
return preg_match('((timed out)|(connection refused)|(404: page not found)|(address already in use)|(mailbox already exists))i', $output) === 1
|| $test->hasSection('FLAKY');
|| is_flaky($test);
}

function expectf_to_regex(?string $wanted): string
Expand Down

0 comments on commit 7bcfac9

Please sign in to comment.