1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Replace hard-coded versions with constants

Change-Id: I8653157bd1d351eb07f58b4b404edfdaaa0e756e
This commit is contained in:
Marc Khouzam 2016-03-20 20:20:34 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent ddf2dea0aa
commit f9d3a184aa
13 changed files with 57 additions and 47 deletions

View file

@ -82,7 +82,7 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
super.doBeforeTest();
fSession = getGDBLaunch().getSession();

View file

@ -11,7 +11,8 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@ -121,7 +122,7 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
*/
@Test
public void getThreadData() throws Throwable {
assumeGdbVersionAtLeast("7.3");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_3);
// Start the threads one by one to make sure they are discovered by gdb in the right
// order.
for (int i = 0; i < 5; i++) {

View file

@ -1134,7 +1134,7 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
protected boolean acceptsFastTpOnFourBytes() {
String gdbVersion = getGdbVersion();
boolean isLower = LaunchUtils.compareVersions("7.4", gdbVersion) > 0;
boolean isLower = LaunchUtils.compareVersions(ITestConstants.SUFFIX_GDB_7_4, gdbVersion) > 0;
if (isLower) return false;
// With GDB 7.4, fast tracepoints only need an
// instruction of 4 bytes or more when on a 32bit architecture, instead of 5.
@ -1149,7 +1149,7 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
*/
@Test
public void tracepointActionsWithCollectStrings() throws Throwable {
assumeGdbVersionAtLeast("7.4");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance();
CollectAction action1 = new CollectAction();

View file

@ -12,10 +12,12 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.util.HashMap;
@ -228,7 +230,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
@Test
public void testSourceGdbInit() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
"data/launch/src/launchConfigTestGdbinit");
doLaunch();
@ -287,7 +289,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
*/
@Test
public void testSourceGdbInitRestart() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
fRestart = true;
testSourceGdbInit();
}
@ -755,7 +757,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
*/
@Test
public void testExitCodeSet() throws Throwable {
assumeGdbVersionAtLeast("7.3");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_3);
doLaunch();
ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<ICommandControlShutdownDMEvent>(
@ -808,7 +810,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
*/
@Test
public void testPendingBreakpointSetting() throws Throwable {
assumeGdbVersionAtLeast("7.0");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
doLaunch();
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
@ -863,7 +865,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
*/
@Test
public void testStopAtMainWithReverse() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
@ -928,7 +930,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
*/
@Test
public void testStopAtMainWithReverseRestart() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
fRestart = true;
testStopAtMainWithReverse();
}
@ -945,7 +947,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
*/
@Test
public void testStopAtOtherWithReverse() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
@ -1005,7 +1007,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
@Test
@Ignore("Fails. Investigate what it needs to wait for.")
public void testStopAtOtherWithReverseRestart() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
fRestart = true;
testStopAtOtherWithReverse();
}
@ -1019,7 +1021,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
@Test
@Ignore("TODO: this is not working because it does not insert the breakpoint propertly")
public void testNoStopAtMainWithReverse() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
// Set this one as well to make sure it gets ignored
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
@ -1089,7 +1091,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
@Test
@Ignore
public void testNoStopAtMainWithReverseRestart() throws Throwable {
assumeGdbVersionAtLeast("7.2");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_2);
fRestart = true;
testNoStopAtMainWithReverse();
}

View file

@ -311,7 +311,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
@Test
public void testChildren() throws Throwable {
assumeGdbVersionAtLeast("6.7");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_7);
// Get the children of some variables
MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testChildren");
@ -1829,8 +1829,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
@Test
public void testDeleteChildren() throws Throwable {
assumeGdbVersionAtLeast("6.7");
assumeGdbVersionLowerThen("7.3");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_7);
assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_3);
SyncUtil.runToLocation("testDeleteChildren");
MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
@ -2886,7 +2886,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
@Test
public void testCanWriteLValue() throws Throwable {
assumeGdbVersionAtLeast("6.8");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("testCanWrite"); // Re-use test
final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
@ -3463,8 +3463,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
@Test
public void testRTTI() throws Throwable {
assumeGdbVersionNot("6.7"); // crashing
assumeGdbVersionLowerThen("7.5");
assumeGdbVersionNot(ITestConstants.SUFFIX_GDB_6_7); // crashing
assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_5);
SyncUtil.runToLocation("testRTTI");
MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
@ -4267,7 +4267,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
// Bug 320277
@Test
public void testDeleteChildren_7_3() throws Throwable {
assumeGdbVersionAtLeast("7.3");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_3);
SyncUtil.runToLocation("testDeleteChildren");
MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_OVER);
final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
@ -4410,7 +4410,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
@Test
public void testRTTI_7_5() throws Throwable {
assumeGdbVersionAtLeast("7.5");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_5);
SyncUtil.runToLocation("testRTTI");
MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);

View file

@ -145,7 +145,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
protected void setExeNames() {
String gdbVersion = getGdbVersion();
// has to be strictly lower
boolean isLower = LaunchUtils.compareVersions("7.5", gdbVersion) > 0;
boolean isLower = LaunchUtils.compareVersions(ITestConstants.SUFFIX_GDB_7_5, gdbVersion) > 0;
if (isLower) {
EXEC_AC_NAME = "SourceLookupDwarf2AC.exe"; //$NON-NLS-1$
EXEC_AN_NAME = "SourceLookupDwarf2AN.exe"; //$NON-NLS-1$
@ -465,7 +465,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void sourceMappingAC() throws Throwable {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMapping(EXEC_AC_NAME, false);
}
@ -484,7 +484,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void sourceMappingAN() throws Throwable {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMapping(EXEC_AN_NAME, false);
}
@ -499,7 +499,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* build path when the build path is an absolute path. GDB 6.8 and above
* works fine in this case.
*/
assumeGdbVersionAtLeast("6.8");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
sourceMapping(EXEC_AN_NAME, true);
}
@ -509,7 +509,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void sourceMappingRC() throws Throwable {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMapping(EXEC_RC_NAME, false);
}
@ -528,7 +528,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void sourceMappingRN() throws Throwable {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMapping(EXEC_RN_NAME, false);
}
@ -543,7 +543,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* build path when the build path is a relative path. GDB 7.6 and above
* works fine in this case.
*/
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMapping(EXEC_RN_NAME, true);
}
@ -553,7 +553,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void sourceMappingBreakpointsAC() throws Throwable {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMappingBreakpoints(EXEC_AC_NAME, false);
}
@ -587,7 +587,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* build path when the build path is an absolute path. GDB 6.8 and above
* works fine in this case.
*/
assumeGdbVersionAtLeast("6.8");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
sourceMappingBreakpoints(EXEC_AN_NAME, true);
}
@ -597,7 +597,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void sourceMappingBreakpointsRC() throws Throwable {
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMappingBreakpoints(EXEC_RC_NAME, false);
}
@ -631,7 +631,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
* build path when the build path is a relative path. GDB 7.6 and above
* works fine in this case.
*/
assumeGdbVersionAtLeast("7.6");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
sourceMappingBreakpoints(EXEC_RN_NAME, true);
}
@ -765,7 +765,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
*/
@Test
public void directorySource() throws Throwable {
assumeGdbVersionLowerThen("7.6");
assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_6);
DirectorySourceContainer container = new DirectorySourceContainer(new Path(SOURCE_ABSPATH), false);
setSourceContainer(container);
doLaunch(EXEC_PATH + EXEC_RC_NAME);

View file

@ -457,7 +457,7 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void atDoubleMethodStopAtBreakpointFunctionEntry() throws Throwable {
assumeGdbVersionAtLeast("7.4");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
atDoubleMethodStopAtBreakpointCommon(FOO_LINE);
}
@ -497,7 +497,7 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
*/
@Test
public void atDoubleMethodSkipBreakpointFunctionEntry() throws Throwable {
assumeGdbVersionAtLeast("7.4");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
atDoubleMethodSkipBreakpointCommon(FOO_LINE);
}

View file

@ -85,7 +85,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.4");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4);
removeTeminatedLaunchesBeforeTest();
// Suppress settings of the launch attributes and launching.
// Each test sets its own launch attributes

View file

@ -11,7 +11,9 @@
package org.eclipse.cdt.tests.dsf.gdb.tests.nonstop;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@ -36,6 +38,7 @@ import org.eclipse.cdt.tests.dsf.gdb.framework.IntermittentRule;
import org.eclipse.cdt.tests.dsf.gdb.framework.ServiceEventWaitor;
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
@ -68,7 +71,7 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.0");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
super.doBeforeTest();
final DsfSession session = getGDBLaunch().getSession();

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.tests.dsf.gdb.tests.nonstop;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.MIExpressionsTest;
import org.junit.Assume;
import org.junit.BeforeClass;
@ -27,7 +28,7 @@ public class MIExpressionsNonStopTest extends MIExpressionsTest {
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.0");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
super.doBeforeTest();
}

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.tests.dsf.gdb.tests.nonstop;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.MIRunControlTargetAvailableTest;
import org.junit.Assume;
import org.junit.BeforeClass;
@ -27,7 +28,7 @@ public class MIRunControlNonStopTargetAvailableTest extends MIRunControlTargetAv
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.0");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
super.doBeforeTest();
}

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.tests.dsf.gdb.tests.nonstop;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.OperationsWhileTargetIsRunningTest;
import org.junit.Assume;
import org.junit.BeforeClass;
@ -33,7 +34,7 @@ public class OperationsWhileTargetIsRunningNonStopTest extends OperationsWhileTa
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.0");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
super.doBeforeTest();
}

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.tests.dsf.gdb.tests.nonstop;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.StepIntoSelectionTest;
import org.junit.Assume;
import org.junit.BeforeClass;
@ -33,7 +34,7 @@ public class StepIntoSelectionNonStopTest extends StepIntoSelectionTest {
@Override
public void doBeforeTest() throws Exception {
assumeGdbVersionAtLeast("7.0");
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_0);
super.doBeforeTest();
}