Skip to content

Commit 19363de

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Increase wait time for tests involving sockets to improve Travis relability
2 parents b25be21 + fd92b91 commit 19363de

File tree

10 files changed

+32
-16
lines changed

10 files changed

+32
-16
lines changed

ext/curl/tests/bug64267.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ var_dump(curl_setopt_array($c, [
1717
CURLOPT_UPLOAD => true,
1818
CURLOPT_INFILE => $f,
1919
CURLOPT_INFILESIZE => filesize(__FILE__),
20-
CURLOPT_CONNECTTIMEOUT => 1,
21-
CURLOPT_TIMEOUT => 1,
20+
CURLOPT_CONNECTTIMEOUT => 3,
21+
CURLOPT_TIMEOUT => 3,
2222
]));
2323
fclose($f);
2424
var_dump(curl_setopt_array($c, [

ext/curl/tests/server.inc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ function curl_cli_server_start() {
3333

3434
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
3535
// it might not be listening yet...need to wait until fsockopen() call returns
36-
$error = "Unable to connect to servers\n";
36+
$error = "Unable to connect to server\n";
3737
for ($i=0; $i < 60; $i++) {
38-
usleep(25000); // 25ms per try
38+
usleep(50000); // 50ms per try
3939
$status = proc_get_status($handle);
4040
$fp = @fsockopen(PHP_CURL_SERVER_HOSTNAME, PHP_CURL_SERVER_PORT);
4141
// Failure, the server is no longer running
@@ -63,6 +63,14 @@ function curl_cli_server_start() {
6363
register_shutdown_function(
6464
function($handle) use($router) {
6565
proc_terminate($handle);
66+
/* Wait for server to shutdown */
67+
for ($i = 0; $i < 60; $i++) {
68+
$status = proc_get_status($handle);
69+
if (!($status && $status['running'])) {
70+
break;
71+
}
72+
usleep(50000);
73+
}
6674
},
6775
$handle
6876
);

ext/opcache/tests/php_cli_server.inc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ function php_cli_server_start($ini = "") {
2323

2424
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
2525
// it might not be listening yet...need to wait until fsockopen() call returns
26-
$error = "Unable to connect to servers\n";
26+
$error = "Unable to connect to server\n";
2727
for ($i=0; $i < 60; $i++) {
28-
usleep(25000); // 25ms per try
28+
usleep(50000); // 50ms per try
2929
$status = proc_get_status($handle);
3030
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
3131
// Failure, the server is no longer running
@@ -53,6 +53,14 @@ function php_cli_server_start($ini = "") {
5353
register_shutdown_function(
5454
function($handle) {
5555
proc_terminate($handle);
56+
/* Wait for server to shutdown */
57+
for ($i = 0; $i < 60; $i++) {
58+
$status = proc_get_status($handle);
59+
if (!($status && $status['running'])) {
60+
break;
61+
}
62+
usleep(50000);
63+
}
5664
},
5765
$handle
5866
);

sapi/cli/tests/php_cli_server.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function php_cli_server_start($code = 'echo "Hello world";', $router = 'index.ph
3636

3737
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
3838
// it might not be listening yet...need to wait until fsockopen() call returns
39-
$error = "Unable to connect to servers\n";
39+
$error = "Unable to connect to server\n";
4040
for ($i=0; $i < 60; $i++) {
41-
usleep(25000); // 25ms per try
41+
usleep(50000); // 50ms per try
4242
$status = proc_get_status($handle);
4343
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
4444
// Failure, the server is no longer running
@@ -85,7 +85,7 @@ function php_cli_server_stop($handle) {
8585
$success = TRUE;
8686
break;
8787
}
88-
usleep(25000);
88+
usleep(50000);
8989
}
9090
}
9191
return $success;

sapi/fpm/tests/002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (is_resource($fpm)) {
2727
fpm_display_log($tail, 2);
2828
$i = 0;
2929
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
30-
usleep(25000);
30+
usleep(50000);
3131
}
3232
if ($fp) {
3333
echo "Done\n";

sapi/fpm/tests/003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if (is_resource($fpm)) {
3030
fpm_display_log($tail, 2);
3131
$i = 0;
3232
while (($i++ < 60) && !($fp = fsockopen('[::1]', $port))) {
33-
usleep(25000);
33+
usleep(50000);
3434
}
3535
if ($fp) {
3636
echo "Done\n";

sapi/fpm/tests/004.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ if (is_resource($fpm)) {
3030
fpm_display_log($tail, 2);
3131
$i = 0;
3232
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
33-
usleep(25000);
33+
usleep(50000);
3434
}
3535
if ($fp) {
3636
echo "Done IPv4\n";
3737
fclose($fp);
3838
}
3939
while (($i++ < 60) && !($fp = @fsockopen('[::1]', $port))) {
40-
usleep(25000);
40+
usleep(50000);
4141
}
4242
if ($fp) {
4343
echo "Done IPv6\n";

sapi/fpm/tests/013.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $fpm = run_fpm($cfg, $tail);
2828
if (is_resource($fpm)) {
2929
$i = 0;
3030
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
31-
usleep(25000);
31+
usleep(50000);
3232
}
3333
if ($fp) {
3434
echo "Started\n";

sapi/fpm/tests/014.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $fpm = run_fpm($cfg, $tail);
2828
if (is_resource($fpm)) {
2929
$i = 0;
3030
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) {
31-
usleep(25000);
31+
usleep(50000);
3232
}
3333
if ($fp) {
3434
echo "Started\n";

sapi/fpm/tests/015.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $fpm = run_fpm($cfg, $tail);
4343
if (is_resource($fpm)) {
4444
$i = 0;
4545
while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port1))) {
46-
usleep(25000);
46+
usleep(50000);
4747
}
4848
if ($fp) {
4949
echo "Started\n";

0 commit comments

Comments
 (0)