com php-src: Add test_fpm_conf to skip some tests ranth than mark --xfail--: sapi/fpm/tests/02 1-uds-acl.phpt sapi/fpm/tests/include.inc
| From: | Xinchen Hui | Date: | Mon, 02 Nov 2015 08:42:11 +0000 |
| Subject: | com php-src: Add test_fpm_conf to skip some tests ranth than mark --xfail--: sapi/fpm/tests/02 1-uds-acl.phpt sapi/fpm/tests/include.inc | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89582@lists.php.net to get a copy of this message | ||
Commit: 8dd5e1c2b526b1460228fcdfa624cd18887da111
Author: Xinchen Hui <laruence@gmail.com> Mon, 2 Nov 2015 16:35:54 +0800
Parents: 8d443d46269574e211ecf08d1281ce243eb471cf
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8dd5e1c2b526b1460228fcdfa624cd18887da111
Log:
Add test_fpm_conf to skip some tests ranth than mark --xfail--
Changed paths:
M sapi/fpm/tests/021-uds-acl.phpt
M sapi/fpm/tests/include.inc
Diff:
diff --git a/sapi/fpm/tests/021-uds-acl.phpt b/sapi/fpm/tests/021-uds-acl.phpt
index f39c526..f5da086 100644
--- a/sapi/fpm/tests/021-uds-acl.phpt
+++ b/sapi/fpm/tests/021-uds-acl.phpt
@@ -4,9 +4,16 @@ FPM: Test Unix Domain Socket with Posix ACL
<?php
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]
+[unconfined]
+listen = 127.0.0.1:9999
+listen.acl_users = nobody
+listen.acl_groups = nobody
+listen.mode = 0600
+EOT;
+if (test_fpm_conf($cfg, $msg) == false) { die("skip " . $msg); }
?>
---XFAIL--
-Mark as XFAIL because --with-fpm-acl is not enabled in default build
--FILE--
<?php
diff --git a/sapi/fpm/tests/include.inc b/sapi/fpm/tests/include.inc
index b195fad..5cbb08b 100644
--- a/sapi/fpm/tests/include.inc
+++ b/sapi/fpm/tests/include.inc
@@ -52,6 +52,18 @@ function run_fpm($config, &$out = false, $extra_args = '') /* {{{
*/
}
/* }}} */
+function test_fpm_conf($config, &$msg = NULL) { /* {{{ */
+ $cfg = dirname(__FILE__).'/test-fpm-config.tmp';
+ file_put_contents($cfg, $config);
+ exec(get_fpm_path() . ' -t -y ' . $cfg . ' 2>&1', $output, $code);
+ if ($code) {
+ $msg = preg_replace("/\[.+?\]/", "", $output[0]);
+ return false;
+ }
+ return true;
+}
+/* }}} */
+
function run_fpm_till($needle, $config, $max = 10) /* {{{ */
{
$i = 0;
@@ -76,7 +88,7 @@ function run_fpm_till($needle, $config, $max = 10) /* {{{ */
}
/* }}} */
-function fpm_display_log($tail, $n=1, $ignore='systemd') {
+function fpm_display_log($tail, $n=1, $ignore='systemd') { /* {{{ */
while ($n) {
$a = fgets($tail);
if (empty($ignore) || !strpos($a, $ignore)) {
@@ -84,9 +96,9 @@ function fpm_display_log($tail, $n=1, $ignore='systemd') {
$n--;
}
}
-}
+} /* }}} */
-function run_request($host, $port, $uri='/ping', $query='') {
+function run_request($host, $port, $uri='/ping', $query='') { /* {{{ */
require_once 'fcgi.inc';
$client = new Adoy\FastCGI\Client($host, $port);
$params = array(
@@ -109,3 +121,4 @@ function run_request($host, $port, $uri='/ping', $query='')
{
);
return $client->request($params, false)."\n";
}
+/* }}} */