From cad6fdb32374848054a30096d4a434d640ef0590 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 13 Sep 2017 12:57:19 +0300 Subject: [PATCH] Reenable workaround for JVMTI_ERROR_WRONG_PHASE in debugger tests It was fixed in custom intellij jdk and disabled in DescriptorTestCase. --- .../idea/debugger/KotlinDebuggerTestCase.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestCase.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestCase.java index 422b367280c..ffc58eb4853 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestCase.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestCase.java @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.debugger; import com.google.common.collect.Lists; import com.intellij.compiler.impl.CompilerUtil; +import com.intellij.debugger.DebuggerManagerEx; import com.intellij.debugger.impl.DescriptorTestCase; import com.intellij.debugger.impl.OutputChecker; import com.intellij.execution.ExecutionTestCase; @@ -129,6 +130,36 @@ public abstract class KotlinDebuggerTestCase extends DescriptorTestCase { super.setUp(); } + @Override + protected void runTest() throws Throwable { + super.runTest(); + if(getDebugProcess() != null) { + getDebugProcess().getProcessHandler().startNotify(); + waitProcess(getDebugProcess().getProcessHandler()); + waitForCompleted(); + //disposeSession(myDebuggerSession); + assertNull(DebuggerManagerEx.getInstanceEx(myProject).getDebugProcess(getDebugProcess().getProcessHandler())); + myDebuggerSession = null; + } + + if (getChecker().contains("JVMTI_ERROR_WRONG_PHASE(112)")) { + myRestart.incrementAndGet(); + if (needsRestart()) { + return; + } + } else { + myRestart.set(0); + } + + throwExceptionsIfAny(); + checkTestOutput(); + } + + private boolean needsRestart() { + int restart = myRestart.get(); + return restart > 0 && restart <= 3; + } + private static void deleteLocalCacheDirectory(boolean assertDeleteSuccess) { System.out.println("-- Remove local cache directory --"); boolean deleteResult = FilesKt.deleteRecursively(LOCAL_CACHE_DIR);