8059070: [TESTBUG] java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java failed - timeout

Reviewed-by: psandoz, vlivanov
This commit is contained in:
Konstantin Shefov 2014-11-25 14:16:55 +04:00
parent 3469175a63
commit 758644082b
5 changed files with 21 additions and 3 deletions

View file

@ -27,6 +27,7 @@ import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.function.Function;
import jdk.testlibrary.Utils;
/**
* Lambda forms caching test case class. Contains all necessary test routines to
@ -41,6 +42,7 @@ public abstract class LambdaFormTestCase {
private final static String INTERNAL_FORM_METHOD_NAME = "internalForm";
private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
= 45 / (128.0 * 1024 * 1024);
private static final long TIMEOUT = Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
/**
* Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
@ -120,6 +122,7 @@ public abstract class LambdaFormTestCase {
System.out.printf("Number of iterations is set to %d (%d cases)%n",
iterations, iterations * testCaseNum);
System.out.flush();
long startTime = System.currentTimeMillis();
for (long i = 0; i < iterations; i++) {
System.err.println(String.format("Iteration %d:", i));
for (TestMethods testMethod : testMethods) {
@ -137,6 +140,14 @@ public abstract class LambdaFormTestCase {
}
testCounter++;
}
long passedTime = System.currentTimeMillis() - startTime;
long avgIterTime = passedTime / (i + 1);
long remainTime = TIMEOUT - passedTime;
if (avgIterTime > 2 * remainTime) {
System.err.printf("Stopping iterations because of lack of time.%n"
+ "Increase timeout factor for more iterations.%n");
break;
}
}
if (!passed) {
throw new Error(String.format("%d of %d test cases FAILED! %n"