From: Remi Collet Date: Sun, 8 Jan 2017 18:55:30 +0000 (+0100) Subject: improve FPM tests (mostly for systemd build) X-Git-Tag: php-7.1.2RC1~120^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb02876e74754e50fce6a39c4d75393e8806566f;p=php improve FPM tests (mostly for systemd build) --- diff --git a/sapi/fpm/tests/008.phpt b/sapi/fpm/tests/008.phpt index 732a717aad..d5fe05ba76 100644 --- a/sapi/fpm/tests/008.phpt +++ b/sapi/fpm/tests/008.phpt @@ -6,6 +6,7 @@ include "skipif.inc"; $cfg = << \ No newline at end of file +?> diff --git a/sapi/fpm/tests/019.phpt b/sapi/fpm/tests/019.phpt index 3ae4b348d9..7bed9e2436 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 dbd43d05fe..8131750015 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 f5da086702..6e9ec08d8b 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 = << @@ -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 feb9d12395..0bdf238f30 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 7c5011213b..6599255a7a 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;