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