Apache Lucene open-source search software
try to prevent false failure of testTimedSearchTask
Michael McCandless9ba59706b0fc
diff --git a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.javaindex 95b096e4e29..0bf4ca220f0 100755--- a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java+++ b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java@@ -116,8 +116,8 @@ public class TestPerfTasksLogic extends TestCase {CountingSearchTestTask.numSearches = 0;Benchmark benchmark = execBenchmark(algLines);assertTrue(CountingSearchTestTask.numSearches > 0);- long elapsed = CountingSearchTestTask.lastMillis - CountingSearchTestTask.startMillis;- assertTrue("elapsed time was " + elapsed + " msec", elapsed < 2000);+ long elapsed = CountingSearchTestTask.prevLastMillis - CountingSearchTestTask.startMillis;+ assertTrue("elapsed time was " + elapsed + " msec", elapsed <= 1500);}public void testHighlighting() throws Exception {diff --git a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.javaindex 9d199375bf6..40b00525041 100755--- a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java+++ b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java@@ -27,6 +27,7 @@ public class CountingSearchTestTask extends SearchTask {public static int numSearches = 0;public static long startMillis;public static long lastMillis;+ public static long prevLastMillis;public CountingSearchTestTask(PerfRunData runData) {super(runData);@@ -39,9 +40,11 @@ public class CountingSearchTestTask extends SearchTask {}private static synchronized void incrNumSearches() {+ prevLastMillis = lastMillis;lastMillis = System.currentTimeMillis();- if (0 == numSearches)- startMillis = lastMillis;+ if (0 == numSearches) {+ startMillis = prevLastMillis = lastMillis;+ }numSearches++;}