]> granicus.if.org Git - php/commitdiff
Fix run-tests.php for running phpdbg and certain test sections
authorPeter Kokot <peterkokot@gmail.com>
Fri, 19 Oct 2018 23:05:00 +0000 (01:05 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Wed, 24 Oct 2018 14:21:57 +0000 (16:21 +0200)
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.

run-tests.php

index df53645ef2d843964877e39ba2cf4ce1bae5e3c1..aa9f67e07a6aae3e40450ea1a5e89a5ed666a134 100755 (executable)
@@ -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']) {