Skip to content

Fix GH-8691 Add required extensions for redirected tests #8724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2010,11 +2010,19 @@ function run_test(string $php, $file, array $env): string
$ini_settings = $workerID ? ['opcache.cache_id' => "worker$workerID"] : [];

// Additional required extensions
$extensions = [];
if ($test->hasSection('EXTENSIONS')) {
$extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS')));
}
if (is_array($IN_REDIRECT) && $IN_REDIRECT['EXTENSIONS'] != []) {
$extensions = array_merge($extensions, $IN_REDIRECT['EXTENSIONS']);
}

/* Load required extensions */
if ($extensions != []) {
$ext_params = [];
settings2array($ini_overwrites, $ext_params);
$ext_params = settings2params($ext_params);
$extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS')));
[$ext_dir, $loaded] = $skipCache->getExtensions("$orig_php $pass_options $extra_options $ext_params $no_file_cache");
$ext_prefix = IS_WINDOWS ? "php_" : "";
$missing = [];
Expand Down Expand Up @@ -2166,6 +2174,7 @@ function run_test(string $php, $file, array $env): string
$IN_REDIRECT['via'] = "via [$shortname]\n\t";
$IN_REDIRECT['dir'] = realpath(dirname($file));
$IN_REDIRECT['prefix'] = $tested;
$IN_REDIRECT['EXTENSIONS'] = $extensions;

if (!empty($IN_REDIRECT['TESTS'])) {
if (is_array($org_file)) {
Expand Down Expand Up @@ -3323,6 +3332,9 @@ class JUnit
'execution_time' => 0,
];

/**
* @throws Exception
*/
public function __construct(array $env, int $workerID)
{
// Check whether a junit log is wanted.
Expand Down Expand Up @@ -3540,6 +3552,9 @@ public function initSuite(string $suite_name): void
$this->suites[$suite_name] = self::EMPTY_SUITE + ['name' => $suite_name];
}

/**
* @throws Exception
*/
public function stopTimer(string $file_name): void
{
if (!$this->enabled) {
Expand Down Expand Up @@ -3739,6 +3754,9 @@ class TestFile
'CREDITS', 'DESCRIPTION', 'CONFLICTS', 'WHITESPACE_SENSITIVE',
];

/**
* @throws BorkageException
*/
public function __construct(string $fileName, bool $inRedirect)
{
$this->fileName = $fileName;
Expand Down Expand Up @@ -3779,6 +3797,9 @@ public function sectionNotEmpty(string $name): bool
return !empty($this->sections[$name]);
}

/**
* @throws Exception
*/
public function getSection(string $name): string
{
if (!isset($this->sections[$name])) {
Expand Down Expand Up @@ -3815,6 +3836,7 @@ public function setSection(string $name, string $value): void

/**
* Load the sections of the test file
* @throws BorkageException
*/
private function readFile(): void
{
Expand Down Expand Up @@ -3877,6 +3899,9 @@ private function readFile(): void
fclose($fp);
}

/**
* @throws BorkageException
*/
private function validateAndProcess(bool $inRedirect): void
{
// the redirect section allows a set of tests to be reused outside of
Expand Down