f6ea51
From b4d257e2d408f0f1c6686dcdc112f3ebfec68f44 Mon Sep 17 00:00:00 2001
f6ea51
From: Yves Orton <demerphq@gmail.com>
f6ea51
Date: Tue, 27 Jun 2017 10:22:23 +0200
f6ea51
Subject: [PATCH] File::Glob - tweak rt131211.t to be less sensitive on wonky
f6ea51
 boxes
f6ea51
MIME-Version: 1.0
f6ea51
Content-Type: text/plain; charset=UTF-8
f6ea51
Content-Transfer-Encoding: 8bit
f6ea51
f6ea51
make the test less senstive and avoid divide by zero errors,
f6ea51
also we skip the test if either elapsed_match or elapsed_fail is
f6ea51
true, as we can not rely on the timings then. For the operations
f6ea51
we are doing we should get a non-zero timing from Time::HiRes.
f6ea51
f6ea51
This should mean that running this test on boxes with heavy
f6ea51
load, etc, will no longer result in false positives.
f6ea51
f6ea51
Signed-off-by: Petr Písař <ppisar@redhat.com>
f6ea51
---
f6ea51
 ext/File-Glob/t/rt131211.t | 9 +++++++--
f6ea51
 1 file changed, 7 insertions(+), 2 deletions(-)
f6ea51
f6ea51
diff --git a/ext/File-Glob/t/rt131211.t b/ext/File-Glob/t/rt131211.t
f6ea51
index c1bcbe0..b29cd04 100644
f6ea51
--- a/ext/File-Glob/t/rt131211.t
f6ea51
+++ b/ext/File-Glob/t/rt131211.t
f6ea51
@@ -49,8 +49,13 @@ while (++$count < 10) {
f6ea51
 is $count,10,
f6ea51
     "tried all the patterns without bailing out";
f6ea51
 
f6ea51
-cmp_ok $elapsed_fail/$elapsed_match,"<",2,
f6ea51
-    "time to fail less than twice the time to match";
f6ea51
+SKIP: {
f6ea51
+    skip "unstable timing", 1 unless $elapsed_match && $elapsed_fail;
f6ea51
+    ok $elapsed_fail <= 10 * $elapsed_match,
f6ea51
+        "time to fail less than 10x the time to match"
f6ea51
+        or diag("elapsed_match=$elapsed_match elapsed_fail=$elapsed_fail");
f6ea51
+}
f6ea51
+
f6ea51
 is "@got_files", catfile($path, $files[0]),
f6ea51
     "only got the expected file for xa*..b";
f6ea51
 is "@no_files", "", "shouldnt have files for xa*..c";
f6ea51
-- 
f6ea51
2.9.4
f6ea51