diff options
author | Andrey Loskutov | 2019-05-27 07:39:13 +0000 |
---|---|---|
committer | Andrey Loskutov | 2019-05-27 07:39:13 +0000 |
commit | 75f3e352a42c492d320c07a30923f559c39bbf8c (patch) | |
tree | 9c5184021fdf424b3499457ec66020247528f6a3 | |
parent | 3d670fe48cd3ec2fe4d3f7a2fca5830a4057291b (diff) | |
download | eclipse.jdt.core-I20190528-0850.tar.gz eclipse.jdt.core-I20190528-0850.tar.xz eclipse.jdt.core-I20190528-0850.zip |
Bug 547417 - trying to fix 180 test failsS4_12_0_RC1aS4_12_0_RC1I20190603-1800I20190603-0600I20190602-1800I20190602-0600I20190601-1800I20190531-1800I20190531-0245I20190529-2005I20190529-1800I20190529-0600I20190528-1800I20190528-0915I20190528-0850I20190528-0600I20190527-1805
- doubled timeout time for opening connection
- fail the test if the connection is timed out
- added printStackTrace() in all cases where it was missing
Change-Id: Icb97c5d3f9977adf174b81fbe04911ca55246593
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2 files changed, 26 insertions, 10 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java index 1be53244ba..8153472966 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.eval; +import static org.junit.Assert.assertTrue; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -56,31 +58,39 @@ public class EvaluationSetup extends CompilerTestSetup { launcher.setEvalTargetPath(EVAL_DIRECTORY); this.launchedVM = launcher.launch(); } catch (TargetException e) { - throw new Error(e.getMessage()); + e.printStackTrace(); + throw new Error(e.getMessage(), e); } - + // Thread that read the stout of the VM so that the VM doesn't block try { startReader("VM's stdout reader", this.launchedVM.getInputStream(), System.out); } catch (TargetException e) { + e.printStackTrace(); } - + // Thread that read the sterr of the VM so that the VM doesn't block try { startReader("VM's sterr reader", this.launchedVM.getErrorStream(), System.err); } catch (TargetException e) { + e.printStackTrace(); } - + // Create context this.context = new EvaluationContext(); - + // Create target this.target = new TargetInterface(); - this.target.connect(server, 30000); // allow 30s max to connect (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=188127) - + // allow 30s max to connect (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=188127) + // Increased to 60 s for https://bugs.eclipse.org/bugs/show_bug.cgi?id=547417 + this.target.connect(server, 60000); + + assertTrue("Failed to connect VM server", this.target.isConnected()); + // Create name environment this.env = new FileSystem(Util.getJavaClassLibs(), new String[0], null); } catch (IOException e1) { + e1.printStackTrace(); throw new Error("Failed to open socket", e1); } } @@ -105,7 +115,7 @@ public class EvaluationSetup extends CompilerTestSetup { }).start(); } - protected void tearDown() { + final protected void tearDown() { if (this.context != null) { LocalVirtualMachine vm = this.launchedVM; if (vm != null) { @@ -125,7 +135,8 @@ public class EvaluationSetup extends CompilerTestSetup { } this.context = null; } catch (TargetException e) { - throw new Error(e.getMessage()); + e.printStackTrace(); + throw new Error(e.getMessage(), e); } } } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java index 242e05dfc5..8453a92f07 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java @@ -69,6 +69,7 @@ public void connect(ServerSocket server, int timeout) { this.socket.setTcpNoDelay(true); break; } catch (IOException e) { + e.printStackTrace(); } if (this.socket == null) { try { @@ -88,6 +89,7 @@ public void disconnect() { try { this.socket.close(); } catch (IOException e) { + e.printStackTrace(); // Already closed. Nothing more to do } this.socket = null; @@ -141,7 +143,7 @@ public Result getResult() { /** * Returns whether this interface is connected to the target. */ -boolean isConnected() { +public boolean isConnected() { return this.socket != null; } /** @@ -156,6 +158,7 @@ public void sendClasses(boolean mustRun, ClassFile[] classes) throws TargetExcep try { Util.writeToDisk(true, "d:\\eval\\snippets", className, classes[0]); } catch(IOException e) { + e.printStackTrace(); } } else { String dirName; @@ -167,6 +170,7 @@ public void sendClasses(boolean mustRun, ClassFile[] classes) throws TargetExcep try { Util.writeToDisk(true, dirName, className, classes[i]); } catch(IOException e) { + e.printStackTrace(); } } } @@ -187,6 +191,7 @@ public void sendClasses(boolean mustRun, ClassFile[] classes) throws TargetExcep out.write(classDefinition); } } catch (IOException e) { + e.printStackTrace(); // The socket has likely been closed on the other end. So the code snippet runner has stopped. disconnect(); } |