diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-05-25 01:16:06 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-05-25 01:16:06 +0300 |
commit | fa828dbe841c654dd7ac87c26929b873168eaea2 (patch) | |
tree | ca030b49f0c3861c4e3a84d3c7b9f20e1b0d7707 | |
parent | 89b3c9f647abccf41acdca8638882cfb19983318 (diff) | |
parent | d316ba2d659c73f0fea1f895ef554891c3dd130b (diff) | |
download | php-git-fa828dbe841c654dd7ac87c26929b873168eaea2.tar.gz |
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src:
Remove `user=foo` from FPM test config
Skip FPM tests when running as root (unless requested)
-rw-r--r-- | sapi/fpm/tests/013.phpt | 1 | ||||
-rw-r--r-- | sapi/fpm/tests/014.phpt | 1 | ||||
-rw-r--r-- | sapi/fpm/tests/include.inc | 5 | ||||
-rw-r--r-- | sapi/fpm/tests/skipif.inc | 6 |
4 files changed, 9 insertions, 4 deletions
diff --git a/sapi/fpm/tests/013.phpt b/sapi/fpm/tests/013.phpt index 641eb448c4..d28f3e4e00 100644 --- a/sapi/fpm/tests/013.phpt +++ b/sapi/fpm/tests/013.phpt @@ -16,7 +16,6 @@ error_log = $logfile log_level = warning [unconfined] listen = 127.0.0.1:$port -user = foo pm = dynamic pm.max_children = 5 pm.start_servers = 2 diff --git a/sapi/fpm/tests/014.phpt b/sapi/fpm/tests/014.phpt index e243ef68dc..56e24715a8 100644 --- a/sapi/fpm/tests/014.phpt +++ b/sapi/fpm/tests/014.phpt @@ -16,7 +16,6 @@ error_log = $logfile log_level = warning [unconfined] listen = 127.0.0.1:$port -user = foo pm = dynamic pm.max_children = 5 ;pm.start_servers = 2 diff --git a/sapi/fpm/tests/include.inc b/sapi/fpm/tests/include.inc index 8faf53dcc2..1e41957c7c 100644 --- a/sapi/fpm/tests/include.inc +++ b/sapi/fpm/tests/include.inc @@ -38,7 +38,10 @@ function run_fpm($config, &$out = false, $extra_args = '') /* {{{ */ /* Since it's not possible to spawn a process under linux without using a * shell in php (why?!?) we need a little shell trickery, so that we can * actually kill php-fpm */ - $fpm = proc_open('killit () { kill $child; }; trap killit TERM; '.get_fpm_path().' -F -O -y '.$cfg.' '.$extra_args.' 2>&1 & child=$!; wait', $desc, $pipes); + $asroot = getenv('TEST_FPM_RUN_AS_ROOT') ? '--allow-to-run-as-root' : ''; + $cmd = get_fpm_path()." $asroot -F -O -y $cfg $extra_args"; + $fpm = proc_open("killit () { kill \$child; }; trap killit TERM; $cmd 2>&1 & child=\$!; wait", + $desc, $pipes); register_shutdown_function( function($fpm) use($cfg) { @unlink($cfg); diff --git a/sapi/fpm/tests/skipif.inc b/sapi/fpm/tests/skipif.inc index 8c569daafd..08c6bbff69 100644 --- a/sapi/fpm/tests/skipif.inc +++ b/sapi/fpm/tests/skipif.inc @@ -4,10 +4,14 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { die ("skip not for Windows"); } + +if (!getmyuid() && !getenv('TEST_FPM_RUN_AS_ROOT')) { + die('Refusing to run as root'); +} + include dirname(__FILE__)."/include.inc"; if (!get_fpm_path()) { die("skip FPM not found"); } - ?> |