mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 336008: [tests] JUnit tests for launch configuration and restart
This commit is contained in:
parent
0c68dd0309
commit
71ac61e6e2
19 changed files with 1266 additions and 21 deletions
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int stopAtOther() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int reverseTest() {
|
||||
int i = 0;
|
||||
i++;
|
||||
i++;
|
||||
i++;
|
||||
i++;
|
||||
i++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int envTest() {
|
||||
char *home, *launchTest;
|
||||
home = getenv("HOME");
|
||||
launchTest = getenv("LAUNCHTEST");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
envTest();
|
||||
reverseTest();
|
||||
stopAtOther();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
echo "Reading launchConfigTestGdbinit and running command:"
|
||||
echo "set args 1 2 3 4 5 6"
|
||||
set args 1 2 3 4 5 6
|
|
@ -39,6 +39,8 @@ import org.junit.AfterClass;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
/**
|
||||
* This is the base class for the GDB/MI Unit tests.
|
||||
|
@ -49,13 +51,16 @@ import org.junit.BeforeClass;
|
|||
* code is to be run.
|
||||
*/
|
||||
public class BaseTestCase {
|
||||
|
||||
|
||||
// Make the current test naem available through testName.getMethodName()
|
||||
@Rule public TestName testName = new TestName();
|
||||
|
||||
public static final String ATTR_DEBUG_SERVER_NAME = TestsPlugin.PLUGIN_ID + ".DEBUG_SERVER_NAME";
|
||||
private static final String DEFAULT_TEST_APP = "data/launch/bin/GDBMIGenericTestApp";
|
||||
|
||||
private static GdbLaunch fLaunch;
|
||||
private static Map<String, Object> attrs = new HashMap<String, Object>();
|
||||
private static Process gdbserverProc = null;
|
||||
private static Map<String, Object> attrs;
|
||||
private static Process gdbserverProc;
|
||||
|
||||
/** The MI event associated with the breakpoint at main() */
|
||||
private MIStoppedEvent fInitialStoppedEvent;
|
||||
|
@ -114,6 +119,9 @@ public class BaseTestCase {
|
|||
|
||||
@BeforeClass
|
||||
public static void baseBeforeClassMethod() {
|
||||
// Must clear all the attributes, because some tests change them.
|
||||
attrs = new HashMap<String, Object>();
|
||||
|
||||
// Setup information for the launcher
|
||||
attrs.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, DEFAULT_TEST_APP);
|
||||
|
||||
|
@ -134,9 +142,9 @@ public class BaseTestCase {
|
|||
|
||||
@Before
|
||||
public void baseBeforeMethod() throws Exception {
|
||||
System.out.println("====================================================================");
|
||||
System.out.println("Launching test application: " + attrs.get(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME));
|
||||
System.out.println("====================================================================");
|
||||
System.out.println("====================================================================================================");
|
||||
System.out.println("Running test: " + testName.getMethodName() + " using GDB: " + attrs.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME));
|
||||
System.out.println("====================================================================================================");
|
||||
|
||||
// First check if we should launch gdbserver in the case of a remote session
|
||||
launchGdbServer();
|
||||
|
|
|
@ -15,11 +15,14 @@ import static org.junit.Assert.assertTrue;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
|
@ -35,8 +38,10 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
|||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
|
||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMData;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||
|
@ -53,6 +58,7 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
|||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil.DefaultTimeouts.ETimeout;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
|
@ -61,7 +67,7 @@ import org.eclipse.core.runtime.Status;
|
|||
*/
|
||||
public class SyncUtil {
|
||||
|
||||
private static ICommandControlService fCommandControl;
|
||||
private static IGDBControl fGdbControl;
|
||||
private static IMIRunControl fRunControl;
|
||||
private static MIStack fStack;
|
||||
private static IExpressions fExpressions;
|
||||
|
@ -82,14 +88,14 @@ public class SyncUtil {
|
|||
new DsfServicesTracker(TestsPlugin.getBundleContext(),
|
||||
fSession.getId());
|
||||
|
||||
fCommandControl = tracker.getService(ICommandControlService.class);
|
||||
fGdbControl = tracker.getService(IGDBControl.class);
|
||||
fRunControl = tracker.getService(IMIRunControl.class);
|
||||
fStack = tracker.getService(MIStack.class);
|
||||
fExpressions = tracker.getService(IExpressions.class);
|
||||
fProcessesService = tracker.getService(IMIProcesses.class);
|
||||
fCommandFactory = tracker.getService(IMICommandControl.class).getCommandFactory();
|
||||
|
||||
fBreakpointsDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
|
||||
fBreakpointsDmc = (IBreakpointsTargetDMContext)fGdbControl.getContext();
|
||||
|
||||
tracker.dispose();
|
||||
}
|
||||
|
@ -139,13 +145,13 @@ public class SyncUtil {
|
|||
// ServiceEvent telling us the program has been suspended again
|
||||
switch(stepType) {
|
||||
case STEP_INTO:
|
||||
fCommandControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
|
||||
break;
|
||||
case STEP_OVER:
|
||||
fCommandControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
|
||||
break;
|
||||
case STEP_RETURN:
|
||||
fCommandControl.queueCommand(fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null);
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null);
|
||||
break;
|
||||
default:
|
||||
Assert.assertTrue("Unsupported step type; " + stepType.toString(), false);
|
||||
|
@ -175,7 +181,7 @@ public class SyncUtil {
|
|||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$
|
||||
null);
|
||||
}
|
||||
|
@ -234,7 +240,7 @@ public class SyncUtil {
|
|||
}
|
||||
};
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIBreakInsert(fBreakpointsDmc, temporary, false, null, 0, location, 0),
|
||||
addBreakDone);
|
||||
|
||||
|
@ -260,7 +266,7 @@ public class SyncUtil {
|
|||
}
|
||||
};
|
||||
|
||||
fCommandControl.queueCommand(fCommandFactory.createMIBreakList(fBreakpointsDmc), listDRM);
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIBreakList(fBreakpointsDmc), listDRM);
|
||||
|
||||
wait.waitUntilDone(timeout);
|
||||
assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
@ -293,7 +299,7 @@ public class SyncUtil {
|
|||
}
|
||||
};
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIBreakDelete(fBreakpointsDmc, breakpointIndices), //$NON-NLS-1$
|
||||
deleteBreakDone);
|
||||
|
||||
|
@ -312,7 +318,7 @@ public class SyncUtil {
|
|||
public void run() {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
fCommandControl.queueCommand(
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIExecContinue(dmc),
|
||||
null);
|
||||
}
|
||||
|
@ -341,7 +347,7 @@ public class SyncUtil {
|
|||
public void run() {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been resumed
|
||||
fCommandControl.queueCommand(
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIExecContinue(dmc),
|
||||
null);
|
||||
}
|
||||
|
@ -408,6 +414,26 @@ public class SyncUtil {
|
|||
fSession.getExecutor().execute(sfQuery);
|
||||
return sfQuery.get();
|
||||
}
|
||||
|
||||
public static IFrameDMData getFrameData(final IExecutionDMContext execCtx, final int level) throws Throwable {
|
||||
Query<IFrameDMData> query = new Query<IFrameDMData>() {
|
||||
@Override
|
||||
protected void execute(final DataRequestMonitor<IFrameDMData> rm) {
|
||||
fStack.getFrames(execCtx, level, level, new DataRequestMonitor<IFrameDMContext[]>(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
IFrameDMContext[] frameDmcs = getData();
|
||||
assert frameDmcs != null;
|
||||
assert frameDmcs.length == 1;
|
||||
fStack.getFrameData(frameDmcs[0], rm);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
fSession.getExecutor().execute(query);
|
||||
return query.get(500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public static IExpressionDMContext createExpression(final IDMContext parentCtx, final String expression)
|
||||
throws Throwable {
|
||||
|
@ -550,7 +576,7 @@ public class SyncUtil {
|
|||
fProcessesService.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fProcessesService.getProcessesBeingDebugged(
|
||||
fCommandControl.getContext(),
|
||||
fGdbControl.getContext(),
|
||||
new DataRequestMonitor<IDMContext[]>(fProcessesService.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
|
@ -576,4 +602,48 @@ public class SyncUtil {
|
|||
return (IContainerDMContext)waitor.getReturnInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart the program.
|
||||
*/
|
||||
public static void restart(final GdbLaunch launch) throws Throwable {
|
||||
// Check if restart is allowed
|
||||
Query<Boolean> query = new Query<Boolean>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<Boolean> rm) {
|
||||
rm.setData(fGdbControl.canRestart());
|
||||
rm.done();
|
||||
}
|
||||
};
|
||||
|
||||
fGdbControl.getExecutor().execute(query);
|
||||
boolean canRestart = query.get(500, TimeUnit.MILLISECONDS);
|
||||
if (!canRestart) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, "Unable to restart"));
|
||||
}
|
||||
|
||||
// Now wait for the stopped event of the restart
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
|
||||
new ServiceEventWaitor<MIStoppedEvent>(
|
||||
fSession,
|
||||
MIStoppedEvent.class);
|
||||
|
||||
// Perform the restart
|
||||
Query<Boolean> query2 = new Query<Boolean>() {
|
||||
@Override
|
||||
protected void execute(final DataRequestMonitor<Boolean> rm) {
|
||||
fGdbControl.initInferiorInputOutput(new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
fGdbControl.createInferiorProcess();
|
||||
fGdbControl.restart(launch, rm);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
fGdbControl.getExecutor().execute(query2);
|
||||
query2.get(500, TimeUnit.MILLISECONDS);
|
||||
|
||||
eventWaitor.waitForEvent(DefaultTimeouts.get(ETimeout.waitForStop));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7.Suite_6_7;
|
|||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8.Suite_6_8;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0.Suite_7_0;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.Suite_7_1;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2.Suite_7_2;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
|
@ -29,6 +30,7 @@ import org.junit.runners.Suite;
|
|||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
Suite_7_2.class,
|
||||
Suite_7_1.class,
|
||||
Suite_7_0.class,
|
||||
Suite_6_8.class,
|
||||
|
|
|
@ -32,7 +32,8 @@ import org.junit.runners.Suite;
|
|||
MIBreakpointsTest.class,
|
||||
MICatchpointsTest.class,
|
||||
MIDisassemblyTest.class,
|
||||
GDBProcessesTest.class
|
||||
GDBProcessesTest.class,
|
||||
LaunchConfigurationAndRestartTest.class,
|
||||
/* Add your suite class here */
|
||||
})
|
||||
|
||||
|
|
|
@ -0,0 +1,629 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
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;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||
import org.eclipse.cdt.dsf.debug.service.IExpressions;
|
||||
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIExpressions;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.debug.core.ILaunchManager;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest extends BaseTestCase {
|
||||
|
||||
protected static final String PROGRAM_DIR = "data/launch/bin/";
|
||||
protected static final String PROGRAM_NAME = "LaunchConfigurationAndRestartTestApp.exe";
|
||||
protected static final String PROGRAM = PROGRAM_DIR + PROGRAM_NAME;
|
||||
|
||||
protected static final int FIRST_LINE_IN_MAIN = 27;
|
||||
protected static final int LAST_LINE_IN_MAIN = 30;
|
||||
|
||||
protected DsfSession fSession;
|
||||
protected DsfServicesTracker fServicesTracker;
|
||||
protected IExpressions fExpService;
|
||||
protected IGDBControl fGdbControl;
|
||||
|
||||
// Indicates if a restart operation should be done
|
||||
// This allows us to re-use tests for restarts tests
|
||||
protected boolean fRestart;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void baseBeforeMethod() throws Exception {
|
||||
// The class BaseTestCase sets up the launch in its @BeforeClass method.
|
||||
// Usually this is ok, because every test uses the same launch configuration.
|
||||
// However, for the tests of this class, we are changing the launch
|
||||
// configuration every time. Therefore, we need to reset it to the default
|
||||
// before every test; that means in the @Before method instead of @BeforeClass
|
||||
|
||||
// Reset the launch configuration
|
||||
super.baseBeforeClassMethod();
|
||||
// Set the binary
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, PROGRAM);
|
||||
|
||||
// Can't run the launch right away because each test needs to first set some
|
||||
// parameters. The individual tests will be responsible for starting the launch.
|
||||
}
|
||||
|
||||
// This method cannot be tagged as @Before, because the launch is not
|
||||
// running yet. We have to call this manually after all the proper
|
||||
// parameters have been set for the launch
|
||||
public void performLaunch() throws Exception {
|
||||
// perform the launch
|
||||
super.baseBeforeMethod();
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
fGdbControl = fServicesTracker.getService(IGDBControl.class);
|
||||
}
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
// Restart the program if we are testing such a case
|
||||
if (fRestart) {
|
||||
synchronized (this) {
|
||||
wait(1000);
|
||||
}
|
||||
fRestart = false;
|
||||
try {
|
||||
SyncUtil.restart(getGDBLaunch());
|
||||
} catch (Throwable e) {
|
||||
fail("Restart failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void shutdown() throws Exception {
|
||||
if (fServicesTracker != null) fServicesTracker.dispose();
|
||||
}
|
||||
|
||||
|
||||
// HACK to get the full path of the program, which we need in other
|
||||
// tests. There must be a proper eclipse way to do this!
|
||||
private static String fFullProgramPath;
|
||||
@Test
|
||||
public void getFullPath() throws Throwable {
|
||||
performLaunch();
|
||||
MIStoppedEvent stopped = getInitialStoppedEvent();
|
||||
fFullProgramPath = stopped.getFrame().getFullname();
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// Below are the tests for the launch configuration.
|
||||
// *********************************************************************
|
||||
|
||||
/**
|
||||
* This test will tell the launch to set the working directory to data/launch/src/
|
||||
* and will verify that we can find the file LaunchConfigurationAndRestartTestApp.cpp.
|
||||
* This will confirm that GDB has been properly configured with the working dir.
|
||||
*/
|
||||
@Test
|
||||
public void testSettingWorkingDirectory() throws Throwable {
|
||||
IPath path = new Path(fFullProgramPath);
|
||||
String dir = path.removeLastSegments(4).toPortableString() + "/" + PROGRAM_DIR;
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, dir);
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, dir + PROGRAM_NAME);
|
||||
|
||||
performLaunch();
|
||||
|
||||
Query<MIInfo> query = new Query<MIInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fGdbControl.getCommandFactory().createMIFileExecFile(
|
||||
fGdbControl.getContext(), PROGRAM_NAME),
|
||||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
query.get(500, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
fail(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
fail(e.getCause().getMessage());
|
||||
} catch (TimeoutException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will verify that a launch will fail if the gdbinit file
|
||||
* does not exist and is not called ".gdbinit".
|
||||
*/
|
||||
@Test
|
||||
public void testSourceInvalidGdbInit() throws Throwable {
|
||||
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
|
||||
"gdbinitThatDoesNotExist");
|
||||
try {
|
||||
performLaunch();
|
||||
} catch (CoreException e) {
|
||||
// Success of the test
|
||||
return;
|
||||
}
|
||||
|
||||
fail("Launch seems to have succeeded even though the gdbinit file did not exist");
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will verify that a launch does not fail if the gdbinit file
|
||||
* is called ".gdbinit" and does not exist
|
||||
*/
|
||||
@Test
|
||||
public void testSourceDefaultGdbInit() throws Throwable {
|
||||
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
|
||||
".gdbinit");
|
||||
try {
|
||||
performLaunch();
|
||||
} catch (CoreException e) {
|
||||
fail("Launch has failed even though the gdbinit file has the default name of .gdbinit");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to use data/launch/src/launchConfigTestGdbinit
|
||||
* as the gdbinit file. We then verify the that the content was properly read.
|
||||
* launchConfigTestGdbinit will simply set some arguments for the program to read;
|
||||
* the arguments are "1 2 3 4 5 6".
|
||||
*/
|
||||
@Test
|
||||
public void testSourceGdbInit() throws Throwable {
|
||||
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
|
||||
"data/launch/src/launchConfigTestGdbinit");
|
||||
performLaunch();
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
|
||||
// Check that argc is correct
|
||||
final IExpressionDMContext argcDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argc");
|
||||
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(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
|
||||
final IExpressionDMContext argvDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argv[argc-1]");
|
||||
Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testSourceGdbInit, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testSourceGdbInitRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testSourceGdbInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to clear the environment variables. We will
|
||||
* then check that the variable $HOME cannot be found by the program.
|
||||
*/
|
||||
@Test
|
||||
public void testClearingEnvironment() throws Throwable {
|
||||
setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
|
||||
performLaunch();
|
||||
|
||||
SyncUtil.runToLocation("envTest");
|
||||
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
|
||||
|
||||
// The program has stored the content of $HOME into a variable called 'home'.
|
||||
// Let's verify this variable is 0x0 which means $HOME does not exist.
|
||||
final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
|
||||
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testClearingEnvironment, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testClearingEnvironmentRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testClearingEnvironment();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to set a new environment variable LAUNCHTEST.
|
||||
* We will then check that this new variable can be read by the program.
|
||||
*/
|
||||
@Test
|
||||
public void testSettingEnvironment() throws Throwable {
|
||||
setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>(1);
|
||||
map.put("LAUNCHTEST", "IS SET");
|
||||
setLaunchAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
|
||||
performLaunch();
|
||||
|
||||
SyncUtil.runToLocation("envTest");
|
||||
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
|
||||
|
||||
// The program has stored the content of $LAUNCHTEST into a variable called 'launchTest'.
|
||||
// Let's verify this variable is set to "IS SET".
|
||||
final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "launchTest");
|
||||
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(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.
|
||||
final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
|
||||
Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testSettingEnvironment, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testSettingEnvironmentRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testSettingEnvironment();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to clear the environment variables and then
|
||||
* set a new environment variable LAUNCHTEST. We will then check that the variable
|
||||
* $HOME cannot be found by the program and that the new variable LAUNCHTEST can be
|
||||
* read by the program.
|
||||
*/
|
||||
@Test
|
||||
public void testClearingAndSettingEnvironment() throws Throwable {
|
||||
setLaunchAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, false);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>(1);
|
||||
map.put("LAUNCHTEST", "IS SET");
|
||||
setLaunchAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
|
||||
performLaunch();
|
||||
|
||||
SyncUtil.runToLocation("envTest");
|
||||
MIStoppedEvent stoppedEvent = SyncUtil.step(2, StepType.STEP_OVER);
|
||||
|
||||
// The program has stored the content of $LAUNCHTEST into a variable called 'launchTest'.
|
||||
// Let's verify this variable is set to "IS SET".
|
||||
final IExpressionDMContext exprDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "launchTest");
|
||||
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(exprDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(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'.
|
||||
// Let's verify this variable is 0x0 which means it does not exist.
|
||||
final IExpressionDMContext exprDmc2 = SyncUtil.createExpression(stoppedEvent.getDMContext(), "home");
|
||||
Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(exprDmc2, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testClearingAndSettingEnvironment, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testClearingAndSettingEnvironmentRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testClearingAndSettingEnvironment();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to set some arguments for the program. We will
|
||||
* then check that the program has the same arguments.
|
||||
*/
|
||||
@Test
|
||||
public void testSettingArguments() throws Throwable {
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "1 2 3\n4 5 6");
|
||||
performLaunch();
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
|
||||
// Check that argc is correct
|
||||
final IExpressionDMContext argcDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argc");
|
||||
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(argcDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
FormattedValueDMData value = query.get(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
|
||||
final IExpressionDMContext argvDmc = SyncUtil.createExpression(stoppedEvent.getDMContext(), "argv[argc-1]");
|
||||
Query<FormattedValueDMData> query2 = new Query<FormattedValueDMData>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
fExpService.getFormattedExpressionValue(
|
||||
fExpService.getFormattedValueContext(argvDmc, MIExpressions.DETAILS_FORMAT), rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query2);
|
||||
FormattedValueDMData value = query2.get(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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testSettingArguments, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testSettingArgumentsRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testSettingArguments();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to "stop on main" at method main(), which we will verify.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtMain() throws Throwable {
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
|
||||
performLaunch();
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
assertTrue("Expected to stop at main:27 but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":" +
|
||||
Integer.toString(stoppedEvent.getFrame().getLine()),
|
||||
stoppedEvent.getFrame().getFunction().equals("main") &&
|
||||
stoppedEvent.getFrame().getLine() == 27);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testStopAtMain, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtMainRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testStopAtMain();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to "stop on main" at method stopAtOther(),
|
||||
* which we will then verify.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtOther() throws Throwable {
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
|
||||
performLaunch();
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
assertTrue("Expected to stop at stopAtOther but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":",
|
||||
stoppedEvent.getFrame().getFunction().equals("stopAtOther"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testStopAtOther, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtOtherRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testStopAtOther();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This test will set a breakpoint at some place in the program and will tell
|
||||
* the launch to NOT "stop on main". We will verify that the first stop is
|
||||
* at the breakpoint that we set.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testNoStopAtMain() throws Throwable {
|
||||
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");
|
||||
|
||||
// We need to set the breakpoint before the launch is started, but the only way to do that is
|
||||
// to set it in the platorm. Ok, but how do I get an IResource that points to my binary?
|
||||
// The current workspace is the JUnit runtime workspace instead of the workspace containing
|
||||
// the JUnit tests.
|
||||
|
||||
IFile fakeFile = null;
|
||||
CDIDebugModel.createLineBreakpoint(PROGRAM, fakeFile, ICBreakpointType.REGULAR, LAST_LINE_IN_MAIN + 1, true, 0, "", true); //$NON-NLS-1$
|
||||
performLaunch();
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
assertTrue("Expected to stop at envTest but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":",
|
||||
stoppedEvent.getFrame().getFunction().equals("envTest"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testNoStopAtMain, but after a restart.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testNoStopAtMainRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testNoStopAtMain();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests.tests_6_6;
|
||||
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.LaunchConfigurationAndRestartTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest_6_6 extends LaunchConfigurationAndRestartTest {
|
||||
|
||||
// For the launch config test, we must set the attributes in the @Before method
|
||||
// instead of the @BeforeClass method. This is because the attributes are overwritten
|
||||
// by the tests themselves
|
||||
@Before
|
||||
public void beforeMethod_6_6() {
|
||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_6);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.junit.runners.Suite;
|
|||
MICatchpointsTest_6_6.class,
|
||||
MIDisassemblyTest_6_6.class,
|
||||
GDBProcessesTest_6_6.class,
|
||||
LaunchConfigurationAndRestartTest_6_6.class,
|
||||
Suite_Sessionless_Tests.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests.tests_6_7;
|
||||
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6.LaunchConfigurationAndRestartTest_6_6;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest_6_7 extends LaunchConfigurationAndRestartTest_6_6 {
|
||||
|
||||
// For the launch config test, we must set the attributes in the @Before method
|
||||
// instead of the @BeforeClass method. This is because the attributes are overwritten
|
||||
// by the tests themselves
|
||||
@Before
|
||||
public void beforeMethod_6_7() {
|
||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_7);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.junit.runners.Suite;
|
|||
MICatchpointsTest_6_7.class,
|
||||
MIDisassemblyTest_6_7.class,
|
||||
GDBProcessesTest_6_7.class,
|
||||
LaunchConfigurationAndRestartTest_6_7.class,
|
||||
Suite_Sessionless_Tests.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests.tests_6_8;
|
||||
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7.LaunchConfigurationAndRestartTest_6_7;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest_6_8 extends LaunchConfigurationAndRestartTest_6_7 {
|
||||
|
||||
// For the launch config test, we must set the attributes in the @Before method
|
||||
// instead of the @BeforeClass method. This is because the attributes are overwritten
|
||||
// by the tests themselves
|
||||
@Before
|
||||
public void beforeMethod_6_8() {
|
||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_8);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.junit.runners.Suite;
|
|||
MICatchpointsTest_6_8.class,
|
||||
MIDisassemblyTest_6_8.class,
|
||||
GDBProcessesTest_6_8.class,
|
||||
LaunchConfigurationAndRestartTest_6_8.class,
|
||||
Suite_Sessionless_Tests.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
|
|
@ -0,0 +1,351 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests.tests_7_0;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
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;
|
||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||
import org.eclipse.cdt.dsf.concurrent.Query;
|
||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
|
||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMData;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.CLITraceInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
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.tests.ITestConstants;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8.LaunchConfigurationAndRestartTest_6_8;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest_7_0 extends LaunchConfigurationAndRestartTest_6_8 {
|
||||
// For the launch config test, we must set the attributes in the @Before method
|
||||
// instead of the @BeforeClass method. This is because the attributes are overwritten
|
||||
// by the tests themselves
|
||||
@Before
|
||||
public void beforeMethod_7_0() {
|
||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will confirm that we have turned on "pending breakpoints"
|
||||
* The pending breakpoint setting only affects CLI commands so we have
|
||||
* to test with one. We don't have classes to set breakpoints using CLI,
|
||||
* but we do for tracepoints, which is the same for this test.
|
||||
*
|
||||
* The pending breakpoint feature only works with tracepoints starting
|
||||
* with GDB 7.0.
|
||||
*
|
||||
* We could run this test before 7.0 but we would have to use a breakpoint
|
||||
* set using CLI commands.
|
||||
*/
|
||||
@Test
|
||||
public void testPendingBreakpointSetting() throws Throwable {
|
||||
performLaunch();
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
|
||||
final IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(),
|
||||
IBreakpointsTargetDMContext.class);
|
||||
Query<MIBreakListInfo> query = new Query<MIBreakListInfo>() {
|
||||
@Override
|
||||
protected void execute(final DataRequestMonitor<MIBreakListInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fGdbControl.getCommandFactory().createCLITrace(bpTargetDmc, "invalid", ""),
|
||||
new DataRequestMonitor<CLITraceInfo>(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
fGdbControl.queueCommand(
|
||||
fGdbControl.getCommandFactory().createMIBreakList(bpTargetDmc),
|
||||
new DataRequestMonitor<MIBreakListInfo>(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
rm.setData(getData());
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
try {
|
||||
fExpService.getExecutor().execute(query);
|
||||
MIBreakListInfo value = query.get(500, TimeUnit.MILLISECONDS);
|
||||
MIBreakpoint[] bps = value.getMIBreakpoints();
|
||||
assertTrue("Expected 1 breakpoint but got " + bps.length,
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to "stop on main" at method main() with reverse
|
||||
* debugging enabled. We will verify that the launch stops at main() and that
|
||||
* reverse debugging is enabled.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtMainWithReverse() throws Throwable {
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "main");
|
||||
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
|
||||
performLaunch();
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
// Make sure we stopped at the first line of main
|
||||
assertTrue("Expected to stop at main:" + FIRST_LINE_IN_MAIN + " but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":" +
|
||||
Integer.toString(stoppedEvent.getFrame().getLine()),
|
||||
stoppedEvent.getFrame().getFunction().equals("main") &&
|
||||
stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
|
||||
|
||||
// Step a couple of times and check where we are
|
||||
final int NUM_STEPS = 3;
|
||||
stoppedEvent = SyncUtil.step(NUM_STEPS, StepType.STEP_OVER);
|
||||
assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN+NUM_STEPS) + " but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":" +
|
||||
Integer.toString(stoppedEvent.getFrame().getLine()),
|
||||
stoppedEvent.getFrame().getFunction().equals("main") &&
|
||||
stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN+NUM_STEPS);
|
||||
|
||||
// Now step backwards to make sure reverse was enabled
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
|
||||
new ServiceEventWaitor<MIStoppedEvent>(
|
||||
fSession,
|
||||
MIStoppedEvent.class);
|
||||
|
||||
final int REVERSE_NUM_STEPS = 2;
|
||||
final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
|
||||
Query<MIInfo> query = new Query<MIInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS),
|
||||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fGdbControl.getExecutor().execute(query);
|
||||
query.get(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(1000);
|
||||
|
||||
assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN+NUM_STEPS-REVERSE_NUM_STEPS) + " but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":" +
|
||||
Integer.toString(stoppedEvent.getFrame().getLine()),
|
||||
stoppedEvent.getFrame().getFunction().equals("main") &&
|
||||
stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN+NUM_STEPS-REVERSE_NUM_STEPS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testStopAtMainWithReverse, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtMainWithReverseRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testStopAtMainWithReverse();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will tell the launch to "stop on main" at method stopAtOther(),
|
||||
* with reverse debugging enabled. We will then verify that the launch is properly
|
||||
* stopped at stopAtOther() and that it can go backwards until main() (this will
|
||||
* confirm that reverse debugging was enabled at the very start).
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtOtherWithReverse() throws Throwable {
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
|
||||
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, "stopAtOther");
|
||||
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
|
||||
performLaunch();
|
||||
|
||||
// Wait for the launch to properly complete. This is because with reverse
|
||||
// the first stopped event does not mean the launch is complete. There will
|
||||
// be another stopped event
|
||||
synchronized (this) {
|
||||
wait(1000);
|
||||
}
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
|
||||
// The initial stopped event is not the last stopped event.
|
||||
// With reverse we have to stop the program, turn on reverse and start it again.
|
||||
// Let's get the frame where we really are stopped right now.
|
||||
final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
|
||||
IFrameDMData frame = SyncUtil.getFrameData(execDmc, 0);
|
||||
|
||||
// Make sure we stopped at the first line of main
|
||||
assertTrue("Expected to stop at stopAtOther but got " +
|
||||
frame.getFunction(),
|
||||
frame.getFunction().equals("stopAtOther"));
|
||||
|
||||
// Now step backwards all the way to the start to make sure reverse was enabled from the very start
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
|
||||
new ServiceEventWaitor<MIStoppedEvent>(
|
||||
fSession,
|
||||
MIStoppedEvent.class);
|
||||
|
||||
final int REVERSE_NUM_STEPS = 3;
|
||||
Query<MIInfo> query2 = new Query<MIInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS),
|
||||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fGdbControl.getExecutor().execute(query2);
|
||||
query2.get(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(1000);
|
||||
|
||||
assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN) + " but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":" +
|
||||
Integer.toString(stoppedEvent.getFrame().getLine()),
|
||||
stoppedEvent.getFrame().getFunction().equals("main") &&
|
||||
stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testStopAtOtherWithReverse, but after a restart.
|
||||
*/
|
||||
@Test
|
||||
public void testStopAtOtherWithReverseRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testStopAtOtherWithReverse();
|
||||
}
|
||||
/**
|
||||
* This test will set a breakpoint at the last line of the program and will tell
|
||||
* the launch to NOT "stop on main", with reverse debugging enabled. We will
|
||||
* verify that the first stop is at the last line of the program but that the program
|
||||
* can run backwards until main() (this will confirm that reverse debugging was
|
||||
* enabled at the very start).
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testNoStopAtMainWithReverse() throws Throwable {
|
||||
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");
|
||||
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, true);
|
||||
|
||||
// MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
|
||||
// MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
|
||||
// MUST SET BREAKPOINT AT LAST LINE BUT BEFORE LAUNCH IS STARTED
|
||||
// see testNoStopAtMain()
|
||||
|
||||
performLaunch();
|
||||
|
||||
// Wait for the launch to properly complete. This is because with reverse
|
||||
// the first stopped event does not mean the launch is complete. There will
|
||||
// be another stopped event
|
||||
synchronized (this) {
|
||||
wait(1000);
|
||||
}
|
||||
|
||||
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
|
||||
|
||||
// The initial stopped event is not the last stopped event.
|
||||
// With reverse we have to stop the program, turn on reverse and start it again.
|
||||
// Let's get the frame where we really are stopped right now.
|
||||
final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
|
||||
IFrameDMData frame = SyncUtil.getFrameData(execDmc, 0);
|
||||
|
||||
// Make sure we stopped at the first line of main
|
||||
assertTrue("Expected to stop at main:" + LAST_LINE_IN_MAIN + " but got " +
|
||||
frame.getFunction() + ":" +
|
||||
Integer.toString(frame.getLine()),
|
||||
frame.getFunction().equals("main") &&
|
||||
frame.getLine() == LAST_LINE_IN_MAIN);
|
||||
|
||||
// Now step backwards all the way to the start to make sure reverse was enabled from the very start
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor =
|
||||
new ServiceEventWaitor<MIStoppedEvent>(
|
||||
fSession,
|
||||
MIStoppedEvent.class);
|
||||
|
||||
final int REVERSE_NUM_STEPS = 3;
|
||||
Query<MIInfo> query2 = new Query<MIInfo>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<MIInfo> rm) {
|
||||
fGdbControl.queueCommand(
|
||||
fGdbControl.getCommandFactory().createMIExecReverseNext(execDmc, REVERSE_NUM_STEPS),
|
||||
rm);
|
||||
}
|
||||
};
|
||||
try {
|
||||
fGdbControl.getExecutor().execute(query2);
|
||||
query2.get(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(1000);
|
||||
|
||||
assertTrue("Expected to stop at main:" + (FIRST_LINE_IN_MAIN) + " but got " +
|
||||
stoppedEvent.getFrame().getFunction() + ":" +
|
||||
Integer.toString(stoppedEvent.getFrame().getLine()),
|
||||
stoppedEvent.getFrame().getFunction().equals("main") &&
|
||||
stoppedEvent.getFrame().getLine() == FIRST_LINE_IN_MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat the test testNoStopAtMainWithReverse, but after a restart.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testNoStopAtMainWithReverseRestart() throws Throwable {
|
||||
fRestart = true;
|
||||
testNoStopAtMainWithReverse();
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.junit.runners.Suite;
|
|||
MICatchpointsTest_7_0.class,
|
||||
MIDisassemblyTest_7_0.class,
|
||||
GDBProcessesTest_7_0.class,
|
||||
LaunchConfigurationAndRestartTest_7_0.class,
|
||||
Suite_Sessionless_Tests.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests.tests_7_1;
|
||||
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0.LaunchConfigurationAndRestartTest_7_0;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest_7_1 extends LaunchConfigurationAndRestartTest_7_0 {
|
||||
// For the launch config test, we must set the attributes in the @Before method
|
||||
// instead of the @BeforeClass method. This is because the attributes are overwritten
|
||||
// by the tests themselves
|
||||
@Before
|
||||
public void beforeMethod_7_1() {
|
||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_1);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.junit.runners.Suite;
|
|||
MICatchpointsTest_7_1.class,
|
||||
MIDisassemblyTest_7_1.class,
|
||||
GDBProcessesTest_7_1.class,
|
||||
LaunchConfigurationAndRestartTest_7_1.class,
|
||||
Suite_Sessionless_Tests.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 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.tests.tests_7_2;
|
||||
|
||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.LaunchConfigurationAndRestartTest_7_1;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BackgroundRunner.class)
|
||||
public class LaunchConfigurationAndRestartTest_7_2 extends LaunchConfigurationAndRestartTest_7_1 {
|
||||
// For the launch config test, we must set the attributes in the @Before method
|
||||
// instead of the @BeforeClass method. This is because the attributes are overwritten
|
||||
// by the tests themselves
|
||||
@Before
|
||||
public void beforeMethod_7_2() {
|
||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,7 @@ import org.junit.runners.Suite;
|
|||
MICatchpointsTest_7_2.class,
|
||||
MIDisassemblyTest_7_2.class,
|
||||
GDBProcessesTest_7_2.class,
|
||||
LaunchConfigurationAndRestartTest_7_2.class,
|
||||
Suite_Sessionless_Tests.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue