diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-11-04 12:16:05 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-11-04 12:22:04 +0100 |
commit | 00c9c480eb1f19b50f07fe6d51a018a31870d109 (patch) | |
tree | 95fc65b5bf6fdc92938321779a35d5d082df71a3 | |
parent | 451314111b9942c8389415f04e9017c3e3d3cb56 (diff) | |
download | php-git-00c9c480eb1f19b50f07fe6d51a018a31870d109.tar.gz |
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.
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt | 7 |
1 files changed, 5 insertions, 2 deletions
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 206b236311..4a142eee38 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-- |