Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2017-04-28 16:11:27 -0400
committerJonah Graham2017-04-28 16:11:27 -0400
commit6edd1c6a53bde9187722e338dab4c043aed801b8 (patch)
tree4fcef6fd9863738098d4d2753e4371a0dd2b1245 /dsf-gdb
parent10b1e6e4c7e7b55cdc46c9378f9b9f0b7d23d06e (diff)
downloadorg.eclipse.cdt-6edd1c6a53bde9187722e338dab4c043aed801b8.tar.gz
org.eclipse.cdt-6edd1c6a53bde9187722e338dab4c043aed801b8.tar.xz
org.eclipse.cdt-6edd1c6a53bde9187722e338dab4c043aed801b8.zip
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
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java2
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchConfigurationAndRestartTest.java116
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTargetAvailableTest.java92
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OperationsWhileTargetIsRunningTest.java23
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java5
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/nonstop/GDBMultiNonStopRunControlTest.java11
7 files changed, 34 insertions, 222 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java
index 7c4da86abd..242be8406e 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java
@@ -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());
}
}
}
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 0bd551e038..08bb8d5909 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
@@ -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
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 fb2ae6348d..57f0e7f415 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
@@ -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));
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 31bd9124d4..c80bc64879 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
@@ -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++) {
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 ea62747e1c..63bfdb6038 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
@@ -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));
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 b0199f0384..caea8e3412 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
@@ -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());
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 8cbfbec591..42e7f40e33 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
@@ -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) {

Back to the top