aboutsummaryrefslogtreecommitdiff
path: root/test/java/lang
diff options
context:
space:
mode:
authorkshefov <none@none>2015-06-18 15:40:15 +0300
committerkshefov <none@none>2015-06-18 15:40:15 +0300
commit1c8a9e02b30ae77c9235169766c48b3b0b9ed313 (patch)
treefce42b21abdbb54403a8f8cbe66c4575a231209f /test/java/lang
parent47868fa77e41ef3046a4ddf2b8770eb21a0fac62 (diff)
downloadjdk8u_jdk-1c8a9e02b30ae77c9235169766c48b3b0b9ed313.tar.gz
8039953: [TESTBUG] Timeout java/lang/invoke/MethodHandles/CatchExceptionTest.java
Reviewed-by: vlivanov, psandoz
Diffstat (limited to 'test/java/lang')
-rw-r--r--test/java/lang/invoke/MethodHandles/CatchExceptionTest.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
index 7202f2f84c..a7e31f4895 100644
--- a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
+++ b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
@@ -24,6 +24,8 @@ package test.java.lang.invoke.MethodHandles;
import com.oracle.testlibrary.jsr292.Helper;
import jdk.testlibrary.Asserts;
+import jdk.testlibrary.TimeLimitedRunner;
+import jdk.testlibrary.Utils;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -33,6 +35,7 @@ import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
+import java.util.concurrent.TimeUnit;
/* @test
* @library /lib/testlibrary/jsr292 /lib/testlibrary/
@@ -94,14 +97,23 @@ public class CatchExceptionTest {
}
public static void main(String[] args) throws Throwable {
- for (CatchExceptionTest test : TestFactory.MANDATORY_TEST_CASES) {
- test.runTest();
- }
TestFactory factory = new TestFactory();
- CatchExceptionTest test;
- while ((test = factory.nextTest()) != null ) {
+ long timeout = Helper.IS_THOROUGH ? 0L : Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
+ // substract vm init time and reserve time for vm exit
+ timeout *= 0.9;
+ TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d,
+ () -> {
+ CatchExceptionTest test = factory.nextTest();
+ if (test != null) {
+ test.runTest();
+ return true;
+ }
+ return false;
+ });
+ for (CatchExceptionTest test : TestFactory.MANDATORY_TEST_CASES) {
test.runTest();
}
+ runner.call();
}
private List<Class<?>> getThrowerParams(boolean isVararg, int argsCount) {