mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 512180: Ensure previous launch is fully terminated
This has two parts. 1) In the base test itself check that the executor is shutdown. 2) GDBBackend leaves a timeout job on the executor queue, remove it proactively so the executor doesn't sit around just waiting for it to terminate. Change-Id: I9fc10f70031430f4613e0edc95093a60cf695e90 Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
This commit is contained in:
parent
1e60830c7d
commit
6ca1d5cc28
2 changed files with 5 additions and 2 deletions
|
@ -24,6 +24,7 @@ import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.util.StringUtil;
|
import org.eclipse.cdt.core.parser.util.StringUtil;
|
||||||
|
@ -495,6 +496,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
|
||||||
class GDBLaunchMonitor {
|
class GDBLaunchMonitor {
|
||||||
boolean fLaunched = false;
|
boolean fLaunched = false;
|
||||||
boolean fTimedOut = false;
|
boolean fTimedOut = false;
|
||||||
|
public ScheduledFuture<?> fTimeoutFuture;
|
||||||
}
|
}
|
||||||
final GDBLaunchMonitor fGDBLaunchMonitor = new GDBLaunchMonitor();
|
final GDBLaunchMonitor fGDBLaunchMonitor = new GDBLaunchMonitor();
|
||||||
|
|
||||||
|
@ -503,6 +505,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
if (!fGDBLaunchMonitor.fTimedOut) {
|
if (!fGDBLaunchMonitor.fTimedOut) {
|
||||||
fGDBLaunchMonitor.fLaunched = true;
|
fGDBLaunchMonitor.fLaunched = true;
|
||||||
|
fGDBLaunchMonitor.fTimeoutFuture.cancel(false);
|
||||||
if (!isSuccess()) {
|
if (!isSuccess()) {
|
||||||
requestMonitor.setStatus(getStatus());
|
requestMonitor.setStatus(getStatus());
|
||||||
}
|
}
|
||||||
|
@ -607,7 +610,7 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
|
||||||
};
|
};
|
||||||
startGdbJob.schedule();
|
startGdbJob.schedule();
|
||||||
|
|
||||||
getExecutor().schedule(new Runnable() {
|
fGDBLaunchMonitor.fTimeoutFuture = getExecutor().schedule(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Only process the event if we have not finished yet (hit
|
// Only process the event if we have not finished yet (hit
|
||||||
|
|
|
@ -577,7 +577,7 @@ public class BaseTestCase {
|
||||||
if (launch != null) {
|
if (launch != null) {
|
||||||
// Give a few seconds to allow the launch to terminate
|
// Give a few seconds to allow the launch to terminate
|
||||||
int waitCount = 100;
|
int waitCount = 100;
|
||||||
while (!launch.isTerminated() && --waitCount > 0) {
|
while (!launch.isTerminated() && !launch.getDsfExecutor().isShutdown() && --waitCount > 0) {
|
||||||
Thread.sleep(TestsPlugin.massageTimeout(100));
|
Thread.sleep(TestsPlugin.massageTimeout(100));
|
||||||
}
|
}
|
||||||
assertTrue("Launch failed to terminate before timeout", launch.isTerminated());
|
assertTrue("Launch failed to terminate before timeout", launch.isTerminated());
|
||||||
|
|
Loading…
Add table
Reference in a new issue