Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2017-06-23 08:29:40 -0400
committerJonah Graham2017-06-23 09:06:03 -0400
commit41b5a72c73dd35c2997b04cab1d4f4f38f1c147a (patch)
tree94471cbb2748c911279cecbe729447101b26f9ba /dsf-gdb
parent195ae127766bcd5ef01c94be2f906692a2ca97b9 (diff)
downloadorg.eclipse.cdt-41b5a72c73dd35c2997b04cab1d4f4f38f1c147a.tar.gz
org.eclipse.cdt-41b5a72c73dd35c2997b04cab1d4f4f38f1c147a.tar.xz
org.eclipse.cdt-41b5a72c73dd35c2997b04cab1d4f4f38f1c147a.zip
Bug 518699: cleanup platform breakpoints between tests
Ensure no platform breakpoints are left over from previous tests Change-Id: I3266636e9014d4930ec72f7411c9a4dc737d0d9f
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java14
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/TraceFileTest.java40
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 08bb8d5909..4069552144 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 60ed786447..cefabafda4 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 5304ff77cc..6c6cb8c8fd 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

Back to the top