From dba4d832f0f4e3589aef015b0e24fdf4edd8eccb Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sat, 25 Jul 2026 11:42:14 +0200 Subject: [PATCH 1/3] Fix run-tests.php --file-cache-prime with multiple workers We want to remove the directory only before running tests, rather than for every test. That causes races, but also defeats the purpose of priming the cache. --- run-tests.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/run-tests.php b/run-tests.php index 1d8be660388d..998e7e24c337 100755 --- a/run-tests.php +++ b/run-tests.php @@ -700,6 +700,12 @@ function main(): void verify_config($php); write_information($user_tests, $phpdbg); + if ($file_cache === 'prime') { + $cache_dir = get_file_cache_dir(); + rmdir_recursive($cache_dir); + mkdir($cache_dir, recursive: true); + } + if ($test_cnt) { $exts_tested = []; $exts_skipped = []; @@ -1054,6 +1060,11 @@ function find_files(string $dir, bool $is_ext_dir = false, bool $ignore = false) closedir($o); } +function get_file_cache_dir(): string +{ + return sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-run-tests-file-cache'; +} + function rmdir_recursive($dir) { if (!file_exists($dir)) { @@ -2091,11 +2102,7 @@ function run_test(string $php, $file, array $env): string $orig_ini_settings = settings2params($ini_settings); if ($file_cache !== null) { - $ini_settings['opcache.file_cache'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-run-tests-file-cache'; - if ($file_cache === 'prime') { - rmdir_recursive($ini_settings['opcache.file_cache']); - mkdir($ini_settings['opcache.file_cache'], recursive: true); - } + $ini_settings['opcache.file_cache'] = get_file_cache_dir(); // Make sure warnings still show up on the second run. $ini_settings['opcache.record_warnings'] = '1'; // File cache is currently incompatible with JIT. From 5ea808aa1b2e372b8d18c897fc23ac2a7c6277fb Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sat, 25 Jul 2026 13:17:03 +0200 Subject: [PATCH 2/3] Move opcache.opt_debug_level tests These need to live in ext/opcache/tests to be skipped by run-tests.php for the --file-cache-use tests, which won't compile the files and thus won't dump the output. --- .../tests/array_map_foreach_optimization_007.phpt} | 0 .../tests/array_map_foreach_optimization_008.phpt} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename ext/{standard/tests/array/array_map_foreach_optimization_006.phpt => opcache/tests/array_map_foreach_optimization_007.phpt} (100%) rename ext/{standard/tests/array/array_map_foreach_optimization_007.phpt => opcache/tests/array_map_foreach_optimization_008.phpt} (100%) diff --git a/ext/standard/tests/array/array_map_foreach_optimization_006.phpt b/ext/opcache/tests/array_map_foreach_optimization_007.phpt similarity index 100% rename from ext/standard/tests/array/array_map_foreach_optimization_006.phpt rename to ext/opcache/tests/array_map_foreach_optimization_007.phpt diff --git a/ext/standard/tests/array/array_map_foreach_optimization_007.phpt b/ext/opcache/tests/array_map_foreach_optimization_008.phpt similarity index 100% rename from ext/standard/tests/array/array_map_foreach_optimization_007.phpt rename to ext/opcache/tests/array_map_foreach_optimization_008.phpt From 7f59d5c5761759cf35031ec46edcd5572b439026 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sat, 25 Jul 2026 17:32:25 +0200 Subject: [PATCH 3/3] Mark preloading test as opcache.file_cache_only=0 Preloading requires shm. --- Zend/tests/partial_application/preloading.phpt | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/tests/partial_application/preloading.phpt b/Zend/tests/partial_application/preloading.phpt index 23ad6edf2c4c..ccbbf2290811 100644 --- a/Zend/tests/partial_application/preloading.phpt +++ b/Zend/tests/partial_application/preloading.phpt @@ -4,6 +4,7 @@ PFA preloading opcache.enable=1 opcache.enable_cli=1 opcache.preload={PWD}/preloading.inc +opcache.file_cache_only=0 --SKIPIF--