Fix run-tests.php for running phpdbg and certain test sections

Certain sections, such as --EXTENSIONS--, --SKIPIF--, and --CLEAN--
require to be executed using only PHP CLI or PHP CGI SAPIs and cannot be
processed with the phpdbg.
This commit is contained in:
Peter Kokot 2018-10-20 01:05:00 +02:00
parent 0b63544f25
commit 220a2239a6

View File

@ -1448,6 +1448,7 @@ TEST $file
}
/* For phpdbg tests, check if phpdbg sapi is available and if it is, use it. */
$extra_options = '';
if (array_key_exists('PHPDBG', $section_text)) {
if (!isset($section_text['STDIN'])) {
$section_text['STDIN'] = $section_text['PHPDBG']."\n";
@ -1455,6 +1456,10 @@ TEST $file
if (isset($phpdbg)) {
$php = $phpdbg . ' -qIb';
// Additional phpdbg command line options for sections that need to
// be run straight away. For example, EXTENSIONS, SKIPIF, CLEAN.
$extra_options = '-rr';
} else {
show_result('SKIP', $tested, $tested_file, "reason: phpdbg not available");
@ -1571,9 +1576,9 @@ TEST $file
$ext_params = array();
settings2array($ini_overwrites, $ext_params);
settings2params($ext_params);
$ext_dir=`$php $pass_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"`;
$ext_dir=`$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"`;
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
$loaded = explode(",", `$php $pass_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
$loaded = explode(",", `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
$ext_prefix = substr(PHP_OS, 0, 3) === "WIN" ? "php_" : "";
foreach ($extensions as $req_ext) {
if (!in_array($req_ext, $loaded)) {
@ -1623,7 +1628,7 @@ TEST $file
junit_start_timer($shortname);
$output = system_with_timeout("$extra $php $pass_options -q $ini_settings $no_file_cache -d display_errors=0 \"$test_skipif\"", $env);
$output = system_with_timeout("$extra $php $pass_options $extra_options -q $ini_settings $no_file_cache -d display_errors=0 \"$test_skipif\"", $env);
junit_finish_timer($shortname);
@ -1961,7 +1966,7 @@ COMMAND $cmd
settings2params($clean_params);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ?
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;": "";
system_with_timeout("$extra $php $pass_options -q $clean_params $no_file_cache \"$test_clean\"", $env);
system_with_timeout("$extra $php $pass_options $extra_options -q $clean_params $no_file_cache \"$test_clean\"", $env);
}
if (!$cfg['keep']['clean']) {