1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 335098: JUnit tests don't always use the DSF executor when they should

This commit is contained in:
Marc Khouzam 2011-01-23 02:28:59 +00:00
parent dde309b5ee
commit ed94590082
11 changed files with 256 additions and 161 deletions

View file

@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.framework;
import java.util.concurrent.ExecutionException;
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
@ -58,13 +60,31 @@ public class ServiceEventWaitor<V> {
fSession = session;
fEventTypeClass = eventClass;
fEvent = null;
fSession.addServiceEventListener(this, null);
Runnable runnable = new Runnable() {
public void run() {
fSession.addServiceEventListener(ServiceEventWaitor.this, null);
}
};
try {
fSession.getExecutor().submit(runnable).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
@Override
protected void finalize() throws Throwable {
super.finalize();
if (fEventTypeClass != null) fSession.removeServiceEventListener(this);
if (fEventTypeClass != null) {
Runnable runnable = new Runnable() {
public void run() {
fSession.removeServiceEventListener(ServiceEventWaitor.this);
}
};
fSession.getExecutor().submit(runnable).get();
}
}
/*

View file

@ -21,6 +21,7 @@ import junit.framework.Assert;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IExpressions;
@ -28,7 +29,8 @@ import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
@ -37,7 +39,8 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.MIRunControl;
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
import org.eclipse.cdt.dsf.mi.service.MIStack;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
import org.eclipse.cdt.dsf.mi.service.command.events.MIRunningEvent;
@ -59,7 +62,7 @@ import org.eclipse.core.runtime.Status;
public class SyncUtil {
private static ICommandControlService fCommandControl;
private static MIRunControl fRunControl;
private static IMIRunControl fRunControl;
private static MIStack fStack;
private static IExpressions fExpressions;
private static DsfSession fSession;
@ -67,30 +70,31 @@ public class SyncUtil {
private static CommandFactory fCommandFactory;
private static IBreakpointsTargetDMContext fBreakpointsDmc;
private static IProcesses fProcessesService;
public static final int WAIT_FOREVER = ServiceEventWaitor.WAIT_FOREVER;
private static IMIProcesses fProcessesService;
// Initialize some common things, once the session has been established
public static void initialize(DsfSession session) {
public static void initialize(DsfSession session) throws Exception {
fSession = session;
DsfServicesTracker tracker =
new DsfServicesTracker(TestsPlugin.getBundleContext(),
fSession.getId());
Runnable runnable = new Runnable() {
public void run() {
DsfServicesTracker tracker =
new DsfServicesTracker(TestsPlugin.getBundleContext(),
fSession.getId());
fCommandControl = tracker.getService(ICommandControlService.class);
fCommandControl = tracker.getService(ICommandControlService.class);
fRunControl = tracker.getService(IMIRunControl.class);
fStack = tracker.getService(MIStack.class);
fExpressions = tracker.getService(IExpressions.class);
fProcessesService = tracker.getService(IMIProcesses.class);
fCommandFactory = tracker.getService(IMICommandControl.class).getCommandFactory();
fBreakpointsDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
fBreakpointsDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
fRunControl = tracker.getService(MIRunControl.class);
fStack = tracker.getService(MIStack.class);
fExpressions = tracker.getService(IExpressions.class);
fProcessesService = tracker.getService(IProcesses.class);
fCommandFactory = tracker.getService(IMICommandControl.class).getCommandFactory();
tracker.dispose();
tracker.dispose();
}
};
fSession.getExecutor().submit(runnable).get();
}
public static MIStoppedEvent step(int numSteps, final StepType stepType) throws Throwable {
@ -429,7 +433,10 @@ public class SyncUtil {
public static IMIExecutionDMContext createExecutionContext(final IContainerDMContext parentCtx, final int threadId) throws Throwable {
Callable<IMIExecutionDMContext> callable = new Callable<IMIExecutionDMContext>() {
public IMIExecutionDMContext call() throws Exception {
return fRunControl.createMIExecutionContext(parentCtx, threadId);
String threadIdStr = Integer.toString(threadId);
IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
}
};
return fSession.getExecutor().submit(callable).get();

View file

@ -65,11 +65,13 @@ public class GDBProcessesTest extends BaseTestCase {
@Before
public void init() throws Exception {
fSession = getGDBLaunch().getSession();
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
/*
* Get the GDBProcesses & MIRunControl service.
*/
fProcService = fServicesTracker.getService(IMIProcesses.class);
Runnable runnable = new Runnable() {
public void run() {
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
fProcService = fServicesTracker.getService(IMIProcesses.class);
}
};
fSession.getExecutor().submit(runnable).get();
}
@After

View file

@ -96,6 +96,7 @@ public class MIBreakpointsTest extends BaseTestCase {
protected DsfServicesTracker fServicesTracker;
protected MIRunControl fRunControl;
protected IBreakpoints fBreakpointService;
protected IExpressions fExpressionService;
// Event Management
protected static Boolean lock = true;
@ -176,34 +177,47 @@ public class MIBreakpointsTest extends BaseTestCase {
}
@Before
public void testCaseInitialization() {
public void testCaseInitialization() throws Exception {
// Get a reference to the breakpoint service
fSession = getGDBLaunch().getSession();
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assert(fServicesTracker != null);
Runnable runnable = new Runnable() {
public void run() {
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assert(fServicesTracker != null);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
assert(fBreakpointsDmc != null);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
assert(fBreakpointsDmc != null);
fRunControl = fServicesTracker.getService(MIRunControl.class);
assert(fRunControl != null);
fRunControl = fServicesTracker.getService(MIRunControl.class);
assert(fRunControl != null);
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
assert(fBreakpointService != null);
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
assert(fBreakpointService != null);
// Register to breakpoint events
fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null);
fExpressionService = fServicesTracker.getService(IExpressions.class);
assert(fExpressionService != null);
clearEventCounters();
// Register to breakpoint events
fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null);
clearEventCounters();
}
};
fSession.getExecutor().submit(runnable).get();
}
@After
public void testCaseCleanup() {
public void testCaseCleanup() throws Exception {
// Clear the references (not strictly necessary)
fRunControl.getSession().removeServiceEventListener(MIBreakpointsTest.this);
Runnable runnable = new Runnable() {
public void run() {
fRunControl.getSession().removeServiceEventListener(MIBreakpointsTest.this);
}
};
fSession.getExecutor().submit(runnable).get();
fBreakpointService = null;
fRunControl = null;
fServicesTracker.dispose();
@ -361,9 +375,6 @@ public class MIBreakpointsTest extends BaseTestCase {
*/
private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable {
final IExpressions fExpressionService = fServicesTracker.getService(IExpressions.class);
assert (fExpressionService != null);
// Get a stack context (temporary - should be an MIcontainerDMC)
final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService,

View file

@ -99,6 +99,7 @@ public class MICatchpointsTest extends BaseTestCase {
private DsfServicesTracker fServicesTracker;
private MIRunControl fRunControl;
private IBreakpoints fBreakpointService;
private IExpressions fExpressionService;
// Event Management
private static Boolean fEventHandlerLock = true;
@ -157,34 +158,48 @@ public class MICatchpointsTest extends BaseTestCase {
}
@Before
public void testCaseInitialization() {
public void testCaseInitialization() throws Exception {
// Get a reference to the breakpoint service
fSession = getGDBLaunch().getSession();
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assertNotNull(fServicesTracker);
Runnable runnable = new Runnable() {
public void run() {
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assertNotNull(fServicesTracker);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
assertNotNull(fBreakpointsDmc);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
assertNotNull(fBreakpointsDmc);
fRunControl = fServicesTracker.getService(MIRunControl.class);
assertNotNull(fRunControl);
fRunControl = fServicesTracker.getService(MIRunControl.class);
assertNotNull(fRunControl);
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
assertNotNull(fBreakpointService);
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
assertNotNull(fBreakpointService);
// Register to receive breakpoint events
fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
fExpressionService = fServicesTracker.getService(IExpressions.class);
assertNotNull(fExpressionService);
clearEventCounters();
// Register to receive breakpoint events
fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
clearEventCounters();
}
};
fSession.getExecutor().submit(runnable).get();
}
@After
public void testCaseCleanup() {
public void testCaseCleanup() throws Exception {
Runnable runnable = new Runnable() {
public void run() {
fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this);
}
};
fSession.getExecutor().submit(runnable).get();
// Clear the references (not strictly necessary)
fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this);
fBreakpointService = null;
fRunControl = null;
fServicesTracker.dispose();
@ -316,9 +331,6 @@ public class MICatchpointsTest extends BaseTestCase {
*/
private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable {
final IExpressions fExpressionService = fServicesTracker.getService(IExpressions.class);
assert (fExpressionService != null);
// Get a stack context (temporary - should be an MIcontainerDMC)
final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression);
final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService,

View file

@ -19,14 +19,14 @@ import java.math.BigInteger;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.debug.service.IExpressions;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
import org.eclipse.cdt.dsf.debug.service.IInstruction;
import org.eclipse.cdt.dsf.debug.service.IMixedInstruction;
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext;
import org.eclipse.cdt.dsf.debug.service.IExpressions;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.cdt.dsf.debug.service.IInstruction;
import org.eclipse.cdt.dsf.debug.service.IMixedInstruction;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.mi.service.MIDisassembly;
@ -88,30 +88,30 @@ public class MIDisassemblyTest extends BaseTestCase {
}
@Before
public void testCaseInitialization() {
public void testCaseInitialization() throws Exception {
fSession = getGDBLaunch().getSession();
Runnable runnable = new Runnable() {
public void run() {
// Get a reference to the memory service
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assert(fServicesTracker != null);
// Get a reference to the memory service
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assert(fServicesTracker != null);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fDisassemblyDmc = (IDisassemblyDMContext)commandControl.getContext();
assert(fDisassemblyDmc != null);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fDisassemblyDmc = (IDisassemblyDMContext)commandControl.getContext();
assert(fDisassemblyDmc != null);
fDisassembly = fServicesTracker.getService(MIDisassembly.class);
assert(fDisassembly != null);
fDisassembly = fServicesTracker.getService(MIDisassembly.class);
assert(fDisassembly != null);
fExpressionService = fServicesTracker.getService(IExpressions.class);
assert(fExpressionService != null);
// fSession.addServiceEventListener(MIDisassemblyTest.this, null);
fExpressionService = fServicesTracker.getService(IExpressions.class);
assert(fExpressionService != null);
}
};
fSession.getExecutor().submit(runnable).get();
}
@After
public void testCaseCleanup() {
// Clear the references (not strictly necessary)
// fSession.removeServiceEventListener(MIDisassemblyTest.this);
fExpressionService = null;
fDisassembly = null;
fServicesTracker.dispose();

View file

@ -77,18 +77,28 @@ public class MIExpressionsTest extends BaseTestCase {
}
@Before
public void init() {
public void init() throws Exception {
fSession = getGDBLaunch().getSession();
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
Runnable runnable = new Runnable() {
public void run() {
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
fExpService = fServicesTracker.getService(IExpressions.class);
fSession.addServiceEventListener(this, null);
clearExprChangedData();
fExpService = fServicesTracker.getService(IExpressions.class);
fSession.addServiceEventListener(MIExpressionsTest.this, null);
clearExprChangedData();
}
};
fSession.getExecutor().submit(runnable).get();
}
@After
public void shutdown() {
fSession.removeServiceEventListener(this);
public void shutdown() throws Exception {
Runnable runnable = new Runnable() {
public void run() {
fSession.removeServiceEventListener(MIExpressionsTest.this);
}
};
fSession.getExecutor().submit(runnable).get();
fExpService = null;
fServicesTracker.dispose();
}

View file

@ -94,33 +94,43 @@ public class MIMemoryTest extends BaseTestCase {
@Before
public void testCaseInitialization() throws Throwable {
fSession = getGDBLaunch().getSession();
fMemoryDmc = (IMemoryDMContext)SyncUtil.getContainerContext();
assert(fMemoryDmc != null);
// Get a reference to the memory service
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assert(fServicesTracker != null);
Runnable runnable = new Runnable() {
public void run() {
// Get a reference to the memory service
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
assert(fServicesTracker != null);
fMemoryDmc = (IMemoryDMContext)SyncUtil.getContainerContext();
assert(fMemoryDmc != null);
fRunControl = fServicesTracker.getService(MIRunControl.class);
assert(fRunControl != null);
fRunControl = fServicesTracker.getService(MIRunControl.class);
assert(fRunControl != null);
fMemoryService = fServicesTracker.getService(IMemory.class);
assert(fMemoryService != null);
fMemoryService = fServicesTracker.getService(IMemory.class);
assert(fMemoryService != null);
fExpressionService = fServicesTracker.getService(IExpressions.class);
assert(fExpressionService != null);
fExpressionService = fServicesTracker.getService(IExpressions.class);
assert(fExpressionService != null);
fSession.addServiceEventListener(MIMemoryTest.this, null);
fBaseAddress = null;
clearEventCounters();
fSession.addServiceEventListener(MIMemoryTest.this, null);
fBaseAddress = null;
clearEventCounters();
}
};
fSession.getExecutor().submit(runnable).get();
}
@After
public void testCaseCleanup() {
public void testCaseCleanup() throws Exception {
// Clear the references (not strictly necessary)
fBaseAddress = null;
fSession.removeServiceEventListener(MIMemoryTest.this);
Runnable runnable = new Runnable() {
public void run() {
fSession.removeServiceEventListener(MIMemoryTest.this);
}
};
fSession.getExecutor().submit(runnable).get();
fBaseAddress = null;
fExpressionService = null;
fMemoryService = null;
fRunControl = null;

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.LinkedList;
@ -28,10 +28,10 @@ import org.eclipse.cdt.dsf.datamodel.CompositeDMContext;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
import org.eclipse.cdt.dsf.debug.service.IRegisters;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
import org.eclipse.cdt.dsf.debug.service.IRegisters;
import org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMContext;
import org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMData;
import org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterGroupDMContext;
@ -95,18 +95,23 @@ public class MIRegistersTest extends BaseTestCase {
@Before
public void init() throws Exception {
fSession = getGDBLaunch().getSession();
// We obtain the services we need after the new
// launch has been performed
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
Runnable runnable = new Runnable() {
public void run() {
// We obtain the services we need after the new
// launch has been performed
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
fRegService = fServicesTracker.getService(IRegisters.class);
fRunControl = fServicesTracker.getService(IRunControl.class);
fRegService = fServicesTracker.getService(IRegisters.class);
fRunControl = fServicesTracker.getService(IRunControl.class);
}
};
fSession.getExecutor().submit(runnable).get();
}
@BeforeClass

View file

@ -43,6 +43,7 @@ import org.eclipse.cdt.dsf.mi.service.MIRunControl;
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
@ -99,18 +100,25 @@ public class MIRunControlTest extends BaseTestCase {
@Before
public void init() throws Exception {
fServicesTracker =
new DsfServicesTracker(TestsPlugin.getBundleContext(),
getGDBLaunch().getSession().getId());
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
final DsfSession session = getGDBLaunch().getSession();
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
Runnable runnable = new Runnable() {
public void run() {
fServicesTracker =
new DsfServicesTracker(TestsPlugin.getBundleContext(),
session.getId());
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
}
};
session.getExecutor().submit(runnable).get();
}

View file

@ -119,30 +119,40 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
// }
@Before
public void initialTest() throws Throwable {
public void initialTest() throws Exception {
fSession = getGDBLaunch().getSession();
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
Runnable runnable = new Runnable() {
public void run() {
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
assert(fBreakpointsDmc != null);
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
assert(fBreakpointsDmc != null);
// fTraceTargetDmc = (ITraceTargetDMContext)commandControl.getContext();
// fTraceTargetDmc = (ITraceTargetDMContext)commandControl.getContext();
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
// fTraceService = fServicesTracker.getService(ITraceControl.class);
fSession.addServiceEventListener(this, null);
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
// fTraceService = fServicesTracker.getService(ITraceControl.class);
fSession.addServiceEventListener(GDBRemoteTracepointsTest_7_0.this, null);
// Create a large array to make sure we don't run out
fTracepoints = new IBreakpointDMContext[100];
// Create a large array to make sure we don't run out
fTracepoints = new IBreakpointDMContext[100];
// Run an initial test to check that everything is ok with GDB
checkTraceInitialStatus();
// Run an initial test to check that everything is ok with GDB
checkTraceInitialStatus();
}
};
fSession.getExecutor().submit(runnable).get();
}
@After
public void shutdown() {
fSession.removeServiceEventListener(this);
public void shutdown() throws Exception {
Runnable runnable = new Runnable() {
public void run() {
fSession.removeServiceEventListener(GDBRemoteTracepointsTest_7_0.this);
}
};
fSession.getExecutor().submit(runnable).get();
fBreakpointService = null;
fServicesTracker.dispose();
}
@ -604,7 +614,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
* by the @Before method; this allows to verify every launch of GDB.
*/
@Test
public void checkTraceInitialStatus() throws Throwable {
public void checkTraceInitialStatus() {
// checkTraceStatus(true, false, 0);
}