com php-src: improve FPM tests (mostly for systemd build): sapi/fpm/tests/008.phpt sapi/fpm/tests/015.phpt sapi/fpm/tests/016.phpt
sapi/fpm/tests/017.phpt sapi/fpm/tests/019.phpt sapi/fpm/tests/020.phpt sapi/fpm/tests/021-uds-acl.phpt sapi/fpm/tests/022-cve-2016-5385.phpt
sapi/fpm/tests/include.inc
| From: | Joe Watkins | Date: | Sun, 08 Jan 2017 19:02:50 +0000 |
| Subject: | com php-src: improve FPM tests (mostly for systemd build): sapi/fpm/tests/008.phpt sapi/fpm/tests/015.phpt sapi/fpm/tests/016.phpt sapi/fpm/tests/017.phpt sapi/fpm/tests/019.phpt sapi/fpm/tests/020.phpt sapi/fpm/tests/021-uds-acl.phpt sapi/fpm/tests/022-cve-2016-5385.phpt sapi/fpm/tests/include.inc |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96628@lists.php.net to get a copy of this message | ||
Commit: eb02876e74754e50fce6a39c4d75393e8806566f
Author: Remi Collet <fedora@famillecollet.com> Sun, 8 Jan 2017 19:55:30 +0100
Committer: Joe Watkins <krakjoe@php.net> Sun, 8 Jan 2017 19:02:50 +0000
Parents: 5df97b339ea352d79d6c519b94d5a356398d0809
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=eb02876e74754e50fce6a39c4d75393e8806566f
Log:
improve FPM tests (mostly for systemd build)
Changed paths:
M sapi/fpm/tests/008.phpt
M sapi/fpm/tests/015.phpt
M sapi/fpm/tests/016.phpt
M sapi/fpm/tests/017.phpt
M sapi/fpm/tests/019.phpt
M sapi/fpm/tests/020.phpt
M sapi/fpm/tests/021-uds-acl.phpt
M sapi/fpm/tests/022-cve-2016-5385.phpt
M sapi/fpm/tests/include.inc
Diff:
diff --git a/sapi/fpm/tests/008.phpt b/sapi/fpm/tests/008.phpt
index 732a717...d5fe05b 100644
--- a/sapi/fpm/tests/008.phpt
+++ b/sapi/fpm/tests/008..phpt
@@ -6,6 +6,7 @@ include "skipif.inc";
$cfg = <<<EOT
[global]
+error_log = /dev/null
[poold_ondemand]
listen=127.0.0.1:9000
pm = ondemand
diff --git a/sapi/fpm/tests/015.phpt b/sapi/fpm/tests/015.phpt
index 6c092e3..e18175b 100644
--- a/sapi/fpm/tests/015.phpt
+++ b/sapi/fpm/tests/015.phpt
@@ -62,9 +62,7 @@ if (is_resource($fpm)) {
echo "Error 2\n";
}
proc_terminate($fpm);
- if (!feof($tail)) {
- echo stream_get_contents($tail);
- }
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
}
@@ -79,7 +77,7 @@ Error 2
[%s] NOTICE: fpm is running, pid %d
[%s] NOTICE: ready to handle connections
[%s] WARNING: [pool pool2] child %d said into stderr: "ERROR: Wrong IP address 'xxx'
in listen.allowed_clients"
-[%s] WARNING: [pool pool2] child %d said into stderr: "ERROR: There are no allowed addresses
for this pool"
+[%s] WARNING: [pool pool2] child %d said into stderr: "ERROR: There are no allowed %s"
[%s] WARNING: [pool pool2] child %d said into stderr: "ERROR: Connection disallowed: IP
address '127.0.0.1' has been dropped."
[%s] NOTICE: Terminating ...
[%s] NOTICE: exiting, bye-bye!
diff --git a/sapi/fpm/tests/016.phpt b/sapi/fpm/tests/016.phpt
index a5084f1..04ba4b5 100644
--- a/sapi/fpm/tests/016.phpt
+++ b/sapi/fpm/tests/016.phpt
@@ -6,6 +6,7 @@ include "skipif.inc";
$cfg = <<<EOT
[global]
+error_log = /dev/null
[poold_ondemand]
listen=127.0.0.1:9000
pm = ondemand
@@ -65,9 +66,7 @@ if (is_resource($fpm)) {
}
}
proc_terminate($fpm);
- if (!feof($tail)) {
- echo stream_get_contents($tail);
- }
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
}
diff --git a/sapi/fpm/tests/017.phpt b/sapi/fpm/tests/017.phpt
index b3de089..46e5efd 100644
--- a/sapi/fpm/tests/017.phpt
+++ b/sapi/fpm/tests/017.phpt
@@ -42,7 +42,7 @@ if (is_resource($fpm)) {
echo "Request error\n";
}
proc_terminate($fpm);
- echo stream_get_contents($tail);
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
}
@@ -64,4 +64,4 @@ Done
$srcfile = __DIR__.'/php-fpm.tmp.php';
@unlink($logfile);
@unlink($srcfile);
-?>
\ No newline at end of file
+?>
diff --git a/sapi/fpm/tests/019.phpt b/sapi/fpm/tests/019.phpt
index 3ae4b34..7bed9e2 100644
--- a/sapi/fpm/tests/019.phpt
+++ b/sapi/fpm/tests/019.phpt
@@ -46,7 +46,7 @@ if (is_resource($fpm)) {
printf("File %s %s\n", $pidfile, (file_exists(__DIR__.'/'.$pidfile) ?
"exists" : "missing"));
proc_terminate($fpm);
- echo stream_get_contents($tail);
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
printf("File %s %s\n", $pidfile, (file_exists(__DIR__.'/'.$pidfile) ?
"still exists" : "removed"));
diff --git a/sapi/fpm/tests/020.phpt b/sapi/fpm/tests/020..phpt
index dbd43d0..8131750 100644
--- a/sapi/fpm/tests/020.phpt
+++ b/sapi/fpm/tests/020.phpt
@@ -46,7 +46,7 @@ if (is_resource($fpm)) {
printf("File %s %s\n", $slwfile, (file_exists(__DIR__.'/'.$slwfile) ?
"exists" : "missing"));
proc_terminate($fpm);
- echo stream_get_contents($tail);
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
readfile(__DIR__.'/'.$accfile);
diff --git a/sapi/fpm/tests/021-uds-acl.phpt b/sapi/fpm/tests/021-uds-acl.phpt
index f5da086..6e9ec08 100644
--- a/sapi/fpm/tests/021-uds-acl.phpt
+++ b/sapi/fpm/tests/021-uds-acl.phpt
@@ -6,11 +6,17 @@ include "skipif.inc";
if (!(file_exists('/usr/bin/getfacl') && file_exists('/etc/passwd')
&& file_exists('/etc/group'))) die ("skip missing getfacl command");
$cfg = <<<EOT
[global]
+error_log = /dev/null
[unconfined]
listen = 127.0.0.1:9999
listen.acl_users = nobody
listen.acl_groups = nobody
listen.mode = 0600
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
EOT;
if (test_fpm_conf($cfg, $msg) == false) { die("skip " . $msg); }
?>
@@ -66,7 +72,7 @@ if (is_resource($fpm)) {
passthru("/usr/bin/getfacl -cp $socket");
proc_terminate($fpm);
- echo stream_get_contents($tail);
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
}
diff --git a/sapi/fpm/tests/022-cve-2016-5385.phpt b/sapi/fpm/tests/022-cve-2016-5385.phpt
index feb9d12..0bdf238 100644
--- a/sapi/fpm/tests/022-cve-2016-5385.phpt
+++ b/sapi/fpm/tests/022-cve-2016-5385.phpt
@@ -51,7 +51,7 @@ if (is_resource($fpm)) {
echo "Request error\n";
}
proc_terminate($fpm);
- echo stream_get_contents($tail);
+ fpm_display_log($tail, -1);
fclose($tail);
proc_close($fpm);
}
diff --git a/sapi/fpm/tests/include.inc b/sapi/fpm/tests/include.inc
index 7c50112...6599255 100644
--- a/sapi/fpm/tests/include.inc
+++ b/sapi/fpm/tests/include.inc
@@ -89,7 +89,8 @@ function run_fpm_till($needle, $config, $max = 10) /* {{{ */
/* }}} */
function fpm_display_log($tail, $n=1, $ignore='systemd') { /* {{{ */
- while ($n) {
+ /* Read $n lines or until EOF */
+ while ($n>0 || ($n<0 && !feof($tail))) {
$a = fgets($tail);
if (empty($ignore) || !strpos($a, $ignore)) {
echo $a;