Skip to content

Commit 0374cf0

Browse files
committed
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.
1 parent 40b59ce commit 0374cf0

14 files changed

+51
-6
lines changed

ext/ffi/tests/300.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ opcache.enable=1
1010
opcache.enable_cli=1
1111
opcache.optimization_level=-1
1212
opcache.preload={PWD}/preload.inc
13+
opcache.file_cache_only=0
1314
--FILE--
1415
<?php
1516
$ffi = FFI::scope("TEST_300");

ext/phar/tests/create_new_and_modify.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: create and modify phar
55
--INI--
66
phar.readonly=0
77
phar.require_hash=1
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011

ext/phar/tests/delete_in_phar.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: delete a file within a .phar
55
--INI--
66
phar.readonly=0
77
phar.require_hash=0
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';

ext/phar/tests/delete_in_phar_confirm.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: delete a file within a .phar (confirm disk file is changed)
55
--INI--
66
phar.readonly=0
77
phar.require_hash=0
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';

ext/phar/tests/front.phar.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Phar front controller with mounted external file
33
--INI--
44
default_charset=UTF-8
5+
opcache.validate_timestamps=1
56
--SKIPIF--
67
<?php if (!extension_loaded("phar")) die("skip"); ?>
78
--ENV--

ext/phar/tests/tar/create_new_and_modify.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Phar: create and modify tar-based phar
44
<?php if (!extension_loaded("phar")) die("skip"); ?>
55
--INI--
66
phar.readonly=0
7+
opcache.validate_timestamps=1
78
--FILE--
89
<?php
910

ext/phar/tests/tar/delete_in_phar.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: delete a file within a tar-based .phar
55
--INI--
66
phar.readonly=0
77
phar.require_hash=0
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011

ext/phar/tests/tar/delete_in_phar_confirm.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: delete a file within a tar-based .phar (confirm disk file is changed)
55
--INI--
66
phar.readonly=0
77
phar.require_hash=0
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011

ext/phar/tests/tar/tar_004.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ if (!extension_loaded("phar")) die("skip");
77
--INI--
88
phar.readonly=0
99
phar.require_hash=0
10+
opcache.validate_timestamps=1
1011
--FILE--
1112
<?php
1213
include __DIR__ . '/files/tarmaker.php.inc';

ext/phar/tests/zip/create_new_and_modify.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Phar: create and modify zip-based phar
44
<?php if (!extension_loaded("phar")) die("skip"); ?>
55
--INI--
66
phar.readonly=0
7+
opcache.validate_timestamps=1
78
--FILE--
89
<?php
910

ext/phar/tests/zip/delete_in_phar.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: delete a file within a zip-based .phar
55
--INI--
66
phar.readonly=0
77
phar.require_hash=0
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011

ext/phar/tests/zip/delete_in_phar_confirm.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Phar: delete a file within a zip-based .phar (confirm disk file is changed)
55
--INI--
66
phar.readonly=0
77
phar.require_hash=0
8+
opcache.validate_timestamps=1
89
--FILE--
910
<?php
1011

run-tests.php

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function main()
144144
$repeat, $result_tests_file, $slow_min_ms, $start_time, $switch,
145145
$temp_source, $temp_target, $temp_urlbase, $test_cnt, $test_dirs,
146146
$test_files, $test_idx, $test_list, $test_results, $testfile,
147-
$user_tests, $valgrind, $sum_results, $shuffle;
147+
$user_tests, $valgrind, $sum_results, $shuffle, $file_cache;
148148
// Parallel testing
149149
global $workers, $workerID;
150150

@@ -396,6 +396,7 @@ function main()
396396
$no_clean = false;
397397
$slow_min_ms = INF;
398398
$preload = false;
399+
$file_cache = null;
399400
$shuffle = false;
400401
$workers = null;
401402

