Skip to content

Implement support for tests loading all extensions #16251

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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 3 additions & 1 deletion Zend/tests/arginfo_zpp_mismatch.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ Test that there is no arginfo/zpp mismatch
if (getenv('SKIP_ASAN')) die("skip Intermittently crashes lsan");
if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions");
?>
--EXTENSIONS--
*
--FILE--
<?php

var_dump(get_loaded_extensions());
require __DIR__ . "/arginfo_zpp_mismatch.inc";

function test($function) {
Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/arginfo_zpp_mismatch_strict.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Test that there is no arginfo/zpp mismatch in strict mode
if (getenv('SKIP_ASAN')) die("skip Intermittently crashes lsan");
if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions");
?>
--EXTENSIONS--
*
--FILE--
<?php

Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/instantiate_all_classes.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--TEST--
Try to instantiate all classes without arguments
--EXTENSIONS--
*
--FILE--
<?php

Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/new_oom.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Test OOM on new of each class
if (getenv("USE_ZEND_ALLOC") === "0") die("skip requires zmm");
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
?>
--EXTENSIONS--
*
--FILE--
<?php

Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/weakrefs/notify.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--TEST--
Object free handler must call zend_weakrefs_notify
--EXTENSIONS--
*
--FILE--
<?php

Expand Down
11 changes: 10 additions & 1 deletion run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,13 @@ function write_information(array $user_tests, $phpdbg): void
<?php
$exts = get_loaded_extensions();
$ext_dir = ini_get('extension_dir');
if (PHP_OS_FAMILY !== "Windows") {
$regex = '/^([_a-zA-Z0-9]+)\.so$/';
} else {
$regex = '/^(?:php_)([_a-zA-Z0-9]+)\.dll$/';
}
foreach (scandir($ext_dir) as $file) {
if (preg_match('/^(?:php_)?([_a-zA-Z0-9]+)\.(?:so|dll)$/', $file, $matches)) {
if (preg_match($regex, $file, $matches)) {
if (!extension_loaded($matches[1])) {
$exts[] = $matches[1];
}
Expand Down Expand Up @@ -1813,6 +1818,7 @@ function run_test(string $php, $file, array $env): string
global $slow_min_ms;
global $preload, $file_cache;
global $num_repeats;
global $exts_to_test;
// Parallel testing
global $workerID;
global $show_progress;
Expand Down Expand Up @@ -2027,6 +2033,9 @@ function run_test(string $php, $file, array $env): string
$extensions = [];
if ($test->hasSection('EXTENSIONS')) {
$extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS')));
if (in_array("*", $extensions, true)) {
$extensions = $exts_to_test;
}
}
if (is_array($IN_REDIRECT) && $IN_REDIRECT['EXTENSIONS'] != []) {
$extensions = array_merge($extensions, $IN_REDIRECT['EXTENSIONS']);
Expand Down
Loading