From ad0c4ce7afc9856c127031a582232330276bdafe Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 21 Feb 2019 12:43:19 -0800 Subject: No time left for you - quickly rename deep bundles still occasionally fails. (#1025) * No time left for you - quickly rename deep bundles still occasionally fails. Run the "quick" calibration test three times and choose the maximum as the basis for comparison with the "deep" test. * Rename local variable to less confusing name. --- src/test/scala/firrtlTests/UniquifySpec.scala | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/test/scala/firrtlTests/UniquifySpec.scala b/src/test/scala/firrtlTests/UniquifySpec.scala index 58290122..afb82384 100644 --- a/src/test/scala/firrtlTests/UniquifySpec.scala +++ b/src/test/scala/firrtlTests/UniquifySpec.scala @@ -294,12 +294,15 @@ class UniquifySpec extends FirrtlFlatSpec { // Additionally, since executions times vary significantly under coverage testing, we check a global // to see if timing measurements are accurate enough to enforce the timing checks. val threshold = depth * 2.0 - + // As of 20-Feb-2019, this still fails occasionally: + // [info] 9038.99351 was not less than 6113.865 (UniquifySpec.scala:317) + // Run the "quick" test three times and choose the longest time as the basis. + val nCalibrationRuns = 3 def mkType(i: Int): String = { if(i == 0) "UInt<8>" else s"{x: ${mkType(i - 1)}}" } - val (baseMs: Double, renameMs: Double) = { - for (depth <- List(1, depth)) yield { + val timesMs = ( + for (depth <- (List.fill(nCalibrationRuns)(1) :+ depth)) yield { val input = s"""circuit Test: | module Test : | input in: ${mkType(depth)} @@ -308,11 +311,11 @@ class UniquifySpec extends FirrtlFlatSpec { |""".stripMargin val (ms, _) = Utils.time(compileToVerilog(input)) ms - } - } match { - case List(base, rename) => (base, rename) - } - + } + ).toArray + // The baseMs will be the maximum of the first calibration runs + val baseMs = timesMs.slice(0, nCalibrationRuns - 1).max + val renameMs = timesMs(nCalibrationRuns) if (TestOptions.accurateTiming) renameMs shouldBe < (baseMs * threshold) } -- cgit v1.2.3