mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Bug 335324: Prepare JUnit tests for the container (process) being the breakpointTarget context
This commit is contained in:
parent
5bca49ece1
commit
5d1be8f620
4 changed files with 37 additions and 27 deletions
|
@ -73,8 +73,6 @@ public class SyncUtil {
|
|||
private static DsfSession fSession;
|
||||
|
||||
private static CommandFactory fCommandFactory;
|
||||
|
||||
private static IBreakpointsTargetDMContext fBreakpointsDmc;
|
||||
private static IGDBProcesses fProcessesService;
|
||||
|
||||
// Initialize some common things, once the session has been established
|
||||
|
@ -93,9 +91,7 @@ public class SyncUtil {
|
|||
fExpressions = tracker.getService(IExpressions.class);
|
||||
fProcessesService = tracker.getService(IGDBProcesses.class);
|
||||
fCommandFactory = fGdbControl.getCommandFactory();
|
||||
|
||||
fBreakpointsDmc = (IBreakpointsTargetDMContext)fGdbControl.getContext();
|
||||
|
||||
|
||||
tracker.dispose();
|
||||
}
|
||||
};
|
||||
|
@ -224,12 +220,14 @@ public class SyncUtil {
|
|||
public static int addBreakpoint(final String location, final boolean temporary, int timeout)
|
||||
throws Throwable {
|
||||
|
||||
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
||||
|
||||
Query<MIBreakInsertInfo> query = new Query<MIBreakInsertInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIBreakInsertInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIBreakInsert(fBreakpointsDmc, temporary, false, null, 0, location, 0),
|
||||
fCommandFactory.createMIBreakInsert(bpTargetDmc, temporary, false, null, 0, location, 0),
|
||||
rm);
|
||||
}
|
||||
};
|
||||
|
@ -241,10 +239,13 @@ public class SyncUtil {
|
|||
|
||||
|
||||
public static int[] getBreakpointList(int timeout) throws Throwable {
|
||||
Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
||||
|
||||
Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIBreakListInfo> rm) {
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIBreakList(fBreakpointsDmc), rm);
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIBreakList(bpTargetDmc), rm);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -264,11 +265,14 @@ public class SyncUtil {
|
|||
}
|
||||
|
||||
public static void deleteBreakpoint(final int[] breakpointIndices, int timeout) throws Throwable {
|
||||
Query<MIInfo> query = new Query<MIInfo>() {
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
||||
|
||||
Query<MIInfo> query = new Query<MIInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIBreakDelete(fBreakpointsDmc, breakpointIndices),
|
||||
fCommandFactory.createMIBreakDelete(bpTargetDmc, breakpointIndices),
|
||||
rm);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
|
||||
|
@ -34,8 +35,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.FormattedValueDMData;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.cdt.dsf.internal.DsfPlugin;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||
|
@ -185,10 +186,6 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
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);
|
||||
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assert(fRunControl != null);
|
||||
|
@ -206,6 +203,10 @@ public class MIBreakpointsTest extends BaseTestCase {
|
|||
}
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
||||
assert(fBreakpointsDmc != null);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
|
||||
|
@ -40,8 +41,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.FormattedValueDMData;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.cdt.dsf.internal.DsfPlugin;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||
|
@ -166,10 +167,6 @@ public class MICatchpointsTest extends BaseTestCase {
|
|||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assertNotNull(fServicesTracker);
|
||||
|
||||
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
|
||||
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
|
||||
assertNotNull(fBreakpointsDmc);
|
||||
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assertNotNull(fRunControl);
|
||||
|
@ -188,6 +185,11 @@ public class MICatchpointsTest extends BaseTestCase {
|
|||
}
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
||||
assertNotNull(fBreakpointsDmc);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMData;
|
||||
|
@ -27,7 +28,7 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsAddedEvent;
|
|||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsRemovedEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsUpdatedEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||
|
@ -37,6 +38,7 @@ 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;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||
import org.junit.After;
|
||||
|
@ -125,11 +127,6 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
ICommandControlService commandControl = fServicesTracker.getService(ICommandControlService.class);
|
||||
fBreakpointsDmc = (IBreakpointsTargetDMContext)commandControl.getContext();
|
||||
assert(fBreakpointsDmc != null);
|
||||
|
||||
// fTraceTargetDmc = (ITraceTargetDMContext)commandControl.getContext();
|
||||
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
// fTraceService = fServicesTracker.getService(ITraceControl.class);
|
||||
|
@ -143,6 +140,12 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|||
}
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
|
||||
assert(fBreakpointsDmc != null);
|
||||
// fTraceTargetDmc = DMContexts.getAncestorOfType(containerDmc, ITraceTargetDMContext.class);
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Add table
Reference in a new issue