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 b0cbd776c6b..85be46a4507 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 @@ -18,7 +18,6 @@ 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; import java.io.BufferedReader; import java.io.FileReader; @@ -321,12 +320,12 @@ public class BaseTestCase { * Make sure we are starting with a clean/known state. That means no * existing launches. */ - public void removeTeminatedLaunchesBeforeTest() throws CoreException { + public void teminateAndRemoveLaunches() throws Exception { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunch[] launches = launchManager.getLaunches(); for (ILaunch launch : launches) { if (!launch.isTerminated()) { - fail("Something has gone wrong, there is an unterminated launch from a previous test!"); + assertLaunchTerminates((GdbLaunch) launch, true); } } if (launches.length > 0) { @@ -354,7 +353,7 @@ public class BaseTestCase { @Before public void doBeforeTest() throws Exception { - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); removeAllPlatformBreakpoints(); setLaunchAttributes(); doLaunch(); @@ -602,11 +601,26 @@ public class BaseTestCase { assertLaunchTerminates(launch); } - protected void assertLaunchTerminates(GdbLaunch launch) throws InterruptedException { + /** + * Assert that the launch terminates, optionally requesting this method to terminate unterminated launch. + */ + protected void assertLaunchTerminates(boolean terminate) throws Exception { + GdbLaunch launch = fLaunch; + assertLaunchTerminates(launch, terminate); + } + + protected void assertLaunchTerminates(GdbLaunch launch) throws Exception { + assertLaunchTerminates(launch, false); + } + + protected void assertLaunchTerminates(GdbLaunch launch, boolean terminate) throws Exception { if (launch != null) { // Give a few seconds to allow the launch to terminate int waitCount = 100; while (!launch.isTerminated() && !launch.getDsfExecutor().isShutdown() && --waitCount > 0) { + if (terminate) { + launch.terminate(); + } Thread.sleep(TestsPlugin.massageTimeout(100)); } assertTrue("Launch failed to terminate before timeout", launch.isTerminated()); @@ -621,6 +635,7 @@ public class BaseTestCase { fLaunch = null; } removeAllPlatformBreakpoints(); + teminateAndRemoveLaunches(); } /** diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java index b847eebb256..f59ac212bd8 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandLineArgsTest.java @@ -57,7 +57,7 @@ public class CommandLineArgsTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { assumeLocalSession(); - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); setLaunchAttributes(); // Can't run the launch right away because each test needs to first set // ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java index d11f147d1fb..f2ef211c420 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/CommandTimeoutTest.java @@ -61,7 +61,7 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); setLaunchAttributes(); // Can't run the launch right away because each test needs to first set some // parameters. The individual tests will be responsible for starting the launch. diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java index 8ecf8525ebf..5f52d56c6b0 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBPatternMatchingExpressionsTest.java @@ -92,12 +92,12 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase @Override public void doAfterTest() throws Exception { - super.doAfterTest(); fExpService = null; if (fServicesTracker != null) { fServicesTracker.dispose(); fServicesTracker = null; } + super.doAfterTest(); } //************************************************************************************** diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java index 775d43a004e..c2ff5583fdd 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java @@ -69,11 +69,10 @@ public class GDBProcessesTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - fProcService = null; if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java index 0947b2839f7..2e94151b37d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBRemoteTracepointsTest.java @@ -205,13 +205,13 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); if (fSession != null) fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(GDBRemoteTracepointsTest.this)) .get(); fBreakpointService = null; if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } // ********************************************************************* diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java index e56f0905008..144b5f1baca 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java @@ -92,7 +92,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase @Override public void doBeforeTest() throws Exception { assumeLocalSession(); - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); setLaunchAttributes(); // Can't run the launch right away because each test needs to first set some // parameters. The individual tests will be responsible for starting the launch. @@ -142,10 +142,9 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } // ********************************************************************* diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java index f6be49b4389..0d56e0a923e 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java @@ -220,7 +220,6 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); // cleanup cannot assume sane state since it runs even test is failed or skipped if (fSession != null) { // Clear the references (not strictly necessary) @@ -233,6 +232,7 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase { fServicesTracker.dispose(); fServicesTracker = null; clearEventCounters(); + super.doAfterTest(); } // ======================================================================== // Event Management Functions diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java index 2c516f1f0de..2a7e3801c81 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java @@ -196,7 +196,6 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); if (fSession != null) { Runnable runnable = () -> fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this); fSession.getExecutor().submit(runnable).get(); @@ -208,6 +207,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase { fServicesTracker.dispose(); fServicesTracker = null; clearEventCounters(); + super.doAfterTest(); } // ======================================================================== diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java index 64723464d9f..55fc17ad58b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIDisassemblyTest.java @@ -120,14 +120,13 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - fExpressionService = null; fDisassembly = null; if (fServicesTracker != null) { fServicesTracker.dispose(); fServicesTracker = null; } + super.doAfterTest(); } // ======================================================================== diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java index 1d70ca228a2..a00eae1e395 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java @@ -112,7 +112,6 @@ public class MIExpressionsTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); if (fSession != null) { fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(MIExpressionsTest.this)).get(); } @@ -120,6 +119,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase { if (fServicesTracker != null) { fServicesTracker.dispose(); } + super.doAfterTest(); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java index dce41175a84..0ba82236d66 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java @@ -138,7 +138,6 @@ public class MIMemoryTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); // Clear the references (not strictly necessary) if (fSession != null) fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(MIMemoryTest.this)).get(); @@ -150,6 +149,7 @@ public class MIMemoryTest extends BaseParametrizedTestCase { fServicesTracker.dispose(); fServicesTracker = null; clearEventCounters(); + super.doAfterTest(); } // ======================================================================== diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java index c7cea09e768..6de4919a388 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIModifiedServicesTest.java @@ -104,7 +104,7 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); setLaunchAttributes(); // Can't run the launch right away because each test needs to first set some diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java index 63572aa128d..8d4abc59083 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java @@ -133,11 +133,10 @@ public class MIRegistersTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); fRegService = null; + super.doAfterTest(); } /* diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java index e77a26f6f5a..fed626e256d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlReverseTest.java @@ -76,11 +76,10 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) { fServicesTracker.dispose(); } + super.doAfterTest(); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java index cc88dc442ac..d2056279995 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java @@ -78,10 +78,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java index 257d4a40e30..4e0b1fc8dff 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java @@ -128,10 +128,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java index eb7d408db1b..a9ddd50915b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java @@ -87,14 +87,13 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); // Restore the different preferences we might have changed IEclipsePreferences node = InstanceScope.INSTANCE.getNode(GdbPlugin.PLUGIN_ID); node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, fgAutoTerminate); + super.doAfterTest(); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java index f1bde7ce184..87aadfa86c3 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java @@ -74,7 +74,7 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { assumeLocalSession(); - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); setLaunchAttributes(); // Can't run the launch right away because each test needs to first set some // parameters. The individual tests will be responsible for starting the launch. @@ -124,8 +124,6 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fSession != null) { fSession.getExecutor().submit(() -> fSession.removeServiceEventListener(PostMortemCoreTest.this)).get(); } @@ -133,6 +131,8 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase { fExpService = null; if (fServicesTracker != null) fServicesTracker.dispose(); + + super.doAfterTest(); } /** 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 bf46da26171..ce39d3c8828 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 @@ -215,7 +215,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); manager.addBreakpointListener(fBreakpointListener); setExeNames(); @@ -229,11 +229,10 @@ public class SourceLookupTest extends BaseParametrizedTestCase { */ @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - removeAllPlatformBreakpoints(); IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager(); manager.removeBreakpointListener(fBreakpointListener); + super.doAfterTest(); } protected void doLaunch(String programName) throws Exception { @@ -912,7 +911,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase { sourceFinderMappingAC_ActiveLaunchHelper(withBackend); // Terminate the launch, but don't remove it - doAfterTest(); + assertLaunchTerminates(true); assertFinderFinds(EXEC_AC_NAME, new File(SOURCE_PATH, SOURCE_NAME).getAbsolutePath()); } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java index 2443d0bd486..48d40e33b36 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/StepIntoSelectionTest.java @@ -125,10 +125,9 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } @Override 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 1ca93eaa7e6..1962e073b61 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 @@ -93,7 +93,7 @@ public class TraceFileTest extends BaseParametrizedTestCase { assumeRemoteSession(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4); - removeTeminatedLaunchesBeforeTest(); + teminateAndRemoveLaunches(); // Suppress settings of the launch attributes and launching. // Each test sets its own launch attributes } @@ -125,7 +125,6 @@ public class TraceFileTest extends BaseParametrizedTestCase { @Override @After public void doAfterTest() throws Exception { - super.doAfterTest(); fBreakpointService = null; fTraceService = null; fBreakpointsDmc = null; @@ -134,6 +133,7 @@ public class TraceFileTest extends BaseParametrizedTestCase { fServicesTracker.dispose(); fServicesTracker = null; } + super.doAfterTest(); } /** diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java index e5190fea1ce..bc527a729ad 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java @@ -90,10 +90,9 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); - if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } private abstract class AsyncRunnable { diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java index 624918e9296..2c56ae5b22b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/ThreadStackFrameSyncTest.java @@ -126,9 +126,9 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase { @Override public void doAfterTest() throws Exception { - super.doAfterTest(); if (fServicesTracker != null) fServicesTracker.dispose(); + super.doAfterTest(); } //////////////////////////////////////////////////////////////////////////////////////