From da04759802924adefd826c4e53261b48bd572aea Mon Sep 17 00:00:00 2001 From: John Cortell Date: Fri, 9 Apr 2010 22:55:26 +0000 Subject: [PATCH] Neglected to spin off the service call in getProcessContext() on the dsf executor --- .../tests/dsf/gdb/tests/GDBProcessesTest.java | 35 ++++++++++------- .../tests/dsf/gdb/tests/MIRunControlTest.java | 38 +++++++++++-------- 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java index b6cc6354e28..9d35c7b80f9 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java @@ -192,21 +192,28 @@ public class GDBProcessesTest extends BaseTestCase { final AsyncCompletionWaitor waitor = new AsyncCompletionWaitor(); - fProcService.getProcessesBeingDebugged(fGdbCtrl.getContext(), new DataRequestMonitor(fSession.getExecutor(), null) { - @Override - protected void handleCompleted() { - if (isSuccess()) { - IDMContext[] contexts = getData(); - Assert.assertNotNull("invalid return value from service", contexts); - Assert.assertEquals("unexpected number of processes", contexts.length, 1); - IDMContext context = contexts[0]; - IProcessDMContext processContext = DMContexts.getAncestorOfType(context, IProcessDMContext.class); - Assert.assertNotNull("unexpected process context type ", processContext); - waitor.setReturnInfo(processContext); - } + fProcService.getExecutor().submit(new Runnable() { + public void run() { + fProcService.getProcessesBeingDebugged(fGdbCtrl.getContext(), new DataRequestMonitor(fSession.getExecutor(), null) { + @Override + protected void handleCompleted() { + if (isSuccess()) { + IDMContext[] contexts = getData(); + Assert.assertNotNull("invalid return value from service", contexts); + Assert.assertEquals("unexpected number of processes", contexts.length, 1); + IDMContext context = contexts[0]; + IProcessDMContext processContext = DMContexts.getAncestorOfType(context, IProcessDMContext.class); + Assert.assertNotNull("unexpected process context type ", processContext); + waitor.setReturnInfo(processContext); + } + } + + }); } - - }); + }); + + + waitor.waitUntilDone(TestsPlugin.massageTimeout(2000)); Assert.assertTrue(fWait.getMessage(), fWait.isOK()); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java index 15f988ca59d..41c2e8e8f53 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java @@ -186,24 +186,30 @@ public class MIRunControlTest extends BaseTestCase { @ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()") private IProcessDMContext getProcessContext() throws InterruptedException { assert !fRunCtrl.getExecutor().isInExecutorThread(); - - final AsyncCompletionWaitor waitor = new AsyncCompletionWaitor(); - fProcService.getProcessesBeingDebugged(fGDBCtrl.getContext(), new DataRequestMonitor(fRunCtrl.getExecutor(), null) { - @Override - protected void handleCompleted() { - if (isSuccess()) { - IDMContext[] contexts = getData(); - Assert.assertNotNull("invalid return value from service", contexts); - Assert.assertEquals("unexpected number of processes", contexts.length, 1); - IDMContext context = contexts[0]; - IProcessDMContext processContext = DMContexts.getAncestorOfType(context, IProcessDMContext.class); - Assert.assertNotNull("unexpected process context type ", processContext); - waitor.setReturnInfo(processContext); - } + final AsyncCompletionWaitor waitor = new AsyncCompletionWaitor(); + + fRunCtrl.getExecutor().submit(new Runnable() { + public void run() { + fProcService.getProcessesBeingDebugged(fGDBCtrl.getContext(), new DataRequestMonitor(fRunCtrl.getExecutor(), null) { + @Override + protected void handleCompleted() { + if (isSuccess()) { + IDMContext[] contexts = getData(); + Assert.assertNotNull("invalid return value from service", contexts); + Assert.assertEquals("unexpected number of processes", contexts.length, 1); + IDMContext context = contexts[0]; + IProcessDMContext processContext = DMContexts.getAncestorOfType(context, IProcessDMContext.class); + Assert.assertNotNull("unexpected process context type ", processContext); + waitor.setReturnInfo(processContext); + } + } + + }); } - - }); + }); + + waitor.waitUntilDone(TestsPlugin.massageTimeout(2000)); Assert.assertTrue(waitor.getMessage(), waitor.isOK());