com php-src: Make test more robust: ext/pdo_mysql/tests/pdo _mysql_attr_server_info.phpt
| From: | Christoph Michael Becker | Date: | Mon, 04 Nov 2019 11:22:04 +0000 |
| Subject: | com php-src: Make test more robust: ext/pdo_mysql/tests/pdo _mysql_attr_server_info.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109177@lists.php.net to get a copy of this message | ||
Commit: 00c9c480eb1f19b50f07fe6d51a018a31870d109
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 4 Nov 2019 12:16:05 +0100
Parents: 451314111b9942c8389415f04e9017c3e3d3cb56
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=00c9c480eb1f19b50f07fe6d51a018a31870d109
Log:
Make test more robust
Time flies, so obviously the reported uptime may differ a bit (as
already occasionally noticed on CI); we cater to that by allowing a
delay of up to one second.
Changed paths:
M ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
Diff:
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
index 206b236311d..4a142eee380 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
@@ -40,8 +40,11 @@ $db = MySQLPDOTest::factory();
if (!preg_match('/Uptime/i', $info))
printf("[006] Can't find uptime in server info '%s'\n", $info);
- if (isset($uptime) && !preg_match(sprintf('/Uptime: %d/i', $uptime), $info))
- printf("[007] SHOW STATUS and server info have reported a different uptime, please check.
Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
+ if (isset($uptime)) {
+ if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) {
+ printf("[007] SHOW STATUS and server info have reported a different uptime, please check.
Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
+ }
+ }
print "done!";
--EXPECT--