tests code cleanup

GitOrigin-RevId: 94e32ad6cbd23e1f0fec26ff6fa42ee63ffaad41
This commit is contained in:
Egor Ushakov
2022-10-03 10:49:53 +02:00
committed by intellij-monorepo-bot
parent d9107c0363
commit e9448e2b7c
2 changed files with 2 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger;
import com.intellij.JavaTestUtil;
@@ -31,7 +31,6 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.target.TargetEnvironmentRequest;
import com.intellij.execution.target.TargetedCommandLineBuilder;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.compiler.CompilerManager;
@@ -59,7 +58,6 @@ import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCase {
protected static final int DEFAULT_ADDRESS = 3456;
@@ -67,9 +65,6 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
protected DebuggerSession myDebuggerSession;
private ExecutionEnvironment myExecutionEnvironment;
private RunProfileState myRunnableState;
private final AtomicInteger myRestart = new AtomicInteger();
private static final int MAX_RESTARTS = 3;
private volatile TestDisposable myTestRootDisposable;
private final List<Runnable> myTearDownRunnables = new ArrayList<>();
private CompilerManagerImpl myCompilerManager;
@@ -121,42 +116,10 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
myDebuggerSession = null;
}
// disabled, see JRE-253
if (false && 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 <= MAX_RESTARTS;
}
@Override
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> runnable) throws Throwable {
myTestRootDisposable = new TestDisposable();
super.runBareRunnable(runnable);
while (needsRestart()) {
assert myTestRootDisposable.isDisposed();
myTestRootDisposable = new TestDisposable();
super.runBareRunnable(runnable);
}
}
@NotNull
@Override
public Disposable getTestRootDisposable() {
return myTestRootDisposable;
}
protected void checkTestOutput() throws Exception {
getChecker().checkValid(getTestProjectJdk());
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger.impl;
import com.intellij.execution.process.ProcessOutputTypes;
@@ -170,10 +170,6 @@ public class OutputChecker {
}
}
public boolean contains(String str) {
return buildOutputString().contains(str);
}
private synchronized String buildOutputString() {
StringBuilder result = new StringBuilder();
for (Key key : OUTPUT_ORDER) {