mirror of
https://github.com/php/web-qa.git
synced 2026-03-24 15:32:13 +01:00
The given example might not be the best one, since it actually wouldn't need the `--FLAKY--` section, but it's the only one we currently have. We also document the "flaky" convention for SKIPIF sections,
48 lines
900 B
PHP
48 lines
900 B
PHP
<?php
|
|
include("../include/functions.php");
|
|
|
|
$TITLE = "Sample Test [PHP-QAT: Quality Assurance Team]";
|
|
$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
|
|
|
|
common_header();
|
|
?>
|
|
|
|
<div style="padding: 10px">
|
|
<h1>Sample Test: sample001.phpt</h1>
|
|
<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p>
|
|
<pre>--TEST--
|
|
Test hrtime() aligns with microtime()
|
|
--FLAKY--
|
|
This test frequently fails in CI
|
|
--FILE--
|
|
<?php
|
|
|
|
$m0 = microtime(true);
|
|
$h0 = hrtime(true);
|
|
for ($i = 0; $i < 1024*1024; $i++);
|
|
$h1 = hrtime(true);
|
|
$m1 = microtime(true);
|
|
|
|
$d0 = ($m1 - $m0)*1000000000.0;
|
|
$d1 = $h1 - $h0;
|
|
|
|
/* Relative uncertainty. */
|
|
$d = abs($d0 - $d1)/$d1;
|
|
|
|
if ($d > 0.05) {
|
|
print "FAIL, $d";
|
|
} else {
|
|
print "OK, $d";
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
OK, %f
|
|
</pre>
|
|
<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p>
|
|
</div>
|
|
|
|
<?php
|
|
common_footer();
|
|
?>
|