Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2017-03-04 00:02:27 +0000
committerGerrit Code Review @ Eclipse.org2017-03-04 10:35:33 +0000
commit7e71d2b9b92f296d2a8cfdf4792a7e5fbbda8dcf (patch)
tree1e21b28f9d144fd0e14a0246eded46f8ee36f0ce
parent8765065b705c93ca4e1ce35dd241db87a496125e (diff)
downloadorg.eclipse.cdt-7e71d2b9b92f296d2a8cfdf4792a7e5fbbda8dcf.tar.gz
org.eclipse.cdt-7e71d2b9b92f296d2a8cfdf4792a7e5fbbda8dcf.tar.xz
org.eclipse.cdt-7e71d2b9b92f296d2a8cfdf4792a7e5fbbda8dcf.zip
Bug 512180 and Bug 501906: Minimize unstable tests
As deleting launch configurations has a race condition that can cause them not to become undeletable, only delete them for the tests that they really need to be deleted for. Change-Id: I040cbc83ba29a9f3a791b0bf4348a3179792ec65 Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java16
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SourceLookupTest.java2
2 files changed, 17 insertions, 1 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 850459b6628..7aee5e59339 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
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.framework;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -290,7 +291,7 @@ public class BaseTestCase {
/**
* Make sure we are starting with a clean/known state. That means no
- * existing launches or launch configurations.
+ * existing launches.
*/
public void removeTeminatedLaunchesBeforeTest() throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
@@ -303,11 +304,24 @@ public class BaseTestCase {
if (launches.length > 0) {
launchManager.removeLaunches(launches);
}
+ }
+ /**
+ * Make sure we are starting with a clean/known state. That means no
+ * existing launch configurations.
+ *
+ * XXX: Bugs 512180 and 501906, limit this call to only those test that
+ * really need a clean state. This does not remove the race condition, but
+ * does improve it somewhat.
+ */
+ public void removeLaunchConfigurationsBeforeTest() throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations();
for (ILaunchConfiguration launchConfiguration : launchConfigurations) {
launchConfiguration.delete();
}
+
+ assertEquals("Failed to delete launch configurations", 0, launchManager.getLaunchConfigurations().length);
}
@Before
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 05ec236d6b3..60ed7864470 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
@@ -954,11 +954,13 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
@Test
public void sourceFinderMappingAC_LaunchConfig() throws Throwable {
+ removeLaunchConfigurationsBeforeTest();
sourceFinderMappingAC_LaunchConfigHelper(false);
}
@Test
public void sourceFinderSubstituteAC_LaunchConfig() throws Throwable {
+ removeLaunchConfigurationsBeforeTest();
sourceFinderMappingAC_LaunchConfigHelper(true);
}

Back to the top