Skip to content

Commit 7178b5a

Browse files
committed
Automatically skip opcache tests
Don't overwrite INI section
1 parent 9f5094e commit 7178b5a

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

run-tests.php

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,11 @@ function main()
715715
fclose($result_tests_file);
716716
}
717717

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

12801285
function run_all_tests($test_files, $env, $redir_tested = null)
12811286
{
1282-
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;
12831288
// Parallel testing
12841289
global $PHP_FAILED_TESTS, $workers, $workerID, $workerSock;
12851290

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+
12861299
/* Ignore -jN if there is only one file to analyze. */
12871300
if ($workers !== null && count($test_files) > 1 && !$workerID) {
12881301
run_all_tests_parallel($test_files, $env, $redir_tested);
@@ -2115,16 +2128,6 @@ function run_test($php, $file, $env)
21152128

21162129
$orig_ini_settings = settings2params($ini_settings);
21172130

2118-
// Any special ini settings
2119-
// these may overwrite the test defaults...
2120-
if (array_key_exists('INI', $section_text)) {
2121-
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
2122-
$section_text['INI'] = str_replace('{TMP}', sys_get_temp_dir(), $section_text['INI']);
2123-
$replacement = IS_WINDOWS ? '"' . PHP_BINARY . ' -r \"while ($in = fgets(STDIN)) echo $in;\" > $1"' : 'tee $1 >/dev/null';
2124-
$section_text['INI'] = preg_replace('/{MAIL:(\S+)}/', $replacement, $section_text['INI']);
2125-
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
2126-
}
2127-
21282131
if ($file_cache !== null) {
21292132
$ini_settings['opcache.file_cache'] = '/tmp';
21302133
// Make sure warnings still show up on the second run.
@@ -2138,6 +2141,16 @@ function run_test($php, $file, $env)
21382141
}
21392142
}
21402143

2144+
// Any special ini settings
2145+
// these may overwrite the test defaults...
2146+
if (array_key_exists('INI', $section_text)) {
2147+
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
2148+
$section_text['INI'] = str_replace('{TMP}', sys_get_temp_dir(), $section_text['INI']);
2149+
$replacement = IS_WINDOWS ? '"' . PHP_BINARY . ' -r \"while ($in = fgets(STDIN)) echo $in;\" > $1"' : 'tee $1 >/dev/null';
2150+
$section_text['INI'] = preg_replace('/{MAIL:(\S+)}/', $replacement, $section_text['INI']);
2151+
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
2152+
}
2153+
21412154
$ini_settings = settings2params($ini_settings);
21422155

21432156
$env['TEST_PHP_EXTRA_ARGS'] = $pass_options . ' ' . $ini_settings;

0 commit comments

Comments
 (0)