Skip to content

Commit fa828db

Browse files
committed
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)
2 parents 89b3c9f + d316ba2 commit fa828db

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

sapi/fpm/tests/013.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ error_log = $logfile
1616
log_level = warning
1717
[unconfined]
1818
listen = 127.0.0.1:$port
19-
user = foo
2019
pm = dynamic
2120
pm.max_children = 5
2221
pm.start_servers = 2

sapi/fpm/tests/014.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ error_log = $logfile
1616
log_level = warning
1717
[unconfined]
1818
listen = 127.0.0.1:$port
19-
user = foo
2019
pm = dynamic
2120
pm.max_children = 5
2221
;pm.start_servers = 2

sapi/fpm/tests/include.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ function run_fpm($config, &$out = false, $extra_args = '') /* {{{ */
3838
/* Since it's not possible to spawn a process under linux without using a
3939
* shell in php (why?!?) we need a little shell trickery, so that we can
4040
* actually kill php-fpm */
41-
$fpm = proc_open('killit () { kill $child; }; trap killit TERM; '.get_fpm_path().' -F -O -y '.$cfg.' '.$extra_args.' 2>&1 & child=$!; wait', $desc, $pipes);
41+
$asroot = getenv('TEST_FPM_RUN_AS_ROOT') ? '--allow-to-run-as-root' : '';
42+
$cmd = get_fpm_path()." $asroot -F -O -y $cfg $extra_args";
43+
$fpm = proc_open("killit () { kill \$child; }; trap killit TERM; $cmd 2>&1 & child=\$!; wait",
44+
$desc, $pipes);
4245
register_shutdown_function(
4346
function($fpm) use($cfg) {
4447
@unlink($cfg);

sapi/fpm/tests/skipif.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
44
die ("skip not for Windows");
55
}
66

7+
8+
if (!getmyuid() && !getenv('TEST_FPM_RUN_AS_ROOT')) {
9+
die('Refusing to run as root');
10+
}
11+
712
include dirname(__FILE__)."/include.inc";
813

914
if (!get_fpm_path()) {
1015
die("skip FPM not found");
1116
}
12-
1317
?>

0 commit comments

Comments
 (0)