Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-06-27 08:34:54 +0000
committerAndrey Loskutov2019-06-27 08:34:54 +0000
commit0853e4491995675cf2ef936b5f57f1c77b00d837 (patch)
tree29f4ce4a12ce309878cd027418d4c6835b9f98b0 /org.eclipse.jdt.core.tests.compiler
parent679e7292c0717bd8f4d605db0877d8af50283d6f (diff)
downloadeclipse.jdt.core-0853e4491995675cf2ef936b5f57f1c77b00d837.tar.gz
eclipse.jdt.core-0853e4491995675cf2ef936b5f57f1c77b00d837.tar.xz
eclipse.jdt.core-0853e4491995675cf2ef936b5f57f1c77b00d837.zip
Bug 547417 - trying to fix 180 test fails, take 3
- increased timeout again from 20 to 30 seconds - increased attempts count from 10 to 30 - redirect all output to System.out, because this seem the only stream we get logged in tests Change-Id: I76f9293d2a5b786e669cc9e1e1b23938d9a1ca20 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java65
1 files changed, 37 insertions, 28 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java
index 1e4651ee58..74f1dcf6ae 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java
@@ -18,6 +18,8 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
+import java.time.Duration;
+import java.time.Instant;
import java.util.List;
import java.util.Map;
@@ -59,31 +61,33 @@ public class DebugEvaluationSetup extends EvaluationSetup {
launcher.setDebugPort(debugPort);
this.launchedVM = launcher.launch();
} catch (TargetException e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
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();
+ e.printStackTrace(System.out);
}
-
+
// 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);
+ startReader("VM's sterr reader", this.launchedVM.getErrorStream(), System.out);
} catch (TargetException e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
-
- // Start JDI connection (try 10 times)
- for (int i = 0; i < 10; i++) {
+
+ // Start JDI connection
+ int attempts = 30;
+ Instant start = Instant.now();
+ for (int i = 0; i < attempts; i++) {
try {
VirtualMachineManager manager = org.eclipse.jdi.Bootstrap.virtualMachineManager();
List connectors = manager.attachingConnectors();
if (connectors.size() == 0) {
- System.err.println(getName() + ": could not get attachingConnectors() from VM");
+ System.out.println(getName() + ": could not get attachingConnectors() from VM");
break;
}
AttachingConnector connector = (AttachingConnector)connectors.get(0);
@@ -98,26 +102,30 @@ public class DebugEvaluationSetup extends EvaluationSetup {
}
argument = (Connector.Argument)args.get("timeout");
if (argument != null) {
- argument.setValue("20000");
+ argument.setValue("30000");
}
this.vm = connector.attach(args);
System.out.println(getName() + ": connected to VM using port " + debugPort);
-
+
// workaround pb with some VMs
this.vm.resume();
-
+
break;
} catch (IllegalConnectorArgumentsException | IOException e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
try {
System.out.println(getName() + ": could not contact the VM at " + launcher.getTargetAddress() + ":" + debugPort + ". Retrying...");
- Thread.sleep(100);
+ Thread.sleep(1000);
} catch (InterruptedException e2) {
- e2.printStackTrace();
+ e2.printStackTrace(System.out);
}
}
}
if (this.vm == null) {
+ Duration duration = Duration.between(start, Instant.now());
+ System.out.println(getName() + ": could NOT contact the VM at " + launcher.getTargetAddress() + ":"
+ + debugPort + ". Stop trying after " + attempts + " attempts, took " + duration.getSeconds()
+ + " seconds");
if (this.launchedVM != null) {
// If the VM is not running, output error stream
try {
@@ -131,9 +139,9 @@ public class DebugEvaluationSetup extends EvaluationSetup {
} while (read != -1);
}
} catch (TargetException | IOException e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
-
+
// Shut it down
try {
if (this.target != null) {
@@ -144,37 +152,38 @@ public class DebugEvaluationSetup extends EvaluationSetup {
try {
Thread.sleep(retry * 100);
} catch (InterruptedException e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
}
if (this.launchedVM.isRunning()) {
this.launchedVM.shutDown();
}
} catch (TargetException e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
}
- System.err.println(getName() + ": could not contact the VM");
+ System.out.println(getName() + ": could not contact the VM at port " + debugPort);
return;
}
-
+
// Create context
this.context = new EvaluationContext();
-
+
// Create target
this.target = new TargetInterface();
-
+
// 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(evalServer, 60000);
-
+ this.target.connect(evalServer, 60000);
+
assertTrue(getName() + ": failed to connect VM server", this.target.isConnected());
-
+
System.out.println(getName() + ": connected to target using port " + debugPort);
-
+
// Create name environment
this.env = new FileSystem(Util.getJavaClassLibs(), new String[0], null);
} catch (IOException e1) {
+ e1.printStackTrace(System.out);
throw new Error(getName() + ": Failed to open socket", e1);
}
}

Back to the top