diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-20 10:04:57 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-20 15:29:32 +0200 |
commit | 0374cf08c7566457007206af7fcfe44306dcd13b (patch) | |
tree | 239c4158fd1a0f3a4dd1333cb3a90426566ca330 | |
parent | 40b59cee8ad9a4326c26bad55ae58c5def8e40d7 (diff) | |
download | php-git-0374cf08c7566457007206af7fcfe44306dcd13b.tar.gz |
Add --file-cache-prime/use options to run-tests
--file-cache-prime populates the file cache,
--file-cache-use uses the file cache.
And fix a number of tests to run under file cache or disabled
timestamp validation.
-rw-r--r-- | ext/ffi/tests/300.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/create_new_and_modify.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/delete_in_phar.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/delete_in_phar_confirm.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/front.phar.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/tar/create_new_and_modify.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/tar/delete_in_phar.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/tar/delete_in_phar_confirm.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/tar/tar_004.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/zip/create_new_and_modify.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/zip/delete_in_phar.phpt | 1 | ||||
-rw-r--r-- | ext/phar/tests/zip/delete_in_phar_confirm.phpt | 1 | ||||
-rwxr-xr-x | run-tests.php | 43 | ||||
-rw-r--r-- | sapi/phpdbg/tests/info_001.phpt | 2 |
14 files changed, 51 insertions, 6 deletions
diff --git a/ext/ffi/tests/300.phpt b/ext/ffi/tests/300.phpt index 8cf68736be..fd81498026 100644 --- a/ext/ffi/tests/300.phpt +++ b/ext/ffi/tests/300.phpt @@ -10,6 +10,7 @@ opcache.enable=1 opcache.enable_cli=1 opcache.optimization_level=-1 opcache.preload={PWD}/preload.inc +opcache.file_cache_only=0 --FILE-- <?php $ffi = FFI::scope("TEST_300"); diff --git a/ext/phar/tests/create_new_and_modify.phpt b/ext/phar/tests/create_new_and_modify.phpt index 738efb797f..ed01a63122 100644 --- a/ext/phar/tests/create_new_and_modify.phpt +++ b/ext/phar/tests/create_new_and_modify.phpt @@ -5,6 +5,7 @@ Phar: create and modify phar --INI-- phar.readonly=0 phar.require_hash=1 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/ext/phar/tests/delete_in_phar.phpt b/ext/phar/tests/delete_in_phar.phpt index 4cf2f3b439..d58ce21a9d 100644 --- a/ext/phar/tests/delete_in_phar.phpt +++ b/ext/phar/tests/delete_in_phar.phpt @@ -5,6 +5,7 @@ Phar: delete a file within a .phar --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'; diff --git a/ext/phar/tests/delete_in_phar_confirm.phpt b/ext/phar/tests/delete_in_phar_confirm.phpt index 90401bb5cc..b4acf6aa46 100644 --- a/ext/phar/tests/delete_in_phar_confirm.phpt +++ b/ext/phar/tests/delete_in_phar_confirm.phpt @@ -5,6 +5,7 @@ Phar: delete a file within a .phar (confirm disk file is changed) --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php'; diff --git a/ext/phar/tests/front.phar.phpt b/ext/phar/tests/front.phar.phpt index bab8ada0fd..8763c8801f 100644 --- a/ext/phar/tests/front.phar.phpt +++ b/ext/phar/tests/front.phar.phpt @@ -2,6 +2,7 @@ Phar front controller with mounted external file --INI-- default_charset=UTF-8 +opcache.validate_timestamps=1 --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); ?> --ENV-- diff --git a/ext/phar/tests/tar/create_new_and_modify.phpt b/ext/phar/tests/tar/create_new_and_modify.phpt index 355b69399e..75cb537aa8 100644 --- a/ext/phar/tests/tar/create_new_and_modify.phpt +++ b/ext/phar/tests/tar/create_new_and_modify.phpt @@ -4,6 +4,7 @@ Phar: create and modify tar-based phar <?php if (!extension_loaded("phar")) die("skip"); ?> --INI-- phar.readonly=0 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/ext/phar/tests/tar/delete_in_phar.phpt b/ext/phar/tests/tar/delete_in_phar.phpt index 948260b385..9d8f6cb456 100644 --- a/ext/phar/tests/tar/delete_in_phar.phpt +++ b/ext/phar/tests/tar/delete_in_phar.phpt @@ -5,6 +5,7 @@ Phar: delete a file within a tar-based .phar --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/ext/phar/tests/tar/delete_in_phar_confirm.phpt b/ext/phar/tests/tar/delete_in_phar_confirm.phpt index 762ed508da..a8ef7d3196 100644 --- a/ext/phar/tests/tar/delete_in_phar_confirm.phpt +++ b/ext/phar/tests/tar/delete_in_phar_confirm.phpt @@ -5,6 +5,7 @@ Phar: delete a file within a tar-based .phar (confirm disk file is changed) --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/ext/phar/tests/tar/tar_004.phpt b/ext/phar/tests/tar/tar_004.phpt index 54db6bede2..5fbe16f069 100644 --- a/ext/phar/tests/tar/tar_004.phpt +++ b/ext/phar/tests/tar/tar_004.phpt @@ -7,6 +7,7 @@ if (!extension_loaded("phar")) die("skip"); --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php include __DIR__ . '/files/tarmaker.php.inc'; diff --git a/ext/phar/tests/zip/create_new_and_modify.phpt b/ext/phar/tests/zip/create_new_and_modify.phpt index 38cf305525..e46e94b344 100644 --- a/ext/phar/tests/zip/create_new_and_modify.phpt +++ b/ext/phar/tests/zip/create_new_and_modify.phpt @@ -4,6 +4,7 @@ Phar: create and modify zip-based phar <?php if (!extension_loaded("phar")) die("skip"); ?> --INI-- phar.readonly=0 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/ext/phar/tests/zip/delete_in_phar.phpt b/ext/phar/tests/zip/delete_in_phar.phpt index 5f5d644470..f988fa7f2c 100644 --- a/ext/phar/tests/zip/delete_in_phar.phpt +++ b/ext/phar/tests/zip/delete_in_phar.phpt @@ -5,6 +5,7 @@ Phar: delete a file within a zip-based .phar --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/ext/phar/tests/zip/delete_in_phar_confirm.phpt b/ext/phar/tests/zip/delete_in_phar_confirm.phpt index 4d2c68720e..8b80c5f4e7 100644 --- a/ext/phar/tests/zip/delete_in_phar_confirm.phpt +++ b/ext/phar/tests/zip/delete_in_phar_confirm.phpt @@ -5,6 +5,7 @@ Phar: delete a file within a zip-based .phar (confirm disk file is changed) --INI-- phar.readonly=0 phar.require_hash=0 +opcache.validate_timestamps=1 --FILE-- <?php diff --git a/run-tests.php b/run-tests.php index 0b7e29e0bc..d14fcafeee 100755 --- a/run-tests.php +++ b/run-tests.php @@ -144,7 +144,7 @@ function main() $repeat, $result_tests_file, $slow_min_ms, $start_time, $switch, $temp_source, $temp_target, $temp_urlbase, $test_cnt, $test_dirs, $test_files, $test_idx, $test_list, $test_results, $testfile, - $user_tests, $valgrind, $sum_results, $shuffle; + $user_tests, $valgrind, $sum_results, $shuffle, $file_cache; // Parallel testing global $workers, $workerID; @@ -396,6 +396,7 @@ NO_PROC_OPEN_ERROR; $no_clean = false; $slow_min_ms = INF; $preload = false; + $file_cache = null; $shuffle = false; $workers = null; @@ -529,6 +530,12 @@ NO_PROC_OPEN_ERROR; case '--preload': $preload = true; break; + case '--file-cache-prime': + $file_cache = 'prime'; + break; + case '--file-cache-use': + $file_cache = 'use'; + break; case '--no-clean': $no_clean = true; break; @@ -708,6 +715,11 @@ NO_PROC_OPEN_ERROR; fclose($result_tests_file); } + if (0 == count($test_results)) { + echo "No tests were run.\n"; + return; + } + compute_summary(); if ($html_output) { fwrite($html_file, "<hr/>\n" . get_summary(false, true)); @@ -1272,10 +1284,18 @@ function system_with_timeout($commandline, $env = null, $stdin = null, $captureS function run_all_tests($test_files, $env, $redir_tested = null) { - global $test_results, $failed_tests_file, $result_tests_file, $php, $test_idx; + global $test_results, $failed_tests_file, $result_tests_file, $php, $test_idx, $file_cache; // Parallel testing global $PHP_FAILED_TESTS, $workers, $workerID, $workerSock; + if ($file_cache !== null) { + /* Automatically skip opcache tests in --file-cache mode, + * because opcache generally doesn't expect those to run under file cache */ + $test_files = array_filter($test_files, function($test) { + return !is_string($test) || false === strpos($test, 'ext/opcache'); + }); + } + /* Ignore -jN if there is only one file to analyze. */ if ($workers !== null && count($test_files) > 1 && !$workerID) { run_all_tests_parallel($test_files, $env, $redir_tested); @@ -1763,7 +1783,7 @@ function run_test($php, $file, $env) global $SHOW_ONLY_GROUPS; global $no_file_cache; global $slow_min_ms; - global $preload; + global $preload, $file_cache; // Parallel testing global $workerID; $temp_filenames = null; @@ -2087,9 +2107,9 @@ TEST $file $ext_params = array(); settings2array($ini_overwrites, $ext_params); $ext_params = settings2params($ext_params); - $ext_dir = `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"`; + $ext_dir = `$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r "echo ini_get('extension_dir');"`; $extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS'])); - $loaded = explode(",", `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`); + $loaded = explode(",", `$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`); $ext_prefix = IS_WINDOWS ? "php_" : ""; foreach ($extensions as $req_ext) { if (!in_array($req_ext, $loaded)) { @@ -2108,6 +2128,19 @@ TEST $file $orig_ini_settings = settings2params($ini_settings); + if ($file_cache !== null) { + $ini_settings['opcache.file_cache'] = '/tmp'; + // Make sure warnings still show up on the second run. + $ini_settings['opcache.record_warnings'] = '1'; + // File cache is currently incompatible with JIT. + $ini_settings['opcache.jit'] = '0'; + if ($file_cache === 'use') { + // Disable timestamp validation in order to fetch from file cache, + // even though all the files are re-created. + $ini_settings['opcache.validate_timestamps'] = '0'; + } + } + // Any special ini settings // these may overwrite the test defaults... if (array_key_exists('INI', $section_text)) { diff --git a/sapi/phpdbg/tests/info_001.phpt b/sapi/phpdbg/tests/info_001.phpt index 2f38fd36af..2807855709 100644 --- a/sapi/phpdbg/tests/info_001.phpt +++ b/sapi/phpdbg/tests/info_001.phpt @@ -48,7 +48,7 @@ prompt> ------------------------------------------------ Function Breakpoints: #0 foo prompt> [User-defined constants (0)] -prompt> [Included files: 0] +prompt> [Included files: %d]%A prompt> [No error found!] prompt> [Literal Constants in foo() (2)] |-------- C0 -------> [var_dump] |