mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Add retry mechanism in run-tests.php
This commit is contained in:
commit
81b2d2ee45
@ -1807,6 +1807,10 @@ function run_test(string $php, $file, array $env): string
|
||||
$skipCache = new SkipCache($enableSkipCache, $cfg['keep']['skip']);
|
||||
}
|
||||
|
||||
$retriable = true;
|
||||
$retried = false;
|
||||
retry:
|
||||
|
||||
$temp_filenames = null;
|
||||
$org_file = $file;
|
||||
$orig_php = $php;
|
||||
@ -1846,8 +1850,11 @@ TEST $file
|
||||
|
||||
$tested = $test->getName();
|
||||
|
||||
if ($num_repeats > 1 && $test->hasSection('FILE_EXTERNAL')) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'Test with FILE_EXTERNAL might not be repeatable');
|
||||
if ($test->hasSection('FILE_EXTERNAL')) {
|
||||
$retriable = false;
|
||||
if ($num_repeats > 1) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'Test with FILE_EXTERNAL might not be repeatable');
|
||||
}
|
||||
}
|
||||
|
||||
if ($test->hasSection('CAPTURE_STDIO')) {
|
||||
@ -1873,6 +1880,7 @@ TEST $file
|
||||
}
|
||||
$php = $php_cgi . ' -C ';
|
||||
$uses_cgi = true;
|
||||
$retriable = false;
|
||||
if ($num_repeats > 1) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'CGI does not support --repeat');
|
||||
}
|
||||
@ -1890,20 +1898,18 @@ TEST $file
|
||||
} else {
|
||||
return skip_test($tested, $tested_file, $shortname, 'phpdbg not available');
|
||||
}
|
||||
$retriable = false;
|
||||
if ($num_repeats > 1) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'phpdbg does not support --repeat');
|
||||
}
|
||||
}
|
||||
|
||||
if ($num_repeats > 1) {
|
||||
if ($test->hasSection('CLEAN')) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'Test with CLEAN might not be repeatable');
|
||||
}
|
||||
if ($test->hasSection('STDIN')) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'Test with STDIN might not be repeatable');
|
||||
}
|
||||
if ($test->hasSection('CAPTURE_STDIO')) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'Test with CAPTURE_STDIO might not be repeatable');
|
||||
foreach (['CLEAN', 'STDIN', 'CAPTURE_STDIO'] as $section) {
|
||||
if ($test->hasSection($section)) {
|
||||
$retriable = false;
|
||||
if ($num_repeats > 1) {
|
||||
return skip_test($tested, $tested_file, $shortname, "Test with $section might not be repeatable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2085,8 +2091,11 @@ TEST $file
|
||||
$ini = preg_replace('/{MAIL:(\S+)}/', $replacement, $ini);
|
||||
settings2array(preg_split("/[\n\r]+/", $ini), $ini_settings);
|
||||
|
||||
if ($num_repeats > 1 && isset($ini_settings['opcache.opt_debug_level'])) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'opt_debug_level tests are not repeatable');
|
||||
if (isset($ini_settings['opcache.opt_debug_level'])) {
|
||||
$retriable = false;
|
||||
if ($num_repeats > 1) {
|
||||
return skip_test($tested, $tested_file, $shortname, 'opt_debug_level tests are not repeatable');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2617,6 +2626,10 @@ COMMAND $cmd
|
||||
|
||||
$wanted_re = null;
|
||||
}
|
||||
if (!$passed && !$retried && $retriable && error_may_be_retried($output)) {
|
||||
$retried = true;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
if ($passed) {
|
||||
if (!$cfg['keep']['php'] && !$leaked) {
|
||||
@ -2647,6 +2660,9 @@ COMMAND $cmd
|
||||
} elseif ($test->hasSection('XLEAK')) {
|
||||
$warn = true;
|
||||
$info = " (warn: XLEAK section but test passes)";
|
||||
} elseif ($retried) {
|
||||
$warn = true;
|
||||
$info = " (warn: Test passed on retry attempt)";
|
||||
} else {
|
||||
show_result("PASS", $tested, $tested_file, '', $temp_filenames);
|
||||
$junit->markTestAs('PASS', $shortname, $tested);
|
||||
@ -2790,6 +2806,11 @@ SH;
|
||||
return $restype[0] . 'ED';
|
||||
}
|
||||
|
||||
function error_may_be_retried(string $output): bool
|
||||
{
|
||||
return preg_match('((timed out)|(connection refused))i', $output) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|int
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user