Skip to content

Commit c05c96b

Browse files
committed
Fix GH-8691 Add required extensions for redirected tests
1 parent 938049b commit c05c96b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

run-tests.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2093,11 +2093,19 @@ function run_test(string $php, $file, array $env): string
20932093
$ini_settings = $workerID ? ['opcache.cache_id' => "worker$workerID"] : [];
20942094

20952095
// Additional required extensions
2096+
$extensions = [];
20962097
if ($test->hasSection('EXTENSIONS')) {
2098+
$extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS')));
2099+
}
2100+
if (is_array($IN_REDIRECT) && $IN_REDIRECT['EXTENSIONS'] != []) {
2101+
$extensions = array_merge($extensions, $IN_REDIRECT['EXTENSIONS']);
2102+
}
2103+
2104+
/* Load required extensions */
2105+
if ($extensions != []) {
20972106
$ext_params = [];
20982107
settings2array($ini_overwrites, $ext_params);
20992108
$ext_params = settings2params($ext_params);
2100-
$extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS')));
21012109
[$ext_dir, $loaded] = $skipCache->getExtensions("$orig_php $pass_options $extra_options $ext_params $no_file_cache");
21022110
$ext_prefix = IS_WINDOWS ? "php_" : "";
21032111
$missing = [];
@@ -2249,6 +2257,7 @@ function run_test(string $php, $file, array $env): string
22492257
$IN_REDIRECT['via'] = "via [$shortname]\n\t";
22502258
$IN_REDIRECT['dir'] = realpath(dirname($file));
22512259
$IN_REDIRECT['prefix'] = $tested;
2260+
$IN_REDIRECT['EXTENSIONS'] = $extensions;
22522261

22532262
if (!empty($IN_REDIRECT['TESTS'])) {
22542263
if (is_array($org_file)) {
@@ -3403,6 +3412,9 @@ class JUnit
34033412
'execution_time' => 0,
34043413
];
34053414

3415+
/**
3416+
* @throws Exception
3417+
*/
34063418
public function __construct(array $env, int $workerID)
34073419
{
34083420
// Check whether a junit log is wanted.
@@ -3620,6 +3632,9 @@ public function initSuite(string $suite_name): void
36203632
$this->suites[$suite_name] = self::EMPTY_SUITE + ['name' => $suite_name];
36213633
}
36223634

3635+
/**
3636+
* @throws Exception
3637+
*/
36233638
public function stopTimer(string $file_name): void
36243639
{
36253640
if (!$this->enabled) {
@@ -3819,6 +3834,9 @@ class TestFile
38193834
'CREDITS', 'DESCRIPTION', 'CONFLICTS', 'WHITESPACE_SENSITIVE',
38203835
];
38213836

3837+
/**
3838+
* @throws BorkageException
3839+
*/
38223840
public function __construct(string $fileName, bool $inRedirect)
38233841
{
38243842
$this->fileName = $fileName;
@@ -3859,6 +3877,9 @@ public function sectionNotEmpty(string $name): bool
38593877
return !empty($this->sections[$name]);
38603878
}
38613879

3880+
/**
3881+
* @throws Exception
3882+
*/
38623883
public function getSection(string $name): string
38633884
{
38643885
if (!isset($this->sections[$name])) {
@@ -3895,6 +3916,7 @@ public function setSection(string $name, string $value): void
38953916

38963917
/**
38973918
* Load the sections of the test file
3919+
* @throws BorkageException
38983920
*/
38993921
private function readFile(): void
39003922
{
@@ -3957,6 +3979,9 @@ private function readFile(): void
39573979
fclose($fp);
39583980
}
39593981

3982+
/**
3983+
* @throws BorkageException
3984+
*/
39603985
private function validateAndProcess(bool $inRedirect): void
39613986
{
39623987
// the redirect section allows a set of tests to be reused outside of

0 commit comments

Comments
 (0)