From 8741098869a2b0372c6d58e558d8dbb496a5df14 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 24 Dec 2014 09:17:41 -0500 Subject: [PATCH] debug tests: Don't catch exception in LaunchConfigurationAndRestartTest.doLaunch When catching the exception and failing the test manually, the root cause exception is hidden. If we let the exception propagate, JUnit will fail the test automatically, and will provide a detailed stack trace. Change-Id: Ife099d4598109dd0901b14d482b89545cfd01d68 Signed-off-by: Simon Marchi Reviewed-on: https://git.eclipse.org/r/38765 Tested-by: Hudson CI Reviewed-by: Marc Khouzam Tested-by: Marc Khouzam --- .../eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java | 6 +++--- .../dsf/gdb/tests/LaunchConfigurationAndRestartTest.java | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java index 8654fdd47a3..4372b3a6cc5 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java @@ -8,6 +8,7 @@ * Contributors: * Ericsson AB - Initial implementation of Test cases * Alvaro Sanchez-Leon (Ericsson) - Bug 437562 - Split the dsf-gdb tests to a plug-in and fragment pair + * Simon Marchi (Ericsson) - Make canRestart and restart throw Exception instead of Throwable. *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.framework; @@ -720,7 +721,7 @@ public class SyncUtil { /** * Check if the restart operation is supported */ - public static boolean canRestart() throws Throwable { + public static boolean canRestart() throws Exception { final IContainerDMContext containerDmc = getContainerContext(); // Check if restart is allowed @@ -748,7 +749,7 @@ public class SyncUtil { /** * Restart the program. */ - public static MIStoppedEvent restart(final GdbLaunch launch) throws Throwable { + public static MIStoppedEvent restart(final GdbLaunch launch) throws Exception { final IContainerDMContext containerDmc = getContainerContext(); // If we are calling this method, the restart operation should be allowed @@ -764,7 +765,6 @@ public class SyncUtil { // Perform the restart Query query2 = new Query() { - @SuppressWarnings("unchecked") @Override protected void execute(final DataRequestMonitor rm) { Map attributes = null; 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 485396437a4..d618328c95e 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Ericsson and others. + * Copyright (c) 2011, 2014 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Ericsson - Initial Implementation + * Simon Marchi (Ericsson) - Remove a catch that just fails a test. *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.tests; @@ -109,11 +110,7 @@ public class LaunchConfigurationAndRestartTest extends BaseTestCase { wait(1000); } fRestart = false; - try { - SyncUtil.restart(getGDBLaunch()); - } catch (Throwable e) { - fail("Restart failed: " + e.getMessage()); - } + SyncUtil.restart(getGDBLaunch()); } }