com php-src: Fixes for session and fpm tests to make them more reliable in Travis CI: ext/session/tests/save_handler.inc ext/session
/tests/session_set_save_handler_basic.phpt ext/sess ion/tests/session_set_save_handler_variation4.phpt sapi/fpm/tests/002.phpt sapi/fpm/tests/003
.phpt sapi/fpm/tests/004.phpt sapi/fpm/tests/0 13.phpt sapi/fpm/tests/014.phpt sapi/fpm/test s/015.phpt

From: Date: Sat, 07 Jan 2017 07:13:44 +0000
Subject: com php-src: Fixes for session and fpm tests to make them more reliable in Travis CI: ext/session/tests/save_handler.inc ext/session
/tests/session_set_save_handler_basic.phpt ext/sess ion/tests/session_set_save_handler_variation4.phpt sapi/fpm/tests/002.phpt sapi/fpm/tests/003
.phpt sapi/fpm/tests/004.phpt sapi/fpm/tests/0 13.phpt sapi/fpm/tests/014.phpt sapi/fpm/test s/015.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96589@lists.php.net to get a copy of this message
Commit: 06c8538f87cf4c037f5a68df9e8ac0fb395b74ca Author: Mitch Hagstrand <mhagstrand@gmail.com> Thu, 5 Jan 2017 23:22:36 -0800 Committer: Joe Watkins <krakjoe@php.net> Sat, 7 Jan 2017 07:13:44 +0000 Parents: 3aece4629b7050f9a2284de3f32c1ab57c918aaa Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=06c8538f87cf4c037f5a68df9e8ac0fb395b74ca Log: Fixes for session and fpm tests to make them more reliable in Travis CI 1. Increased the timeout on sapi/fpm tests to match the cli server 2. Fixed user session GC function to return number of sessions removed 3. Disabled session GC in session_set_save_handler_basic.phpt Changed paths: M ext/session/tests/save_handler.inc M ext/session/tests/session_set_save_handler_basic.phpt M ext/session/tests/session_set_save_handler_variation4.phpt 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/session/tests/save_handler.inc b/ext/session/tests/save_handler.inc index 301a2d6..4d5ac75 100644 --- a/ext/session/tests/save_handler.inc +++ b/ext/session/tests/save_handler.inc @@ -106,13 +106,15 @@ function gc($maxlifetime) { // long $maxlifetime - GC TTL in seconds. Default: session.gc_maxlifetime global $session_save_path, $name; + $gc_cnt = 0; $directory = opendir($session_save_path."/"); $length = strlen(SESSION_FILE_PREFIX); while (($file = readdir($directory)) !== FALSE) { $qualified = ($session_save_path."/".$file); if (is_file($qualified) === TRUE) { - if (substr($file, 0, $length) === SESSION_FILE_PREFIX) { + if (substr($file, 0, $length) === SESSION_FILE_PREFIX && (filemtime($qualified) + $maxlifetime <= time() )) { unlink($qualified); + $gc_cnt++; } } } @@ -121,7 +123,7 @@ function gc($maxlifetime) { // SHOULD return long (number of deleted sessions). // Returning TRUE works also, but it will not report correct number of deleted sessions. // Return negative value for error. FALSE does not work because it's the same as 0. - return 1; + return $gc_cnt; } /* Create new secure session ID */ diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt index 5342acc..6b99e8d 100644 --- a/ext/session/tests/session_set_save_handler_basic.phpt +++ b/ext/session/tests/session_set_save_handler_basic.phpt @@ -3,6 +3,7 @@ Test session_set_save_handler() function : basic functionality --INI-- session.save_path= session.name=PHPSESSID +session.gc_probability=0 --SKIPIF-- <?php include('skipif.inc'); ?> --FILE-- diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt index 70a964d..5445b44 100644 --- a/ext/session/tests/session_set_save_handler_variation4.phpt +++ b/ext/session/tests/session_set_save_handler_variation4.phpt @@ -54,7 +54,7 @@ ob_end_flush(); Open [%s,PHPSESSID] Read [%s,%s] GC [0] -1 deleted +2 deleted array(3) { ["Blah"]=> string(12) "Hello World!" diff --git a/sapi/fpm/tests/002.phpt b/sapi/fpm/tests/002.phpt index 89e4318..77e89af 100644 --- a/sapi/fpm/tests/002.phpt +++ b/sapi/fpm/tests/002.phpt @@ -26,8 +26,8 @@ $fpm = run_fpm($cfg, $tail); if (is_resource($fpm)) { fpm_display_log($tail, 2); $i = 0; - while (($i++ < 30) && !($fp = @fsockopen('127.0.0.1', $port))) { - usleep(10000); + while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) { + usleep(25000); } if ($fp) { echo "Done\n"; diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt index a4c04ae..8b5265c 100644 --- a/sapi/fpm/tests/003.phpt +++ b/sapi/fpm/tests/003.phpt @@ -29,8 +29,8 @@ $fpm = run_fpm($cfg, $tail); if (is_resource($fpm)) { fpm_display_log($tail, 2); $i = 0; - while (($i++ < 30) && !($fp = fsockopen('[::1]', $port))) { - usleep(10000); + while (($i++ < 60) && !($fp = fsockopen('[::1]', $port))) { + usleep(25000); } if ($fp) { echo "Done\n"; diff --git a/sapi/fpm/tests/004.phpt b/sapi/fpm/tests/004.phpt index 565819a..0b58a6d 100644 --- a/sapi/fpm/tests/004.phpt +++ b/sapi/fpm/tests/004.phpt @@ -29,15 +29,15 @@ $fpm = run_fpm($cfg, $tail); if (is_resource($fpm)) { fpm_display_log($tail, 2); $i = 0; - while (($i++ < 30) && !($fp = @fsockopen('127.0.0.1', $port))) { - usleep(10000); + while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) { + usleep(25000); } if ($fp) { echo "Done IPv4\n"; fclose($fp); } - while (($i++ < 30) && !($fp = @fsockopen('[::1]', $port))) { - usleep(10000); + while (($i++ < 60) && !($fp = @fsockopen('[::1]', $port))) { + usleep(25000); } if ($fp) { echo "Done IPv6\n"; diff --git a/sapi/fpm/tests/013.phpt b/sapi/fpm/tests/013.phpt index 8d6a9d1..aa84c27 100644 --- a/sapi/fpm/tests/013.phpt +++ b/sapi/fpm/tests/013.phpt @@ -27,8 +27,8 @@ EOT; $fpm = run_fpm($cfg, $tail); if (is_resource($fpm)) { $i = 0; - while (($i++ < 30) && !($fp = @fsockopen('127.0.0.1', $port))) { - usleep(10000); + while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) { + usleep(25000); } if ($fp) { echo "Started\n"; @@ -51,4 +51,4 @@ Done <?php $logfile = dirname(__FILE__).'/php-fpm.log.tmp'; @unlink($logfile); -?> \ No newline at end of file +?> diff --git a/sapi/fpm/tests/014.phpt b/sapi/fpm/tests/014.phpt index ee0e549..8c0d5bf 100644 --- a/sapi/fpm/tests/014.phpt +++ b/sapi/fpm/tests/014.phpt @@ -27,8 +27,8 @@ EOT; $fpm = run_fpm($cfg, $tail); if (is_resource($fpm)) { $i = 0; - while (($i++ < 30) && !($fp = @fsockopen('127.0.0.1', $port))) { - usleep(10000); + while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port))) { + usleep(25000); } if ($fp) { echo "Started\n"; @@ -51,4 +51,4 @@ Done <?php $logfile = dirname(__FILE__).'/php-fpm.log.tmp'; @unlink($logfile); -?> \ No newline at end of file +?> diff --git a/sapi/fpm/tests/015.phpt b/sapi/fpm/tests/015.phpt index c7af5f7..6c092e3 100644 --- a/sapi/fpm/tests/015.phpt +++ b/sapi/fpm/tests/015.phpt @@ -42,8 +42,8 @@ EOT; $fpm = run_fpm($cfg, $tail); if (is_resource($fpm)) { $i = 0; - while (($i++ < 30) && !($fp = @fsockopen('127.0.0.1', $port1))) { - usleep(10000); + while (($i++ < 60) && !($fp = @fsockopen('127.0.0.1', $port1))) { + usleep(25000); } if ($fp) { echo "Started\n"; @@ -88,4 +88,4 @@ Done <?php $logfile = dirname(__FILE__).'/php-fpm.log.tmp'; @unlink($logfile); -?> \ No newline at end of file +?>

« previous php.cvs (#96589) next »