com php-src: Increase wait time for tests involving sockets to improve Travis relability: ext/curl/tests/bug64267.phpt ext/curl/tests/server.inc
ext/opcache/tests/php_cli_server.inc sapi/cli/tests/php _cli_server.inc sapi/fpm/tests/002.phpt sapi/ fpm/tests/003.phpt sapi/fpm/tests/004.phpt
sapi/fpm/tests/013.phpt sapi/fpm/tests/014.ph pt sapi/fpm/tests/015.phpt
| From: | Joe Watkins | Date: | Fri, 13 Jan 2017 06:45:04 +0000 |
| Subject: | com php-src: Increase wait time for tests involving sockets to improve Travis relability: ext/curl/tests/bug64267.phpt ext/curl/tests/server.inc ext/opcache/tests/php_cli_server.inc sapi/cli/tests/php _cli_server.inc sapi/fpm/tests/002.phpt sapi/ fpm/tests/003.phpt sapi/fpm/tests/004.phpt sapi/fpm/tests/013.phpt sapi/fpm/tests/014.ph pt sapi/fpm/tests/015.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96709@lists.php.net to get a copy of this message | ||
Commit: fd92b911888f482d8d5794e6abac41bdff9ad3a2
Author: Mitch Hagstrand <mhagstrand@gmail.com> Thu, 12 Jan 2017 22:09:46 -0800
Committer: Joe Watkins <krakjoe@php.net> Fri, 13 Jan 2017 06:45:04 +0000
Parents: 04379bcb1df25a9f9cc1d440f5c12105b9fbaf97
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fd92b911888f482d8d5794e6abac41bdff9ad3a2
Log:
Increase wait time for tests involving sockets to improve Travis relability
1. Increased sleep time from 25ms to 50ms
2. Added sleep to shutdown handlers
Changed paths:
M ext/curl/tests/bug64267.phpt
M ext/curl/tests/server.inc
M ext/opcache/tests/php_cli_server.inc
M sapi/cli/tests/php_cli_server.inc
M sapi/fpm/tests/002.phpt
M sapi/fpm/tests/003.phpt
M sapi/fpm/tests/004.phpt
M sapi/fpm/tests/013.phpt
M sapi/fpm/tests/014.phpt
M sapi/fpm/tests/015.phpt
Diff:
diff --git a/ext/curl/tests/bug64267.phpt b/ext/curl/tests/bug64267.phpt
index ca1fe4b..302a853 100644
--- a/ext/curl/tests/bug64267.phpt
+++ b/ext/curl/tests/bug64267.phpt
@@ -17,8 +17,8 @@ var_dump(curl_setopt_array($c, [
CURLOPT_UPLOAD => true,
CURLOPT_INFILE => $f,
CURLOPT_INFILESIZE => filesize(__FILE__),
- CURLOPT_CONNECTTIMEOUT => 1,
- CURLOPT_TIMEOUT => 1,
+ CURLOPT_CONNECTTIMEOUT => 3,
+ CURLOPT_TIMEOUT => 3,
]));
fclose($f);
var_dump(curl_setopt_array($c, [
diff --git a/ext/curl/tests/server.inc b/ext/curl/tests/server.inc
index 315fd68..ed351b7 100644
--- a/ext/curl/tests/server.inc
+++ b/ext/curl/tests/server.inc
@@ -33,9 +33,9 @@ function curl_cli_server_start() {
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to
quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
- $error = "Unable to connect to servers\n";
+ $error = "Unable to connect to server\n";
for ($i=0; $i < 60; $i++) {
- usleep(25000); // 25ms per try
+ usleep(50000); // 50ms per try
$status = proc_get_status($handle);
$fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT);
// Failure, the server is no longer running
@@ -63,6 +63,14 @@ function curl_cli_server_start() {
register_shutdown_function(
function($handle) use($router) {
proc_terminate($handle);
+ /* Wait for server to shutdown */
+ for ($i = 0; $i < 60; $i++) {
+ $status = proc_get_status($handle);
+ if (!($status && $status['running'])) {
+ break;
+ }
+ usleep(50000);
+ }
},
$handle
);
diff --git a/ext/opcache/tests/php_cli_server.inc b/ext/opcache/tests/php_cli_server.inc
index ca6854f..456ed66 100644
--- a/ext/opcache/tests/php_cli_server.inc
+++ b/ext/opcache/tests/php_cli_server.inc
@@ -23,9 +23,9 @@ function php_cli_server_start($ini = "") {
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
- $error = "Unable to connect to servers\n";
+ $error = "Unable to connect to server\n";
for ($i=0; $i < 60; $i++) {
- usleep(25000); // 25ms per try
+ usleep(50000); // 50ms per try
$status = proc_get_status($handle);
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
// Failure, the server is no longer running
@@ -53,6 +53,14 @@ function php_cli_server_start($ini = "") {
register_shutdown_function(
function($handle) {
proc_terminate($handle);
+ /* Wait for server to shutdown */
+ for ($i = 0; $i < 60; $i++) {
+ $status = proc_get_status($handle);
+ if (!($status && $status['running'])) {
+ break;
+ }
+ usleep(50000);
+ }
},
$handle
);
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index 6e7b70c..5ee3887 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -36,9 +36,9 @@ function php_cli_server_start($code = 'echo "Hello world";',
$router = 'index.ph
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to
quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
- $error = "Unable to connect to servers\n";
+ $error = "Unable to connect to server\n";
for ($i=0; $i < 60; $i++) {
- usleep(25000); // 25ms per try
+ usleep(50000); // 50ms per try
$status = proc_get_status($handle);
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
// Failure, the server is no longer running
@@ -85,7 +85,7 @@ function php_cli_server_stop($handle) {
$success = TRUE;
break;
}
- usleep(25000);
+ usleep(50000);
}
}
return $success;
diff --git a/sapi/fpm/tests/002.phpt b/sapi/fpm/tests/002.phpt
index 77e89af..5ad9e4b 100644
--- a/sapi/fpm/tests/002.phpt
+++ b/sapi/fpm/tests/002.phpt
@@ -27,7 +27,7 @@ if (is_resource($fpm)) {
fpm_display_log($tail, 2);
$i = 0;
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Done\n";
diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt
index 8b5265c..8accbd0 100644
--- a/sapi/fpm/tests/003.phpt
+++ b/sapi/fpm/tests/003.phpt
@@ -30,7 +30,7 @@ if (is_resource($fpm)) {
fpm_display_log($tail, 2);
$i = 0;
while (($i++ < 60) && !($fp = fsockopen('[::1]', $port))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Done\n";
diff --git a/sapi/fpm/tests/004.phpt b/sapi/fpm/tests/004.phpt
index 0b58a6d..4375f8d 100644
--- a/sapi/fpm/tests/004.phpt
+++ b/sapi/fpm/tests/004.phpt
@@ -30,14 +30,14 @@ if (is_resource($fpm)) {
fpm_display_log($tail, 2);
$i = 0;
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Done IPv4\n";
fclose($fp);
}
while (($i++ < 60) && !($fp = @fsockopen('[::1]', $port))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Done IPv6\n";
diff --git a/sapi/fpm/tests/013.phpt b/sapi/fpm/tests/013.phpt
index aa84c27...641eb44 100644
--- a/sapi/fpm/tests/013.phpt
+++ b/sapi/fpm/tests/013..phpt
@@ -28,7 +28,7 @@ $fpm = run_fpm($cfg, $tail);
if (is_resource($fpm)) {
$i = 0;
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Started\n";
diff --git a/sapi/fpm/tests/014.phpt b/sapi/fpm/tests/014.phpt
index 8c0d5bf..e243ef6 100644
--- a/sapi/fpm/tests/014.phpt
+++ b/sapi/fpm/tests/014.phpt
@@ -28,7 +28,7 @@ $fpm = run_fpm($cfg, $tail);
if (is_resource($fpm)) {
$i = 0;
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Started\n";
diff --git a/sapi/fpm/tests/015.phpt b/sapi/fpm/tests/015.phpt
index e18175b..a3c7ad3 100644
--- a/sapi/fpm/tests/015.phpt
+++ b/sapi/fpm/tests/015.phpt
@@ -43,7 +43,7 @@ $fpm = run_fpm($cfg, $tail);
if (is_resource($fpm)) {
$i = 0;
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port1))) {
- usleep(25000);
+ usleep(50000);
}
if ($fp) {
echo "Started\n";