mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Automatically mark tests as flaky
This commit is contained in:
commit
082219ba0e
1 changed files with 21 additions and 1 deletions
|
@ -2833,10 +2833,30 @@ SH;
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue