diff options
Diffstat (limited to 'dsf-gdb')
3 files changed, 47 insertions, 11 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java index 08bb8d5909e..40695521447 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java @@ -54,11 +54,13 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; import org.junit.After; import org.junit.AfterClass; @@ -291,6 +293,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 * existing launches. */ public void removeTeminatedLaunchesBeforeTest() throws CoreException { @@ -327,6 +339,7 @@ public class BaseTestCase { @Before public void doBeforeTest() throws Exception { removeTeminatedLaunchesBeforeTest(); + removeAllPlatformBreakpoints(); setLaunchAttributes(); doLaunch(); } @@ -591,6 +604,7 @@ public class BaseTestCase { assertLaunchTerminates(); fLaunch = null; } + removeAllPlatformBreakpoints(); } /** diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java index 60ed7864470..cefabafda4d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java @@ -226,10 +226,8 @@ public class SourceLookupTest extends BaseParametrizedTestCase { public void doAfterTest() throws Exception { super.doAfterTest(); + removeAllPlatformBreakpoints(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); - IBreakpoint[] breakpoints = manager.getBreakpoints(); - manager.removeBreakpoints(breakpoints, true); - manager.removeBreakpointListener(fBreakpointListener); } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java index 5304ff77ccf..6c6cb8c8fdf 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java @@ -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.SyncUtil; import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointManager; @@ -81,6 +82,7 @@ public class TraceFileTest extends BaseParametrizedTestCase { private IGDBTraceControl fTraceService; private IBreakpointsTargetDMContext fBreakpointsDmc; private ITraceTargetDMContext fTraceTargetDmc; + private boolean suppressRemoveAllPlatformBreakpoints; @Override @@ -102,6 +104,18 @@ public class TraceFileTest extends BaseParametrizedTestCase { 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 @After @@ -176,10 +190,15 @@ public class TraceFileTest extends BaseParametrizedTestCase { try { createTraceFile(); - // Cleanup the interim launch that we just caused - doAfterTest(); - // Setup for the upcoming launch - doBeforeTest(); + suppressRemoveAllPlatformBreakpoints = true; + try { + // Cleanup the interim launch that we just caused + doAfterTest(); + // Setup for the upcoming launch + doBeforeTest(); + } finally { + suppressRemoveAllPlatformBreakpoints = false; + } } catch (Throwable t) { // If we cannot create the trace file, ignore the test using the // 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. try { testTraceFile(); - // Cleanup the interim launch that we just caused - doAfterTest(); - // Setup for the upcoming launch - doBeforeTest(); + suppressRemoveAllPlatformBreakpoints = true; + try { + // Cleanup the interim launch that we just caused + doAfterTest(); + // Setup for the upcoming launch + doBeforeTest(); + } finally { + suppressRemoveAllPlatformBreakpoints = false; + } } catch (Throwable t) { // If we cannot setup properly, ignore the test using the // assume check below. The reason for the failure could be a missing |