Skip to content

Load extensions on demand for AppVeyor CI #6993

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 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion appveyor/build_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if %errorlevel% neq 0 exit /b 3
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%

set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_firebird,ldap,imap,ftp
set EXT_EXCLUDE_FROM_TEST=bz2,exif,fileinfo,ffi,ftp,gmp,imap,ldap,oci8_12c,pdo_firebird,pdo_oci,snmp,soap,sodium,sqlite3,tidy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to convert this into a whitelist rather than a blacklist? I think that will make more sense going forward.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is passed to the config option --with-test-ini-ext-exclude where blacklisting generally makes sense (it's only used if --enable-snapshot-build is also given, and usually you want to work with all available extensions).

For the test runner on AppVeyor, whitelisting would make more sense in the long run; would be trivial to change if it wasn't batch sctipting. I'll try to have a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitelist would be nice going forward, but I think we can land this as-is. Maybe add a comment that (most of) these are actually tested, just loaded via --EXTENSIONS--.

if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache

set CFLAGS=/W1 /WX
Expand Down
19 changes: 16 additions & 3 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,22 @@ function write_information(): void
}
@unlink($info_file);

// load list of enabled extensions
save_text($info_file,
'<?php echo str_replace("Zend OPcache", "opcache", implode(",", get_loaded_extensions())); ?>');
// load list of enabled and loadable extensions
save_text($info_file, <<<'PHP'
<?php
echo str_replace("Zend OPcache", "opcache", implode(",", get_loaded_extensions()));
$ext_dir = ini_get("extension_dir");
foreach (scandir($ext_dir) as $file) {
if (!preg_match('/^(?:php_)?([_a-zA-Z0-9]+)\.(?:so|dll)$/', $file, $matches)) {
continue;
}
$ext = $matches[1];
if (!extension_loaded($ext) && @dl($file)) {
echo ",", $ext;
}
}
?>
PHP);
$exts_to_test = explode(',', `$php $pass_options $info_params $no_file_cache "$info_file"`);
// check for extensions that need special handling and regenerate
$info_params_ex = [
Expand Down