Skip to content

Commit 7bcfac9

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Automatically mark tests as flaky
2 parents 5aeada0 + 082219b commit 7bcfac9

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

run-tests.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2831,10 +2831,30 @@ function run_test(string $php, $file, array $env): string
28312831
return $restype[0] . 'ED';
28322832
}
28332833

2834+
function is_flaky(TestFile $test): bool
2835+
{
2836+
if ($test->hasSection('FLAKY')) {
2837+
return true;
2838+
}
2839+
if (!$test->hasSection('FILE')) {
2840+
return false;
2841+
}
2842+
$file = $test->getSection('FILE');
2843+
$flaky_functions = [
2844+
'disk_free_space',
2845+
'hrtime',
2846+
'microtime',
2847+
'sleep',
2848+
'usleep',
2849+
];
2850+
$regex = '(\b(' . implode('|', $flaky_functions) . ')\()i';
2851+
return preg_match($regex, $file) === 1;
2852+
}
2853+
28342854
function error_may_be_retried(TestFile $test, string $output): bool
28352855
{
28362856
return preg_match('((timed out)|(connection refused)|(404: page not found)|(address already in use)|(mailbox already exists))i', $output) === 1
2837-
|| $test->hasSection('FLAKY');
2857+
|| is_flaky($test);
28382858
}
28392859

28402860
function expectf_to_regex(?string $wanted): string

0 commit comments

Comments
 (0)