honours TEST_PHP_EXECUTABLE and TEST_PHP_ARGS (set by "make test")
authorRemi Collet <remi@php.net>
Thu, 19 Feb 2015 16:12:46 +0000 (17:12 +0100)
committerRemi Collet <remi@php.net>
Thu, 19 Feb 2015 16:12:46 +0000 (17:12 +0100)
tests/helper/server.inc

index aa8559f8c41fbb3480f1e6dbcf6a02de0a3659b6..3d49a85363d7a714ebd80d2d020bd2c1f9cda454 100644 (file)
@@ -1,8 +1,13 @@
-<?php 
+<?php
 
 
-// PHP-5.3
-if (!defined("PHP_BINARY")) {
-       define("PHP_BINARY", PHP_BINDIR.DIRECTORY_SEPARATOR."php");
+$php = getenv('TEST_PHP_EXECUTABLE');
+if ($php) {
+       define('PHP_BIN', $php);
+} else if (defined('PHP_BINARY')) {
+       define('PHP_BIN', PHP_BINARY);
+} else {
+       // PHP-5.3
+       define("PHP_BIN", PHP_BINDIR.DIRECTORY_SEPARATOR."php");
 }
 
 function serve($cb) {
 }
 
 function serve($cb) {
@@ -35,7 +40,12 @@ function serve($cb) {
 }
 
 function server($handler, $cb) {
 }
 
 function server($handler, $cb) {
-       proc(PHP_BINARY, array(__DIR__."/$handler"), $cb);
+       $args = explode(' ', getenv('TEST_PHP_ARGS'));
+       $args[] = __DIR__."/$handler";
+       foreach ($args as $k => $v) {
+               if (!$v) unset($args[$k]);
+       }
+       proc(PHP_BIN, $args, $cb);
 }
 
 function nghttpd($cb) {
 }
 
 function nghttpd($cb) {
@@ -77,7 +87,7 @@ function proc($bin, $args, $cb) {
                $stdin = $pipes[0];
                $stdout = $pipes[1];
                $stderr = $pipes[2];
                $stdin = $pipes[0];
                $stdout = $pipes[1];
                $stderr = $pipes[2];
-               
+
                do {
                        $port = trim(fgets($stderr));
                        $R = array($stderr); $W = array(); $E = array();
                do {
                        $port = trim(fgets($stderr));
                        $R = array($stderr); $W = array(); $E = array();