c3e39f
From 49bc120dcaeb68e2a870e7d92cf3f217e3487fe5 Mon Sep 17 00:00:00 2001
c3e39f
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
c3e39f
Date: Thu, 2 Jul 2015 11:15:28 +0200
c3e39f
Subject: [PATCH] Benchmark.t: remove CPU-speed-sensitive test
c3e39f
MIME-Version: 1.0
c3e39f
Content-Type: text/plain; charset=UTF-8
c3e39f
Content-Transfer-Encoding: 8bit
c3e39f
c3e39f
This is upstream commit ported to 5.16.3:
c3e39f
c3e39f
commit 9eba9e102c2f8c2ec41a50f4bbe6b09a64dddd31
c3e39f
Author: David Mitchell <davem@iabyn.com>
c3e39f
Date:   Fri Jul 19 23:10:50 2013 +0100
c3e39f
c3e39f
    Benchmark.t: remove CPU-speed-sensitive test
c3e39f
c3e39f
    Benchmark.t has been randomly failing test 15 in smokes for ages.
c3e39f
    This is the one that checks that a loop run 3*N times burns approximately
c3e39f
    3 times more CPU than when run just N times.
c3e39f
c3e39f
    For the last month the test has included a calibration loop and test,
c3e39f
    which does much the same thing, but without using any code from
c3e39f
    Benchmark.pm. This has failed just as much, which confirms that its an
c3e39f
    issue with the smoke host (such as a variable speed CPU or whatever),
c3e39f
    rather than any flaw in the Benchmark.pm library logic.
c3e39f
c3e39f
    So just remove the calibration loop and the dodgy test.
c3e39f
c3e39f
Signed-off-by: Petr Písař <ppisar@redhat.com>
c3e39f
---
c3e39f
 lib/Benchmark.t | 19 +------------------
c3e39f
 1 file changed, 1 insertion(+), 18 deletions(-)
c3e39f
c3e39f
diff --git a/lib/Benchmark.t b/lib/Benchmark.t
c3e39f
index 004092e..62bc1a6 100644
c3e39f
--- a/lib/Benchmark.t
c3e39f
+++ b/lib/Benchmark.t
c3e39f
@@ -8,7 +8,7 @@ BEGIN {
c3e39f
 use warnings;
c3e39f
 use strict;
c3e39f
 use vars qw($foo $bar $baz $ballast);
c3e39f
-use Test::More tests => 196;
c3e39f
+use Test::More tests => 195;
c3e39f
 
c3e39f
 use Benchmark qw(:all);
c3e39f
 
c3e39f
@@ -86,23 +86,6 @@ my $in_onesec_adj = $in_onesec;
c3e39f
 $in_onesec_adj *= (1/$cpu1); # adjust because may not have run for exactly 1s
c3e39f
 print "# in_onesec_adj=$in_onesec_adj adjusted iterations\n";
c3e39f
 
c3e39f
-{
c3e39f
-  my $difference = $in_onesec_adj - $estimate;
c3e39f
-  my $actual = abs ($difference / $in_onesec_adj);
c3e39f
-  cmp_ok($actual, '<=', $delta, "is $in_onesec_adj within $delta of estimate ($estimate)")
c3e39f
-    or do {
c3e39f
-	diag("  in_threesecs     = $in_threesecs");
c3e39f
-	diag("  in_threesecs_adj = $in_threesecs_adj");
c3e39f
-	diag("  cpu3             = $cpu3");
c3e39f
-	diag("  sys3             = $sys3");
c3e39f
-	diag("  estimate         = $estimate");
c3e39f
-	diag("  in_onesec        = $in_onesec");
c3e39f
-	diag("  in_onesec_adj    = $in_onesec_adj");
c3e39f
-	diag("  cpu1             = $cpu1");
c3e39f
-	diag("  sys1             = $sys1");
c3e39f
-    };
c3e39f
-}
c3e39f
-
c3e39f
 # I found that the eval'ed version was 3 times faster than the coderef.
c3e39f
 # (now it has a different ballast value)
c3e39f
 $baz = 0;
c3e39f
-- 
c3e39f
2.4.3
c3e39f