From b5ad2036315f27a41c04d876a4e6dcb7d4ae864a Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 17 Mar 2021 23:31:52 +0300 Subject: [PATCH] JUnit: don't kill test runner after timeout --- .../src/main/java/org/teavm/junit/TeaVMTestRunner.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java b/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java index e1ea53789..8c54a4272 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java +++ b/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java @@ -41,7 +41,6 @@ import java.util.Properties; import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; @@ -136,7 +135,6 @@ public class TeaVMTestRunner extends Runner implements Filterable { static class RunnerKindInfo { volatile TestRunner runner; volatile TestRunStrategy strategy; - volatile ScheduledFuture cleanupFuture; } static { @@ -147,7 +145,6 @@ public class TeaVMTestRunner extends Runner implements Filterable { synchronized (TeaVMTestRunner.class) { for (RunnerKindInfo info : runners.values()) { if (info.runner != null) { - info.cleanupFuture = null; info.runner.stop(); info.runner.waitForCompletion(); } @@ -935,19 +932,13 @@ public class TeaVMTestRunner extends Runner implements Filterable { } info.runner.run(run); - if (info.cleanupFuture != null) { - info.cleanupFuture.cancel(false); - info.cleanupFuture = null; - } RunKind kind = run.getKind(); - info.cleanupFuture = executor.schedule(() -> cleanupRunner(kind), stopTimeout, TimeUnit.MILLISECONDS); } } private static void cleanupRunner(RunKind kind) { synchronized (TeaVMTestRunner.class) { RunnerKindInfo info = runners.get(kind); - info.cleanupFuture = null; info.runner.stop(); info.runner = null; }