From: Christoph M. Becker Date: Mon, 4 Nov 2019 11:16:05 +0000 (+0100) Subject: Make test more robust X-Git-Tag: php-7.4.7RC1~529 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00c9c480eb1f19b50f07fe6d51a018a31870d109;p=php 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. --- 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--