Bug 577185: @Ignore unstable test Bug 577189 has been raised to cover fixing this issue, and the test has been modified so that it fails very consistently. Change-Id: Ia288495158f5498e3e8ba530d544e10ac1e2d209 Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.debug/+/187593 Tested-by: Andrey Loskutov <loskutov@gmx.de> Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java index 992a0c3..c615cb4 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java
@@ -178,14 +178,19 @@ @Override public int read() throws IOException { if (processState == ProcessState.LASTREAD) { - - // Uncomment this sleep and the test will fail because - // RuntimeProcess.terminate does not wait until - // the monitor threads complete. - // try { - // Thread.sleep(1000); - // } catch (InterruptedException e) { - // } + /* + * This sleep makes + * RuntimeProcessTests.testOutputAfterDestroy() fail because + * RuntimeProcess.terminate does not wait until the monitor + * threads completes. The sleep here just helps amplify a + * the thread scheduling decision that otherwise makes + * testOutputAfterDestroy unstable (as reported in Bug + * 577185) + */ + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + } processState = ProcessState.TERMINATED; return ProcessState.LASTREAD.getCode(); }
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java index c29a249..df98073 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java
@@ -37,6 +37,7 @@ import org.eclipse.debug.tests.AbstractDebugTest; import org.eclipse.debug.tests.TestUtil; import org.eclipse.debug.tests.sourcelookup.TestLaunch; +import org.junit.Ignore; import org.junit.Test; public class RuntimeProcessTests extends AbstractDebugTest { @@ -212,7 +213,12 @@ assertThat(timeoutException.getMessage(), is(DebugCoreMessages.RuntimeProcess_terminate_failed)); } + /** + * See comment in MockProcess.MockProcess().new InputStream() {...}.read() + * for why this test fails + */ @Test + @Ignore("See https://bugs.eclipse.org/bugs/show_bug.cgi?id=577189") public void testOutputAfterDestroy() throws Exception { MockProcess proc = new MockProcess();