This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Benchmark.t: test for inconsistent clock
authorDavid Mitchell <davem@iabyn.com>
Mon, 10 Jun 2013 16:04:46 +0000 (17:04 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 10 Jun 2013 16:11:34 +0000 (17:11 +0100)
commit1ebabb47e140c4b8dd1d47c3c821c655f6824a9a
treeea5e0fe2f283dc447c1c4b615d4efb1817418474
parent30f6094bc1f1cbd908daaa2a6c5759ad03bfecec
Benchmark.t: test for inconsistent clock

test 15 has been failing intermittently in smokes for ages now.
This does countit(3, ...) and countit(1, ...) and checks that the first
takes approx three times longer than the second.

This commit adds in near the beginning a crude timing loop that directly
uses times() rather than anything in the Benchmark module, and that does
approx 1s and 3s of loops, and if the results aren't consistent, sets a
global flag, $INCONSISTENT_CLOCK, that causes timing-sensitive tests to be
skipped.

For now it only skips test 15. If this is successful, I'll look to
expand it to other failing tests like 128/129.
lib/Benchmark.t