Skip to content

Commit 6f89da7

Browse files
committed
Adjust run-tests.php to dynamic extension loading
PR #6787 changed the behavior of the `--EXTENSIONS--` section, so that not yet loaded extensions are dynamically loaded if possible. However, when no tests are specified for the runner, only tests for already loaded extensions are run, what defeats the purpose of the improvement of the `--EXTENSIONS--` behavior. We cater to that by detecting loadable extensions, and also run their tests.
1 parent f57526a commit 6f89da7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

run-tests.php

+16-3
Original file line numberDiff line numberDiff line change
@@ -860,9 +860,22 @@ function write_information(): void
860860
}
861861
@unlink($info_file);
862862

863-
// load list of enabled extensions
864-
save_text($info_file,
865-
'<?php echo str_replace("Zend OPcache", "opcache", implode(",", get_loaded_extensions())); ?>');
863+
// load list of enabled and loadable extensions
864+
save_text($info_file, <<<'PHP'
865+
<?php
866+
echo str_replace("Zend OPcache", "opcache", implode(",", get_loaded_extensions()));
867+
$ext_dir = ini_get("extension_dir");
868+
foreach (scandir($ext_dir) as $file) {
869+
if (!preg_match('/^(?:php_)?([_a-zA-Z0-9]+)\.(?:so|dll)$/', $file, $matches)) {
870+
continue;
871+
}
872+
$ext = $matches[1];
873+
if (!extension_loaded($ext) && @dl($file)) {
874+
echo ",", $ext;
875+
}
876+
}
877+
?>
878+
PHP);
866879
$exts_to_test = explode(',', `$php $pass_options $info_params $no_file_cache "$info_file"`);
867880
// check for extensions that need special handling and regenerate
868881
$info_params_ex = [

0 commit comments

Comments
 (0)