Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2020-02-17 12:26:57 +0000
committerPaul Pazderski2020-02-17 14:10:37 +0000
commit5692fb7afd12f93763cb82d05aa276b2b510a903 (patch)
treeca3f6cd52765ac9fd874aa2ff08bbbfa7a3cec3c
parent6e2746047336862f17bf2e0a73cb95e43565a658 (diff)
downloadeclipse.platform.debug-I20200217-1800.tar.gz
eclipse.platform.debug-I20200217-1800.tar.xz
eclipse.platform.debug-I20200217-1800.zip
Process termination is recognized in a separate thread. Looking for termination timestamp without waiting for termination is a bad idea. Change-Id: I2fe934b898b689a7cfba9e2eaec4676bd97103cd Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
index 3dc17e159..837e0ef94 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
@@ -33,6 +33,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.resources.IContainer;
@@ -53,6 +55,7 @@ import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.internal.core.LaunchConfiguration;
@@ -1207,14 +1210,40 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
public void testTerminateTimeStamp() throws Exception {
ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp"); //$NON-NLS-1$
ILaunch launch = workingCopy.launch(ILaunchManager.DEBUG_MODE, null);
+ AtomicBoolean launchTerminated = new AtomicBoolean();
+ ILaunchesListener2 listener = new ILaunchesListener2() {
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ for (ILaunch l : launches) {
+ if (l == launch) {
+ launchTerminated.set(true);
+ }
+ }
+ }
+ };
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
IProcess process = null;
try {
process = DebugPlugin.newProcess(launch, new MockProcess(0), "test-terminate-timestamp");
+ waitWhile(c -> !launchTerminated.get(), testTimeout, c -> "Launch did not finished");
String stamp = launch.getAttribute(DebugPlugin.ATTR_TERMINATE_TIMESTAMP);
assertNotNull("missing time stamp", stamp); //$NON-NLS-1$
long lstamp = Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not
assertTrue("Time travel launch", lstamp <= System.currentTimeMillis());
} finally {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(listener);
if (launch != null) {
getLaunchManager().removeLaunch(launch);
}

Back to the top