com php-src: make this test a bit more tolerant when checking sleep time: ext/pdo_pgsql/tests/getnotify.phpt
| From: | Anatol Belski | Date: | Fri, 12 Sep 2014 12:39:19 +0000 |
| Subject: | com php-src: make this test a bit more tolerant when checking sleep time: ext/pdo_pgsql/tests/getnotify.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81518@lists.php.net to get a copy of this message | ||
Commit: 4db2181d4e5fad2ece558dcd72e4842e4f5b8d70
Author: Anatol Belski <ab@php.net> Fri, 12 Sep 2014 14:03:06 +0200
Parents: 99fb5d0ea87866f9ef13a2e8840007004332c936
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4db2181d4e5fad2ece558dcd72e4842e4f5b8d70
Log:
make this test a bit more tolerant when checking sleep time
Changed paths:
M ext/pdo_pgsql/tests/getnotify.phpt
Diff:
diff --git a/ext/pdo_pgsql/tests/getnotify.phpt b/ext/pdo_pgsql/tests/getnotify.phpt
index c093e03..c54a316 100644
--- a/ext/pdo_pgsql/tests/getnotify.phpt
+++ b/ext/pdo_pgsql/tests/getnotify.phpt
@@ -70,14 +70,16 @@ var_dump($db->pgsqlGetNotify());
// Test second parameter, should wait 2 seconds because no notify is queued
$t = microtime(1);
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
-var_dump((microtime(1) - $t) >= 1);
+$diff = microtime(1) - $t;
+var_dump($diff >= 1 || 1 - abs($diff) < .01);
var_dump($notify);
// Test second parameter, should return immediately because a notify is queued
$db->exec("NOTIFY notifies_phpt");
$t = microtime(1);
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
-var_dump((microtime(1) - $t) < 1);
+$diff = microtime(1) - $t;
+var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
var_dump(count($notify));
?>