Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-05-27 07:39:13 +0000
committerAndrey Loskutov2019-05-27 07:39:13 +0000
commit75f3e352a42c492d320c07a30923f559c39bbf8c (patch)
tree9c5184021fdf424b3499457ec66020247528f6a3
parent3d670fe48cd3ec2fe4d3f7a2fca5830a4057291b (diff)
downloadeclipse.jdt.core-I20190528-0850.tar.gz
eclipse.jdt.core-I20190528-0850.tar.xz
eclipse.jdt.core-I20190528-0850.zip
- 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>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java29
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java7
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();
}

Back to the top