mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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>
This commit is contained in:
parent
8765065b70
commit
7e71d2b9b9
2 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue