From 6a0de9f520244445d13423f244089b9865953526 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Tue, 20 Mar 2018 09:15:40 +0000 Subject: [PATCH] Bug 532592: [tests] cleanup use of DEBUGGER_MODE_REMOTE in tests Be consistent in using DEBUGGER_MODE_REMOTE to set remote session in parameterized tests. Change-Id: Ie8db7df02ec575f3e89d22e00b06e4e197833a37 --- .../framework/BaseParametrizedTestCase.java | 3 +- .../dsf/gdb/framework/BaseRemoteSuite.java | 32 ------------------- .../dsf/gdb/tests/CommandTimeoutTest.java | 4 +-- .../tests/dsf/gdb/tests/GDBProcessesTest.java | 2 -- .../gdb/tests/GDBRemoteTracepointsTest.java | 6 ++-- .../tests/dsf/gdb/tests/TraceFileTest.java | 5 ++- 6 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseRemoteSuite.java 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 7568bb99e6d..79e444706c8 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 @@ -195,9 +195,10 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase { assumeGdbVersionAtLeast(gdbVersionPostfix); setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbPath); setLaunchAttribute(ATTR_DEBUG_SERVER_NAME, gdbServerPath); - if (remote) + if (remote) { setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); + } } @Override diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseRemoteSuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseRemoteSuite.java deleted file mode 100644 index f1f4091426b..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseRemoteSuite.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.framework; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -/** - * This base class sets the attributes necessary to do a - * remote debugging session. - */ -public class BaseRemoteSuite { - @BeforeClass - public static void baseRemoteSuiteBeforeClassMethod() { - BaseTestCase.setGlobalLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, - IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); - } - @AfterClass - public static void baseRemoteSuiteAfterClassMethod() { - BaseTestCase.removeGlobalLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE); - } -} 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 9d5698cda2c..45a70791650 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 @@ -149,10 +149,10 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase { node.putInt( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, 1000 ); // Setup a remote launch so that it sends a "-target-remote" as part of the - // launch steps. + // launch steps... setLaunchAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE ); - // We won't start gdbserver, so the command will timeout + // ... but we won't start gdbserver, so the command will timeout setLaunchAttribute( ITestConstants.LAUNCH_GDB_SERVER, false); try { 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 657b5a32b57..d572de33116 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 @@ -110,8 +110,6 @@ public class GDBProcessesTest extends BaseParametrizedTestCase { /* * Return whether thread names are reported by the debugger. - * - * This defaults to false, and is overridden for specific versions of gdb. */ protected boolean threadNamesSupported() { return !runningOnWindows() && !isRemoteSession(); 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 f7828e09fea..1bea23bc650 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 @@ -164,6 +164,8 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { + // GDB tracepoints are only supported on a remote target (e.g., using gdbserver) + assumeRemoteSession(); super.doBeforeTest(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); @@ -203,10 +205,6 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase { setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME); - // GDB tracepoints are only supported on a remote target (e.g., using gdbserver) - setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, - IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); - // To test both fast and normal tracepoints, we use the FAST_THEN_NORMAL setting setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL); 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 bfda80c1fcd..4a234a65d7d 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 @@ -90,6 +90,8 @@ public class TraceFileTest extends BaseParametrizedTestCase { @Override public void doBeforeTest() throws Exception { + // GDB tracepoints are only supported on a remote target (e.g., using gdbserver) + assumeRemoteSession(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4); removeTeminatedLaunchesBeforeTest(); @@ -341,9 +343,6 @@ public class TraceFileTest extends BaseParametrizedTestCase { // Set launch attributes super.setLaunchAttributes(); setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME); - // GDB tracepoints are only supported on a remote target (e.g., using gdbserver) - setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, - IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);