]> granicus.if.org Git - php/commitdiff
improve FPM tests (mostly for systemd build)
authorRemi Collet <fedora@famillecollet.com>
Sun, 8 Jan 2017 18:55:30 +0000 (19:55 +0100)
committerJoe Watkins <krakjoe@php.net>
Sun, 8 Jan 2017 19:02:50 +0000 (19:02 +0000)
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

index 732a717aad851e9e76aef2b3a5048f5b6a9089c3..d5fe05ba76199a43a6ec9a41ca9f420d2452a0fd 100644 (file)
@@ -6,6 +6,7 @@ include "skipif.inc";
 
 $cfg = <<<EOT
 [global]
+error_log = /dev/null
 [poold_ondemand]
 listen=127.0.0.1:9000
 pm = ondemand
index 6c092e371a3023225bdd0356421c3635955987bb..e18175b138faeac2d748b839691d58f699fa18c1 100644 (file)
@@ -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!
index a5084f18f3e707abaff15a7a70567e274d04f438..04ba4b5f6947db2065e79e88fb44d9f0f95f9813 100644 (file)
@@ -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);
 }
index b3de089a7023acaea5386fae44e1102ff4715237..46e5efd3f75bdd214825d548aa9e5874deccb710 100644 (file)
@@ -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
+?>
index 3ae4b348d948fa7f770bf5ba0686fb7d04ba728d..7bed9e2436e6599b8677eff7350535e9d0af5752 100644 (file)
@@ -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"));
index dbd43d05fed53e1faf1ccc6f7322ec22ae42ebed..813175001527aa764ae546863d0d2565a2b9f724 100644 (file)
@@ -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);
index f5da0867023e1351fd97946e31ab7c22fd4d1aad..6e9ec08d8b2157facc1977ef6573876aad8387dd 100644 (file)
@@ -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);
 }
index feb9d123957ee6d8bb40a150e11405bdd7623632..0bdf238f30e0de23ea02aea7b5142b4fb6b604e8 100644 (file)
@@ -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);
 }
index 7c5011213b74ed731d3cf29cbf0ef385a642c266..6599255a7a65eccd32a60bd9e184495d41a9226e 100644 (file)
@@ -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;