diff options
Diffstat (limited to 'dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service')
11 files changed, 0 insertions, 1136 deletions
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/BasicTests.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/BasicTests.java deleted file mode 100644 index 51557bbe9e5..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/BasicTests.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.ExecutionException; - -import junit.framework.Assert; - -import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; -import org.eclipse.cdt.dsf.concurrent.DsfRunnable; -import org.eclipse.cdt.dsf.concurrent.Query; -import org.eclipse.cdt.dsf.debug.service.command.ICommand; -import org.eclipse.cdt.dsf.debug.service.command.ICommandListener; -import org.eclipse.cdt.dsf.debug.service.command.ICommandResult; -import org.eclipse.cdt.dsf.debug.service.command.ICommandToken; -import org.eclipse.cdt.examples.dsf.pda.service.commands.PDACommandResult; -import org.eclipse.core.runtime.CoreException; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class BasicTests extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - fProgram = "samples/example.pda"; - } - - @Test - public void testCommandListener() throws CoreException, InterruptedException, ExecutionException { - - class CommandInfo { - CommandInfo(ICommand<?> command, ICommandResult result) { fCommand = command; fResult = result; } - ICommand<?> fCommand; - ICommandResult fResult; - } - - class CommandListener implements ICommandListener { - - List<CommandInfo> fDoneCommands = new LinkedList<CommandInfo>(); - List<CommandInfo> fQueuedCommands = new LinkedList<CommandInfo>(); - List<CommandInfo> fRemovedCommands = new LinkedList<CommandInfo>(); - List<CommandInfo> fSentCommands = new LinkedList<CommandInfo>(); - - public void commandDone(ICommandToken token, ICommandResult result) { - fDoneCommands.add(new CommandInfo(token.getCommand(), result)); - } - public void commandQueued(ICommandToken token) { - fQueuedCommands.add(new CommandInfo(token.getCommand(), null)); - } - public void commandRemoved(ICommandToken token) { - fRemovedCommands.add(new CommandInfo(token.getCommand(), null)); - } - public void commandSent(ICommandToken token) { - fSentCommands.add(new CommandInfo(token.getCommand(), null)); - } - - void reset() { - fDoneCommands.clear(); - fQueuedCommands.clear(); - fRemovedCommands.clear(); - fSentCommands.clear(); - } - } - - final CommandListener listener = new CommandListener(); - fExecutor.execute(new DsfRunnable() { - public void run() { - fCommandControl.addCommandListener(listener); - } - }); - - final PDATestCommand testCommand = new PDATestCommand(fCommandControl.getContext(), "data 1"); - - // Test sending the command and checking all listeners were called. - Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() { - @Override - protected void execute(DataRequestMonitor<PDACommandResult> rm) { - fCommandControl.queueCommand(testCommand, rm); - } - }; - fExecutor.execute(sendCommandQuery); - PDACommandResult result = sendCommandQuery.get(); - Assert.assertEquals(1, listener.fQueuedCommands.size()); - Assert.assertEquals(testCommand, listener.fQueuedCommands.get(0).fCommand); - Assert.assertEquals(0, listener.fRemovedCommands.size()); - Assert.assertEquals(1, listener.fSentCommands.size()); - Assert.assertEquals(testCommand, listener.fSentCommands.get(0).fCommand); - Assert.assertEquals(1, listener.fDoneCommands.size()); - Assert.assertEquals(testCommand, listener.fDoneCommands.get(0).fCommand); - Assert.assertEquals(result, listener.fDoneCommands.get(0).fResult); - - // Test queuing then removing command - listener.reset(); - Query<Object> queueRemoveCommandQuery = new Query<Object>() { - @Override - protected void execute(DataRequestMonitor<Object> rm) { - ICommandToken token = fCommandControl.queueCommand( - testCommand, - new DataRequestMonitor<PDACommandResult>(fExecutor, null) { - @Override - protected void handleCompleted() { - Assert.fail("This command should never have been executed."); - } - }); - fCommandControl.removeCommand(token); - - rm.setData(new Object()); - rm.done(); - } - }; - fExecutor.execute(queueRemoveCommandQuery); - queueRemoveCommandQuery.get(); - Assert.assertEquals(1, listener.fQueuedCommands.size()); - Assert.assertEquals(testCommand, listener.fQueuedCommands.get(0).fCommand); - Assert.assertEquals(1, listener.fRemovedCommands.size()); - Assert.assertEquals(testCommand, listener.fRemovedCommands.get(0).fCommand); - Assert.assertEquals(0, listener.fSentCommands.size()); - Assert.assertEquals(0, listener.fDoneCommands.size()); - - } -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/CommandControlTestsBase.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/CommandControlTestsBase.java deleted file mode 100644 index c4d2e7b4690..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/CommandControlTestsBase.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.LinkedBlockingQueue; - -import junit.framework.Assert; - -import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; -import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; -import org.eclipse.cdt.dsf.concurrent.DsfExecutor; -import org.eclipse.cdt.dsf.concurrent.Query; -import org.eclipse.cdt.dsf.debug.service.command.IEventListener; -import org.eclipse.cdt.dsf.service.DsfSession; -import org.eclipse.cdt.examples.dsf.pda.service.PDABackend; -import org.eclipse.cdt.examples.dsf.pda.service.PDACommandControl; -import org.eclipse.cdt.examples.dsf.pda.service.commands.PDACommandResult; -import org.eclipse.cdt.tests.dsf.pda.util.Launching; -import org.eclipse.core.runtime.CoreException; -import org.junit.After; -import org.junit.Before; - -/** - * - */ -public class CommandControlTestsBase { - - protected static String fProgram; - - protected DsfExecutor fExecutor; - protected DsfSession fSession; - protected PDABackend fPDABackend; - protected PDACommandControl fCommandControl; - private BlockingQueue<Object> fEventsQueue = new LinkedBlockingQueue<Object>(); - - private BufferedReader fOutputReader; - - @Before - public void startup() throws CoreException, InterruptedException, ExecutionException, IOException { - - class InitializeCommandServiceQuery extends Query<Object> { - @Override - protected void execute(DataRequestMonitor<Object> rm) { - fCommandControl.initialize(rm); - } - }; - - fExecutor = new DefaultDsfExecutor(); - fSession = DsfSession.startSession(fExecutor, "PDA Test"); - - Process proc = Launching.launchPDA(fSession, null, fProgram); - Assert.assertNotNull(proc); - - // Remember the backend service of this session. - // Note this must be called after the above LaunchPDA(). - fPDABackend = Launching.getBackendService(); - - fOutputReader = new BufferedReader(new InputStreamReader(proc.getInputStream())); - Assert.assertTrue(fOutputReader.readLine().contains("-debug")); - - fCommandControl = new PDACommandControl(fSession); - - fCommandControl.addEventListener(new IEventListener() { - public void eventReceived(Object output) { - fEventsQueue.add(output); - } - }); - - InitializeCommandServiceQuery initQuery = new InitializeCommandServiceQuery(); - fExecutor.execute(initQuery); - initQuery.get(); - Assert.assertEquals("debug connection accepted", fOutputReader.readLine()); - } - - @After - public void shutdown() throws CoreException, InterruptedException, ExecutionException, IOException { - if (fOutputReader != null) { - fOutputReader.close(); - } - - class ShutdownCommandServiceQuery extends Query<Object> { - @Override - protected void execute(DataRequestMonitor<Object> rm) { - fCommandControl.shutdown(rm); - } - }; - - if (fExecutor != null) { - ShutdownCommandServiceQuery shutdownQuery = new ShutdownCommandServiceQuery(); - fExecutor.execute(shutdownQuery); - shutdownQuery.get(); - } - - class ShutdownBackendServiceQuery extends Query<Object> { - @Override - protected void execute(DataRequestMonitor<Object> rm) { - fPDABackend.shutdown(rm); - } - }; - - if (fExecutor != null) { - ShutdownBackendServiceQuery shutdownQuery = new ShutdownBackendServiceQuery(); - fExecutor.execute(shutdownQuery); - shutdownQuery.get(); - } - } - - protected void sendCommand(String command) throws Throwable { - sendCommand(command, "ok"); - } - - protected void sendCommand(String command, String expectedResult) throws Throwable { - - final PDATestCommand testCommand = new PDATestCommand(fCommandControl.getContext(), command); - - // Test sending the command and checking all listeners were called. - Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() { - @Override - protected void execute(DataRequestMonitor<PDACommandResult> rm) { - fCommandControl.queueCommand(testCommand, rm); - } - }; - - String responseText = null; - fExecutor.execute(sendCommandQuery); - try { - PDACommandResult result = sendCommandQuery.get(); - responseText = result.fResponseText; - } catch (ExecutionException e) { - if (e.getCause() instanceof CoreException) { - responseText = ((CoreException)e.getCause()).getStatus().getMessage(); - } else { - throw e.getCause(); - } - } - Assert.assertEquals("Command returned an unexpected result", expectedResult, responseText); - - } - - protected void clearEvents() { - fEventsQueue.clear(); - } - - protected void expectEvent(String expectedEvent) throws InterruptedException { - Assert.assertEquals("Unexpected event received", expectedEvent, fEventsQueue.take()); - } - - protected void expectOutput(String expectedOutput) throws IOException { - Assert.assertEquals("Unexpected output received", expectedOutput, fOutputReader.readLine()); - } - -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/PDATestCommand.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/PDATestCommand.java deleted file mode 100644 index 236457a4858..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/PDATestCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import org.eclipse.cdt.examples.dsf.pda.service.PDAVirtualMachineDMContext; -import org.eclipse.cdt.examples.dsf.pda.service.commands.AbstractPDACommand; -import org.eclipse.cdt.examples.dsf.pda.service.commands.PDACommandResult; - -/** - * - */ -class PDATestCommand extends AbstractPDACommand<PDACommandResult> { - PDATestCommand(PDAVirtualMachineDMContext context, String command) { - super(context, command); - } - - @Override - public PDACommandResult createResult(String resultText) { - return new PDACommandResult(resultText); - } -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/PDATestEvent.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/PDATestEvent.java deleted file mode 100644 index 325972537d8..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/PDATestEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -/** - * - */ -public class PDATestEvent { - final public String fEventText; - PDATestEvent(String event) { - fEventText = event; - } -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test1.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test1.java deleted file mode 100644 index c82179c8d80..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test1.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test1 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("samples/example.pda")); - fProgram = programFile.getPath(); - } - - @Test - public void testRun() throws Throwable { - sendCommand("vmresume"); - expectOutput("\"hello\""); - expectOutput("\"barfoo\""); - expectOutput("\"first\""); - expectOutput("\"second\""); - expectOutput("12"); - expectOutput("11"); - expectOutput("10"); - expectOutput("\"barfoo\""); - expectOutput("\"first\""); - expectOutput("\"second\""); - expectOutput("\"end\""); - } -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test10.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test10.java deleted file mode 100644 index bce14a6b9a7..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test10.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test10 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("pdavm/tests/vmtest10.pda")); - - fProgram = programFile.getPath(); - } - - @Test - public void testRegisters() throws Throwable { - expectEvent("started 1"); - // run to the end of register definitions - sendCommand("set 10 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("registers"); - expectEvent("vmsuspended 1 breakpoint 10"); - - // Test the definitions commands - sendCommand("groups", "group1|group2|"); - sendCommand("registers group1", "reg1 true|field1 0 2 |field2 2 2 zero 0 one 1 two 2 three 3 #reg2 false#"); - sendCommand("registers group2", "reg3 true#"); - - // Run to the end of the program - sendCommand("set 37 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectOutput("1"); - expectOutput("2"); - expectOutput("0"); - expectOutput("4"); - expectOutput("0"); - expectOutput("0"); - expectOutput("2"); - expectOutput("8"); - expectEvent("vmsuspended 1 breakpoint 37"); - - // Test var get/set commands - sendCommand("var 1 1 $reg1", "8"); - sendCommand("var 1 1 $reg1.field1", "0"); - sendCommand("var 1 1 $reg1.field2", "2"); - sendCommand("setvar 1 1 $reg1.field2 3"); - sendCommand("var 1 1 $reg1.field2", "3"); - sendCommand("setvar 1 1 $reg1 1"); - sendCommand("var 1 1 $reg1", "1"); - - // exit - sendCommand("exit"); - expectEvent("terminated"); - } -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test2.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test2.java deleted file mode 100644 index e145ef30128..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test2.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test2 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("pdavm/tests/vmtest2.pda")); - - fProgram = programFile.getPath(); - } - - @Test - public void testCommonDebugCommands() throws Throwable { - expectEvent("started 1"); - // test step - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - // test breakpoint - sendCommand("set 4 1"); - sendCommand("data 1", "6|"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 breakpoint 4"); - // test data stack - sendCommand("data 1", "6|7|8|9|"); - sendCommand("popdata 1"); - sendCommand("data 1", "6|7|8|"); - sendCommand("pushdata 1 11"); - sendCommand("data 1", "6|7|8|11|"); - sendCommand("setdata 1 1 2"); - sendCommand("data 1", "6|2|8|11|"); - // test call stack - sendCommand("set 12 1"); - sendCommand("set 19 1"); - sendCommand("stepreturn 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 breakpoint 12"); - sendCommand("clear 19"); - sendCommand("stack 1", fProgram + "|6|main#" + fProgram + "|18|sub1|m|n#" + fProgram + "|12|sub2" ); - sendCommand("stackdepth 1", "3"); - sendCommand("frame 1 0", fProgram + "|6|main"); - sendCommand("frame 1 1", fProgram + "|18|sub1|m|n"); - sendCommand("frame 1 2", fProgram + "|12|sub2" ); - sendCommand("stepreturn 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("stack 1", fProgram + "|6|main#" + fProgram + "|18|sub1|m|n#" + fProgram + "|13|sub2" ); - sendCommand("stepreturn 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("stack 1", fProgram + "|6|main#" + fProgram + "|22|sub1|m|n" ); - sendCommand("set 6 1"); - sendCommand("stepreturn 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 breakpoint 6"); - // test set and clear - sendCommand("set 27 1"); - sendCommand("set 29 1"); - sendCommand("set 33 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 breakpoint 33"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 breakpoint 27"); - sendCommand("clear 33"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 breakpoint 29"); - // test var and setvar - sendCommand("set 47 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 breakpoint 47"); - sendCommand("var 1 1 b", "4"); - sendCommand("var 1 2 b", "2"); - sendCommand("var 1 1 a", "0"); - sendCommand("setvar 1 1 a 99"); - sendCommand("data 1", "6|2|8|11|27|1|4|"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("var 1 1 a", "99"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("data 1", "6|2|8|11|27|1|4|99|"); - sendCommand("var 1 1 x", "error: variable undefined"); - sendCommand("setvar 1 1 x 100"); - sendCommand("var 1 1 x", "100"); - // test exit - sendCommand("exit"); - expectEvent("terminated"); - } - - @Test - public void testCommonDebugCommandsWithThreadRC() throws Throwable { - expectEvent("started 1"); - // test breakpoint - sendCommand("set 3 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("suspended 1 breakpoint 3"); - sendCommand("data 1", "6|7|8|"); - // test step - sendCommand("step 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - // test data stack - sendCommand("data 1", "6|7|8|9|"); - sendCommand("popdata 1"); - sendCommand("data 1", "6|7|8|"); - sendCommand("pushdata 1 11"); - sendCommand("data 1", "6|7|8|11|"); - sendCommand("setdata 1 1 2"); - sendCommand("data 1", "6|2|8|11|"); - // test call stack - sendCommand("set 12 0"); - sendCommand("set 19 0"); - sendCommand("stepreturn 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 breakpoint 12"); - sendCommand("clear 19"); - sendCommand("stack 1", fProgram + "|6|main#" + fProgram + "|18|sub1|m|n#" + fProgram + "|12|sub2" ); - sendCommand("stackdepth 1", "3"); - sendCommand("frame 1 0", fProgram + "|6|main"); - sendCommand("frame 1 1", fProgram + "|18|sub1|m|n"); - sendCommand("frame 1 2", fProgram + "|12|sub2" ); - sendCommand("stepreturn 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - sendCommand("stack 1", fProgram + "|6|main#" + fProgram + "|18|sub1|m|n#" + fProgram + "|13|sub2" ); - sendCommand("stepreturn 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - sendCommand("stack 1", fProgram + "|6|main#" + fProgram + "|22|sub1|m|n" ); - sendCommand("set 6 0"); - sendCommand("stepreturn 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 breakpoint 6"); - // test set and clear - sendCommand("set 27 0"); - sendCommand("set 29 0"); - sendCommand("set 33 0"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("suspended 1 breakpoint 33"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("suspended 1 breakpoint 27"); - sendCommand("clear 33"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("suspended 1 breakpoint 29"); - // test var and setvar - sendCommand("set 47 0"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("suspended 1 breakpoint 47"); - sendCommand("var 1 1 b", "4"); - sendCommand("var 1 2 b", "2"); - sendCommand("var 1 1 a", "0"); - sendCommand("setvar 1 1 a 99"); - sendCommand("data 1", "6|2|8|11|27|1|4|"); - sendCommand("step 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - sendCommand("var 1 1 a", "99"); - sendCommand("step 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - sendCommand("data 1", "6|2|8|11|27|1|4|99|"); - // test exit - sendCommand("exit"); - expectEvent("terminated"); - } - -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test3.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test3.java deleted file mode 100644 index 0569b7b26a3..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test3.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test3 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("pdavm/tests/vmtest3.pda")); - - fProgram = programFile.getPath(); - } - - @Test - public void testUncaughtEvents() throws Throwable { - expectEvent("started 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("unimplemented instruction foobar"); - expectEvent("no such label zippy"); - expectEvent("no such label swishy"); - expectEvent("exited 1"); - expectEvent("terminated"); - } - - @Test - public void testCaughtUnimpinstrEvents() throws Throwable { - expectEvent("started 1"); - sendCommand("eventstop unimpinstr 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("unimplemented instruction foobar"); - expectEvent("vmsuspended 1 event unimpinstr"); - sendCommand("eventstop unimpinstr 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("unimplemented instruction foobar"); - expectEvent("no such label zippy"); - expectEvent("no such label swishy"); - expectEvent("exited 1"); - expectEvent("terminated"); - } - - @Test - public void testCaughtNosuchlabelEvents() throws Throwable { - expectEvent("started 1"); - sendCommand("eventstop nosuchlabel 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("unimplemented instruction foobar"); - expectEvent("no such label zippy"); - expectEvent("vmsuspended 1 event nosuchlabel"); - sendCommand("eventstop nosuchlabel 0"); - sendCommand("set 11 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("no such label zippy"); - expectEvent("vmsuspended 1 breakpoint 11"); - sendCommand("eventstop nosuchlabel 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("no such label swishy"); - expectEvent("vmsuspended 1 event nosuchlabel"); - sendCommand("eventstop nosuchlabel 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("no such label swishy"); - expectEvent("exited 1"); - expectEvent("terminated"); - } - -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test6.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test6.java deleted file mode 100644 index d1241a98a1f..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test6.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test6 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("pdavm/tests/vmtest6.pda")); - - fProgram = programFile.getPath(); - } - - @Test - public void testWatchPoints() throws Throwable { - expectEvent("started 1"); - sendCommand("watch inner::a 1"); - sendCommand("watch main::a 2"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 watch write main::a"); - sendCommand("stack 1", fProgram + "|4|main|a|b"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 watch read inner::a"); - sendCommand("stack 1", fProgram + "|10|main|a|b#" + fProgram + "|25|inner|a|c"); - sendCommand("watch inner::a 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("exited 1"); - expectEvent("terminated"); - } - - @Test - public void testEval() throws Throwable { - expectEvent("started 1"); - - sendCommand("eval 1 test_error", "error: cannot evaluate while vm is suspended"); - - sendCommand("set 25 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("suspended 1 breakpoint 25"); - - sendCommand("eval 1 push%204|push%205|add"); - expectEvent("resumed 1 eval"); - expectEvent("evalresult 9"); - expectEvent("suspended 1 eval"); - - sendCommand("step 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - sendCommand("stack 1", fProgram + "|10|main|a|b#" + fProgram + "|26|inner|a|c"); - sendCommand("data 1", "4|4|"); - sendCommand("eval 1 call%20other"); - expectEvent("resumed 1 eval"); - expectEvent("evalresult 15"); - expectEvent("suspended 1 eval"); - sendCommand("stack 1", fProgram + "|10|main|a|b#" + fProgram + "|26|inner|a|c"); - sendCommand("data 1", "4|4|"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("exited 1"); - expectEvent("terminated"); - } -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test8.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test8.java deleted file mode 100644 index d09e8bf80ac..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test8.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test8 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("pdavm/tests/vmtest8.pda")); - - fProgram = programFile.getPath(); - } - - @Test - public void testDropFrame() throws Throwable { - expectEvent("started 1"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("stack 1", fProgram + "|2|main|a#" + fProgram + "|8|inner|b#" + fProgram + "|12|inner2|c"); - sendCommand("drop 1"); - expectEvent("vmresumed drop"); - expectEvent("vmsuspended 1 drop"); - sendCommand("stack 1", fProgram + "|2|main|a#" + fProgram + "|7|inner|b"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("stack 1", fProgram + "|2|main|a#" + fProgram + "|8|inner|b#" + fProgram + "|10|inner2"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("exited 1"); - expectEvent("terminated"); - } - - @Test - public void testDropFrameWithThreadRC() throws Throwable { - expectEvent("started 1"); - sendCommand("set 12 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("suspended 1 breakpoint 12"); - sendCommand("stack 1", fProgram + "|2|main|a#" + fProgram + "|8|inner|b#" + fProgram + "|12|inner2|c"); - sendCommand("drop 1"); - expectEvent("resumed 1 drop"); - expectEvent("suspended 1 drop"); - sendCommand("stack 1", fProgram + "|2|main|a#" + fProgram + "|7|inner|b"); - sendCommand("step 1"); - expectEvent("resumed 1 step"); - expectEvent("suspended 1 step"); - sendCommand("stack 1", fProgram + "|2|main|a#" + fProgram + "|8|inner|b#" + fProgram + "|10|inner2"); - sendCommand("clear 12"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("exited 1"); - expectEvent("terminated"); - } - -} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test9.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test9.java deleted file mode 100644 index b9b92631d38..00000000000 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/tests/dsf/pda/service/command/Test9.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.pda.service.command; - -import java.io.File; - -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; -import org.eclipse.core.runtime.Path; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class Test9 extends CommandControlTestsBase { - - @BeforeClass - public static void setProgram() { - File programFile = PDAPlugin.getFileInPlugin(new Path("pdavm/tests/vmtest9.pda")); - - fProgram = programFile.getPath(); - } - - @Test - public void testThreadsWithVMRC() throws Throwable { - expectEvent("started 1"); - sendCommand("state", "client"); - sendCommand("state 1", "vm"); - - // Check error responses - sendCommand("vmsuspend", "error: vm already suspended"); - sendCommand("resume 1", "error: cannot resume thread when vm is suspended"); - - // Run to thread create routine - sendCommand("threads", "1"); - sendCommand("set 2 1"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("vmsuspended 1 breakpoint 2"); - sendCommand("state", "1 breakpoint 2"); - sendCommand("state 1", "vm"); - - // Step over first thread create - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("started 2"); - expectEvent("vmsuspended 1 step"); - sendCommand("state", "1 step"); - sendCommand("state 1", "vm"); - sendCommand("threads", "1 2"); - sendCommand("stack 1", fProgram + "|3|main"); - sendCommand("stack 2", fProgram + "|9|foo"); - sendCommand("step 1"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 1 step"); - sendCommand("stack 1", fProgram + "|4|main"); - sendCommand("stack 2", fProgram + "|10|foo"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectOutput("thread_created"); - expectEvent("vmsuspended 1 breakpoint 2"); - - // Step over second thread create - sendCommand("step 2"); - expectEvent("vmresumed step"); - expectEvent("started 3"); - expectEvent("vmsuspended 2 step"); - sendCommand("threads", "1 2 3"); - sendCommand("stack 1", fProgram + "|3|main"); - sendCommand("stack 2", fProgram + "|13|foo#" + fProgram + "|15|inner"); - sendCommand("stack 3", fProgram + "|9|foo"); - sendCommand("step 3"); - expectEvent("vmresumed step"); - expectEvent("vmsuspended 3 step"); - sendCommand("stack 1", fProgram + "|4|main"); - sendCommand("stack 2", fProgram + "|13|foo#" + fProgram + "|16|inner|b"); - sendCommand("stack 3", fProgram + "|10|foo"); - - // Run to the end and watch threads starting/exiting. - sendCommand("clear 2"); - sendCommand("vmresume"); - expectOutput("thread_created"); - expectEvent("vmresumed client"); - expectEvent("started 4"); - expectEvent("exited 2"); - expectEvent("started 5"); - expectEvent("exited 3"); - expectEvent("started 6"); - expectEvent("exited 4"); - expectEvent("exited 1"); - expectEvent("exited 5"); - expectEvent("exited 6"); - expectEvent("terminated"); - } - - @Test - public void testThreadsWithThreadRC() throws Throwable { - expectEvent("started 1"); - - // Check error responses for thread run control - sendCommand("set 1 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("suspended 1 breakpoint 1"); - sendCommand("state", "running"); - sendCommand("state 1", "breakpoint 1"); - - sendCommand("resume", "error: invalid thread"); - sendCommand("vmresume", "error: vm already running"); - sendCommand("clear 1"); - sendCommand("suspend 1", "error: thread already suspended"); - sendCommand("vmsuspend"); - expectEvent("vmsuspended client"); - sendCommand("state", "client"); - sendCommand("state 1", "vm"); - sendCommand("suspend 1", "error: vm already suspended"); - sendCommand("resume 1", "error: cannot resume thread when vm is suspended"); - - // Create breakpoints at thread create and thread entry point. - sendCommand("set 2 0"); - sendCommand("set 10 0"); - sendCommand("vmresume"); - expectEvent("vmresumed client"); - expectEvent("suspended 1 breakpoint 2"); - - // Create first thread, and run it to completion - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("started 2"); - expectEvent("suspended 2 breakpoint 10"); - expectEvent("suspended 1 breakpoint 2"); - sendCommand("state 1", "breakpoint 2"); - sendCommand("state 2", "breakpoint 10"); - sendCommand("threads", "1 2"); - sendCommand("resume 2"); - expectEvent("resumed 2 client"); - expectEvent("exited 2"); - sendCommand("threads", "1"); - - // Create second thread, step it - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("started 3"); - expectEvent("suspended 3 breakpoint 10"); - expectEvent("suspended 1 breakpoint 2"); - sendCommand("threads", "1 3"); - sendCommand("stack 1", fProgram + "|2|main"); - sendCommand("stack 3", fProgram + "|10|foo"); - sendCommand("step 3"); - expectEvent("resumed 3 step"); - expectEvent("suspended 3 step"); - sendCommand("state 1", "breakpoint 2"); - sendCommand("state 3", "step"); - sendCommand("stack 1", fProgram + "|2|main"); - sendCommand("stack 3", fProgram + "|11|foo"); - - // Create the rest of threads - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("started 4"); - expectEvent("suspended 4 breakpoint 10"); - expectEvent("suspended 1 breakpoint 2"); - sendCommand("threads", "1 3 4"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - expectEvent("started 5"); - expectEvent("suspended 5 breakpoint 10"); - expectEvent("suspended 1 breakpoint 2"); - sendCommand("threads", "1 3 4 5"); - sendCommand("resume 1"); - expectEvent("resumed 1 client"); - - // Main thread exits - expectEvent("started 6"); - expectEvent("suspended 6 breakpoint 10"); - expectEvent("exited 1"); - sendCommand("threads", "3 4 5 6"); - - // Exit - sendCommand("exit"); - expectEvent("terminated"); - } - -} |