mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Bug 518699: cleanup platform breakpoints between tests
Ensure no platform breakpoints are left over from previous tests Change-Id: I3266636e9014d4930ec72f7411c9a4dc737d0d9f
This commit is contained in:
parent
195ae12776
commit
41b5a72c73
3 changed files with 47 additions and 11 deletions
|
@ -54,11 +54,13 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
import org.eclipse.debug.core.IBreakpointManager;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
import org.eclipse.debug.core.ILaunch;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
import org.eclipse.debug.core.ILaunchManager;
|
import org.eclipse.debug.core.ILaunchManager;
|
||||||
|
import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
|
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -289,6 +291,16 @@ public class BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure we are starting with a clean/known state. That means no
|
||||||
|
* platform breakpoints that will be automatically installed.
|
||||||
|
*/
|
||||||
|
public void removeAllPlatformBreakpoints() throws CoreException {
|
||||||
|
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
|
||||||
|
IBreakpoint[] breakpoints = manager.getBreakpoints();
|
||||||
|
manager.removeBreakpoints(breakpoints, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure we are starting with a clean/known state. That means no
|
* Make sure we are starting with a clean/known state. That means no
|
||||||
* existing launches.
|
* existing launches.
|
||||||
|
@ -327,6 +339,7 @@ public class BaseTestCase {
|
||||||
@Before
|
@Before
|
||||||
public void doBeforeTest() throws Exception {
|
public void doBeforeTest() throws Exception {
|
||||||
removeTeminatedLaunchesBeforeTest();
|
removeTeminatedLaunchesBeforeTest();
|
||||||
|
removeAllPlatformBreakpoints();
|
||||||
setLaunchAttributes();
|
setLaunchAttributes();
|
||||||
doLaunch();
|
doLaunch();
|
||||||
}
|
}
|
||||||
|
@ -591,6 +604,7 @@ public class BaseTestCase {
|
||||||
assertLaunchTerminates();
|
assertLaunchTerminates();
|
||||||
fLaunch = null;
|
fLaunch = null;
|
||||||
}
|
}
|
||||||
|
removeAllPlatformBreakpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -226,10 +226,8 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
public void doAfterTest() throws Exception {
|
public void doAfterTest() throws Exception {
|
||||||
super.doAfterTest();
|
super.doAfterTest();
|
||||||
|
|
||||||
|
removeAllPlatformBreakpoints();
|
||||||
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
|
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
|
||||||
IBreakpoint[] breakpoints = manager.getBreakpoints();
|
|
||||||
manager.removeBreakpoints(breakpoints, true);
|
|
||||||
|
|
||||||
manager.removeBreakpointListener(fBreakpointListener);
|
manager.removeBreakpointListener(fBreakpointListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
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.launching.TestsPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.IBreakpointManager;
|
import org.eclipse.debug.core.IBreakpointManager;
|
||||||
|
@ -81,6 +82,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
||||||
private IGDBTraceControl fTraceService;
|
private IGDBTraceControl fTraceService;
|
||||||
private IBreakpointsTargetDMContext fBreakpointsDmc;
|
private IBreakpointsTargetDMContext fBreakpointsDmc;
|
||||||
private ITraceTargetDMContext fTraceTargetDmc;
|
private ITraceTargetDMContext fTraceTargetDmc;
|
||||||
|
private boolean suppressRemoveAllPlatformBreakpoints;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,6 +104,18 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
||||||
System.out.println("ERROR: Failed to delete all breakpoints");
|
System.out.println("ERROR: Failed to delete all breakpoints");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some tests call doBefore/After in the middle of their test and rely on
|
||||||
|
* platform breakpoints to survive that step. So override with the ability
|
||||||
|
* to disable.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeAllPlatformBreakpoints() throws CoreException {
|
||||||
|
if (!suppressRemoveAllPlatformBreakpoints) {
|
||||||
|
super.removeAllPlatformBreakpoints();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@After
|
@After
|
||||||
|
@ -176,10 +190,15 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
createTraceFile();
|
createTraceFile();
|
||||||
// Cleanup the interim launch that we just caused
|
suppressRemoveAllPlatformBreakpoints = true;
|
||||||
doAfterTest();
|
try {
|
||||||
// Setup for the upcoming launch
|
// Cleanup the interim launch that we just caused
|
||||||
doBeforeTest();
|
doAfterTest();
|
||||||
|
// Setup for the upcoming launch
|
||||||
|
doBeforeTest();
|
||||||
|
} finally {
|
||||||
|
suppressRemoveAllPlatformBreakpoints = false;
|
||||||
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// If we cannot create the trace file, ignore the test using the
|
// If we cannot create the trace file, ignore the test using the
|
||||||
// assume check below. The reason for the failure could be a missing
|
// assume check below. The reason for the failure could be a missing
|
||||||
|
@ -214,10 +233,15 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
||||||
// the required test ourselves.
|
// the required test ourselves.
|
||||||
try {
|
try {
|
||||||
testTraceFile();
|
testTraceFile();
|
||||||
// Cleanup the interim launch that we just caused
|
suppressRemoveAllPlatformBreakpoints = true;
|
||||||
doAfterTest();
|
try {
|
||||||
// Setup for the upcoming launch
|
// Cleanup the interim launch that we just caused
|
||||||
doBeforeTest();
|
doAfterTest();
|
||||||
|
// Setup for the upcoming launch
|
||||||
|
doBeforeTest();
|
||||||
|
} finally {
|
||||||
|
suppressRemoveAllPlatformBreakpoints = false;
|
||||||
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// If we cannot setup properly, ignore the test using the
|
// If we cannot setup properly, ignore the test using the
|
||||||
// assume check below. The reason for the failure could be a missing
|
// assume check below. The reason for the failure could be a missing
|
||||||
|
|
Loading…
Add table
Reference in a new issue