From 4ba2c99bc9db3198c7260d0470917a3e061a9280 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sat, 5 Oct 2024 19:50:21 +0200 Subject: [PATCH 1/9] Implement support for tests loading all extensions When running the tests, extensions are already loaded, or are requested via the `--EXTENSIONS--` section explicitly. Some tests, though, would benefit from loading and testing all available extension. We make that possible by adding support for the `*` wildcard. --- Zend/tests/arginfo_zpp_mismatch.phpt | 2 ++ run-tests.php | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index d7aefc6f374f6..c1ee521c54973 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -5,6 +5,8 @@ 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-- hasSection('EXTENSIONS')) { $extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS'))); + if (in_array("*", $extensions, true)) { + $extensions = array_diff($exts_to_test, ["php8apache2_4", "php8phpdbg", "php8ts_debug"]); + } } if (is_array($IN_REDIRECT) && $IN_REDIRECT['EXTENSIONS'] != []) { $extensions = array_merge($extensions, $IN_REDIRECT['EXTENSIONS']); From 370a0a4fe2d6af2dd588daa9af3f598a205f7626 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 6 Oct 2024 15:52:08 +0200 Subject: [PATCH 2/9] Stricter check for extension names; avoid exclusion list --- run-tests.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-tests.php b/run-tests.php index bdf42dcaedc0e..27d783bac0dff 100755 --- a/run-tests.php +++ b/run-tests.php @@ -866,7 +866,7 @@ function write_information(array $user_tests, $phpdbg): void $exts = 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)) { + if (preg_match('/^(?:php_)([_a-zA-Z0-9]+)\.(?:so|dll)$/', $file, $matches)) { if (!extension_loaded($matches[1])) { $exts[] = $matches[1]; } @@ -2029,7 +2029,7 @@ function run_test(string $php, $file, array $env): string if ($test->hasSection('EXTENSIONS')) { $extensions = preg_split("/[\n\r]+/", trim($test->getSection('EXTENSIONS'))); if (in_array("*", $extensions, true)) { - $extensions = array_diff($exts_to_test, ["php8apache2_4", "php8phpdbg", "php8ts_debug"]); + $extensions = $exts_to_test; } } if (is_array($IN_REDIRECT) && $IN_REDIRECT['EXTENSIONS'] != []) { From becf31f36994f2cc99d9f3fa0df1956944e153ca Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 6 Oct 2024 15:52:52 +0200 Subject: [PATCH 3/9] Check whether arginfo_zpp_mismatch.phpt is run --- Zend/tests/arginfo_zpp_mismatch.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index c1ee521c54973..d969deff842ed 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -9,7 +9,7 @@ if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions") * --FILE-- Date: Mon, 7 Oct 2024 00:23:26 +0200 Subject: [PATCH 4/9] Revert "Check whether arginfo_zpp_mismatch.phpt is run" This reverts commit becf31f36994f2cc99d9f3fa0df1956944e153ca. --- Zend/tests/arginfo_zpp_mismatch.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index d969deff842ed..c1ee521c54973 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -9,7 +9,7 @@ if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions") * --FILE-- Date: Mon, 7 Oct 2024 00:24:59 +0200 Subject: [PATCH 5/9] Load all extensions for further relevant tests --- Zend/tests/arginfo_zpp_mismatch_strict.phpt | 2 ++ Zend/tests/instantiate_all_classes.phpt | 2 ++ Zend/tests/weakrefs/notify.phpt | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Zend/tests/arginfo_zpp_mismatch_strict.phpt b/Zend/tests/arginfo_zpp_mismatch_strict.phpt index ddee0bd29cfe4..244856fff1194 100644 --- a/Zend/tests/arginfo_zpp_mismatch_strict.phpt +++ b/Zend/tests/arginfo_zpp_mismatch_strict.phpt @@ -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-- Date: Mon, 7 Oct 2024 19:37:11 +0200 Subject: [PATCH 6/9] Use separate regexps for Windows and other platforms --- run-tests.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/run-tests.php b/run-tests.php index 27d783bac0dff..d737bf825c486 100755 --- a/run-tests.php +++ b/run-tests.php @@ -865,8 +865,13 @@ function write_information(array $user_tests, $phpdbg): void Date: Mon, 7 Oct 2024 19:38:02 +0200 Subject: [PATCH 7/9] Add * extensions to new_oom.phpt --- Zend/tests/new_oom.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/tests/new_oom.phpt b/Zend/tests/new_oom.phpt index a424e12b4eab9..a13a981b73f68 100644 --- a/Zend/tests/new_oom.phpt +++ b/Zend/tests/new_oom.phpt @@ -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-- Date: Mon, 7 Oct 2024 19:39:24 +0200 Subject: [PATCH 8/9] See which extensions are loaded --- Zend/tests/arginfo_zpp_mismatch.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index c1ee521c54973..cb40eecb47e66 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -9,7 +9,7 @@ if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions") * --FILE-- Date: Mon, 7 Oct 2024 21:14:00 +0200 Subject: [PATCH 9/9] D'oh! --- run-tests.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-tests.php b/run-tests.php index d737bf825c486..a3c188ea3ffbe 100755 --- a/run-tests.php +++ b/run-tests.php @@ -865,7 +865,7 @@ function write_information(array $user_tests, $phpdbg): void