@@ -529,6 +530,12 @@ function main()
529530
case '--preload':
530531
$preload = true;
531532
break;
533+
case '--file-cache-prime':
534+
$file_cache = 'prime';
535+
break;
536+
case '--file-cache-use':
537+
$file_cache = 'use';
538+
break;
532539
case '--no-clean':
533540
$no_clean = true;
534541
break;
@@ -708,6 +715,11 @@ function main()
708715
fclose($result_tests_file);
709716
}
710717

718+
if (0 == count($test_results)) {
719+
echo "No tests were run.\n";
720+
return;
721+
}
722+
711723
compute_summary();
712724
if ($html_output) {
713725
fwrite($html_file, "<hr/>\n" . get_summary(false, true));
@@ -1272,10 +1284,18 @@ function system_with_timeout($commandline, $env = null, $stdin = null, $captureS
12721284

12731285
function run_all_tests($test_files, $env, $redir_tested = null)
12741286
{
1275-
global $test_results, $failed_tests_file, $result_tests_file, $php, $test_idx;
1287+
global $test_results, $failed_tests_file, $result_tests_file, $php, $test_idx, $file_cache;
12761288
// Parallel testing
12771289
global $PHP_FAILED_TESTS, $workers, $workerID, $workerSock;
12781290

1291+
if ($file_cache !== null) {
1292+
/* Automatically skip opcache tests in --file-cache mode,
1293+
* because opcache generally doesn't expect those to run under file cache */
1294+
$test_files = array_filter($test_files, function($test) {
1295+
return !is_string($test) || false === strpos($test, 'ext/opcache');
1296+
});
1297+
}
1298+
12791299
/* Ignore -jN if there is only one file to analyze. */
12801300
if ($workers !== null && count($test_files) > 1 && !$workerID) {
12811301
run_all_tests_parallel($test_files, $env, $redir_tested);
@@ -1763,7 +1783,7 @@ function run_test($php, $file, $env)
17631783
global $SHOW_ONLY_GROUPS;
17641784
global $no_file_cache;
17651785
global $slow_min_ms;
1766-
global $preload;
1786+
global $preload, $file_cache;
17671787
// Parallel testing
17681788
global $workerID;
17691789
$temp_filenames = null;
@@ -2087,9 +2107,9 @@ function run_test($php, $file, $env)
20872107
$ext_params = array();
20882108
settings2array($ini_overwrites, $ext_params);
20892109
$ext_params = settings2params($ext_params);
2090-
$ext_dir = `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"`;
2110+
$ext_dir = `$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r "echo ini_get('extension_dir');"`;
20912111
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
2092-
$loaded = explode(",", `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
2112+
$loaded = explode(",", `$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
20932113
$ext_prefix = IS_WINDOWS ? "php_" : "";
20942114
foreach ($extensions as $req_ext) {
20952115
if (!in_array($req_ext, $loaded)) {
@@ -2108,6 +2128,19 @@ function run_test($php, $file, $env)
21082128

21092129
$orig_ini_settings = settings2params($ini_settings);
21102130

2131+
if ($file_cache !== null) {
2132+
$ini_settings['opcache.file_cache'] = '/tmp';
2133+
// Make sure warnings still show up on the second run.
2134+
$ini_settings['opcache.record_warnings'] = '1';
2135+
// File cache is currently incompatible with JIT.
2136+
$ini_settings['opcache.jit'] = '0';
2137+
if ($file_cache === 'use') {
2138+
// Disable timestamp validation in order to fetch from file cache,
2139+
// even though all the files are re-created.
2140+
$ini_settings['opcache.validate_timestamps'] = '0';
2141+
}
2142+
}
2143+
21112144
// Any special ini settings
21122145
// these may overwrite the test defaults...
21132146
if (array_key_exists('INI', $section_text)) {

sapi/phpdbg/tests/info_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ prompt> ------------------------------------------------
4848
Function Breakpoints:
4949
#0 foo
5050
prompt> [User-defined constants (0)]
51-
prompt> [Included files: 0]
51+
prompt> [Included files: %d]%A
5252
prompt> [No error found!]
5353
prompt> [Literal Constants in foo() (2)]
5454
|-------- C0 -------> [var_dump]

0 commit comments

Comments
 (0)