mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Bug 499778: Stop losing stacktraces in tests
Rather than try/catch/fail just let exception cascade so that the full stacktrace is available in the test results. The braces have been left in place for scoping and to minimize changes. Change-Id: I5407829ea964f828e3f996794489a7b884de25fb
This commit is contained in:
parent
10b1e6e4c7
commit
6edd1c6a53
7 changed files with 34 additions and 222 deletions
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.tests.dsf.gdb.framework;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -178,8 +177,8 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void validateGdbVersion(GdbLaunch launch) {
|
||||
try {
|
||||
protected void validateGdbVersion(GdbLaunch launch) throws CoreException {
|
||||
{
|
||||
String expected = getGdbVersionParameter();
|
||||
if (expected.equals(DEFAULT_VERSION_STRING)) {
|
||||
// If the user has requested the default GDB, we accept whatever version runs.
|
||||
|
@ -204,8 +203,6 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase {
|
|||
|
||||
assertTrue("Unexpected GDB version. Expected " + expected + " actual " + actual,
|
||||
LaunchUtils.compareVersions(expected, comparableActualString) == 0);
|
||||
} catch (CoreException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ public class BaseTestCase {
|
|||
*
|
||||
* @param launch The launch in which we can find the gdb version
|
||||
*/
|
||||
protected void validateGdbVersion(GdbLaunch launch) {};
|
||||
protected void validateGdbVersion(GdbLaunch launch) throws Exception {};
|
||||
|
||||
/**
|
||||
* We listen for the target to stop at the main breakpoint. This listener is
|
||||
|
|
|
@ -22,9 +22,7 @@ import static org.junit.Assert.fail;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
|
@ -182,15 +180,9 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +215,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
try {
|
||||
doLaunch();
|
||||
} catch (CoreException e) {
|
||||
fail("Launch has failed even though the gdbinit file has the default name of .gdbinit");
|
||||
throw new AssertionError("Launch has failed even though the gdbinit file has the default name of .gdbinit", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,19 +252,13 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
|
||||
// Argc should be 7: the program name and the six arguments
|
||||
assertTrue("Expected 7 but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().trim().equals("7"));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
// Check that argv is also correct. For simplicity we only check the last argument
|
||||
|
@ -284,17 +270,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertTrue("Expected \"6\" but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().trim().endsWith("\"6\""));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,17 +310,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertTrue("Expected 0x0 but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().equals("0x0"));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,17 +353,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertTrue("Expected a string ending with \"IS SET\" but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().trim().endsWith("\"IS SET\""));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
// Check that the normal environment is there by checking that $HOME (which is stored in 'home" exists.
|
||||
|
@ -401,17 +369,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertFalse("Expected something else than 0x0",
|
||||
value.getFormattedValue().equals("0x0"));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -453,17 +415,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertTrue("Expected a string ending with \"IS SET\" but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().trim().endsWith("\"IS SET\""));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
// The program has stored the content of $HOME into a variable called 'home'.
|
||||
|
@ -476,17 +432,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertTrue("Expected 0x0 but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().equals("0x0"));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,19 +473,13 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
|
||||
// Argc should be 7: the program name and the six arguments
|
||||
assertTrue("Expected 7 but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().trim().equals("7"));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
// Check that argv is also correct. For simplicity we only check the last argument
|
||||
|
@ -547,17 +491,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
assertTrue("Expected \"6\" but got " + value.getFormattedValue(),
|
||||
value.getFormattedValue().trim().endsWith("\"6\""));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,7 +683,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
});
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fExpService.getExecutor().execute(query);
|
||||
MIBreakListInfo value = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
MIBreakpoint[] bps = value.getMIBreakpoints();
|
||||
|
@ -753,12 +691,6 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
bps.length == 1);
|
||||
assertTrue("Expending a <PENDING> breakpoint but got one at " + bps[0].getAddress(),
|
||||
bps[0].getAddress().equals("<PENDING>"));
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,15 +745,9 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fGdbControl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
|
||||
|
@ -889,15 +815,9 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fGdbControl.getExecutor().execute(query2);
|
||||
query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
|
||||
|
@ -972,15 +892,9 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fGdbControl.getExecutor().execute(query2);
|
||||
query2.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
stoppedEvent = eventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));
|
||||
|
|
|
@ -15,7 +15,6 @@ import static org.junit.Assert.fail;
|
|||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
||||
|
@ -47,9 +46,6 @@ import org.junit.runners.Parameterized;
|
|||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
||||
|
||||
private static final String TIMEOUT_MESSAGE = "Timeout";
|
||||
|
||||
private DsfServicesTracker fServicesTracker;
|
||||
|
||||
private IGDBControl fGDBCtrl;
|
||||
|
@ -127,15 +123,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
// Now resume the target and check that we stop at the breakpoint.
|
||||
|
@ -182,15 +172,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
// Now check that the target is stopped at the breakpoint.
|
||||
|
@ -244,15 +228,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
// Now resume the target three times and check that we stop three times.
|
||||
|
@ -318,13 +296,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
try {
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
// We want to detect the error, so this is success
|
||||
return;
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
fail("Did not detect the error of the step");
|
||||
|
@ -381,15 +355,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
// Now resume the target three times and check that we stop three times.
|
||||
|
@ -463,12 +431,8 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
try {
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
caughtError = true;
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
Assert.assertTrue("Did not catch the error of the step", caughtError);
|
||||
|
@ -524,15 +488,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
crm.setDoneCount(index);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
for (int i=0; i<steps.length; i++) {
|
||||
|
@ -599,15 +557,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
crm.setDoneCount(index);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
for (int i=0; i<steps.length; i++) {
|
||||
|
@ -668,15 +620,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
|
@ -742,15 +688,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
|
@ -809,15 +749,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
|
@ -881,15 +815,9 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
fRunCtrl.executeWithTargetAvailable(fContainerDmc, steps, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fRunCtrl.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
|
|
|
@ -10,11 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.tests.dsf.gdb.tests;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
|
@ -53,9 +49,6 @@ import org.osgi.service.prefs.Preferences;
|
|||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase {
|
||||
|
||||
private static final String TIMEOUT_MESSAGE = "Timeout";
|
||||
|
||||
private DsfServicesTracker fServicesTracker;
|
||||
private IGDBProcesses fProcesses;
|
||||
private IMIContainerDMContext fContainerDmc;
|
||||
|
@ -241,15 +234,9 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
fProcesses.terminate(processDmc, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fProcesses.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(1000), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
IExitedDMEvent event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
|
||||
|
@ -329,15 +316,9 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
fProcesses.detachDebuggerFromProcess(fContainerDmc, rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
{
|
||||
fProcesses.getExecutor().execute(query);
|
||||
query.get(TestsPlugin.massageTimeout(1000), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(TIMEOUT_MESSAGE);
|
||||
}
|
||||
|
||||
IExitedDMEvent event = exitedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(500));
|
||||
|
|
|
@ -465,11 +465,8 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
|
|||
|
||||
fSession.getExecutor().execute(query);
|
||||
FormattedValueDMData value = null;
|
||||
try {
|
||||
{
|
||||
value = query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
fail(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Addr64(value.getFormattedValue());
|
||||
|
|
|
@ -17,7 +17,6 @@ import static org.junit.Assert.fail;
|
|||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
|
@ -110,11 +109,11 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
public abstract void run(DataRequestMonitor<V> drm);
|
||||
};
|
||||
|
||||
private <V> V runAsyncCall(final AsyncRunnable<V> runnable) {
|
||||
private <V> V runAsyncCall(final AsyncRunnable<V> runnable) throws Exception {
|
||||
return runAsyncCall(runnable, false);
|
||||
}
|
||||
|
||||
private <V> V runAsyncCall(final AsyncRunnable<V> runnable, boolean expectExecutionException) {
|
||||
private <V> V runAsyncCall(final AsyncRunnable<V> runnable, boolean expectExecutionException) throws Exception {
|
||||
Query<V> query = new Query<V>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<V> rm) {
|
||||
|
@ -126,15 +125,11 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
try {
|
||||
fMultiRun.getExecutor().execute(query);
|
||||
result = query.get(TestsPlugin.massageTimeout(500), TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
if (expectExecutionException) {
|
||||
return null;
|
||||
}
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
if (expectExecutionException) {
|
||||
|
|
Loading…
Add table
Reference in a new issue