Blame SOURCES/perl-5.27.1-File-Glob-tweak-rt131211.t-to-be-less-sensitive-on-w.patch

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