public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: rmoseley@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Allow HPD notation for start/run command. Date: Mon, 31 Mar 2008 17:21:00 -0000 [thread overview] Message-ID: <20080331172128.3173.qmail@sourceware.org> (raw) The branch, master has been updated via 7cce31266c351358182feda857399c9b3142522a (commit) from 9ef6466d481de2a984018cdefc4722d65bbf690a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 7cce31266c351358182feda857399c9b3142522a Author: Rick Moseley <rmoseley@localhost.localdomain> Date: Mon Mar 31 12:20:10 2008 -0500 Allow HPD notation for start/run command. * StartRun.java: Add ability to start/run with hpd notation. * TestRunCommand.java: Add test for above. * TestStartCommand.java: Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 6 ++++ frysk-core/frysk/hpd/StartRun.java | 35 +++++++++++++++++++++------ frysk-core/frysk/hpd/TestRunCommand.java | 25 ++++++++++++++++++++ frysk-core/frysk/hpd/TestStartCommand.java | 23 ++++++++++++++++++ 4 files changed, 81 insertions(+), 8 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index ee8662f..12e6daa 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,9 @@ +2008-03-31 Rick Moseley <rmoseley@redhat.com> + + * StartRun.java: Add ability to start/run with hpd notation. + * TestRunCommand.java: Add test for above. + * TestStartCommand.java: Ditto. + 2008-03-25 Rick Moseley <rmoseley@redhat.com> * StartRun.java: Kill all processes on a re-run before diff --git a/frysk-core/frysk/hpd/StartRun.java b/frysk-core/frysk/hpd/StartRun.java index bc3fdb4..8046540 100644 --- a/frysk-core/frysk/hpd/StartRun.java +++ b/frysk-core/frysk/hpd/StartRun.java @@ -61,6 +61,8 @@ abstract class StartRun extends ParameterizedCommand { final ArrayList procList = new ArrayList(); + PTSet userSet; + StartRun(String command, String help1, String help2) { super(command, help1, help2); } @@ -126,6 +128,8 @@ abstract class StartRun extends ParameterizedCommand { public void interpretCmd(CLI cli, Input cmd, Object options, boolean runToBreak) { + + userSet = cli.getCommandPTSet(cmd); // See if there are any tasks to be killed if (killProcs(cli)) { // See if there are any tasks in the current target set @@ -139,7 +143,7 @@ abstract class StartRun extends ParameterizedCommand { return; } // Take care of loaded procs - Iterator foo = cli.targetset.getTaskData(); + Iterator foo = userSet.getTaskData(); if (!foo.hasNext()) { cli.addMessage("No procs in targetset to run", Message.TYPE_NORMAL); return; @@ -170,10 +174,12 @@ abstract class StartRun extends ParameterizedCommand { * killProcs loops through the current target set to see if there are any * tasks to kill, the philosophy being that all tasks should be killed before * + * @param cli is the command line object + * @return true if there were procs to kill, false if there weren't */ private boolean killProcs(CLI cli) { - Iterator foo = cli.targetset.getTaskData(); + Iterator foo = userSet.getTaskData(); // No procs in target set return false if (!foo.hasNext()) { return false; @@ -211,16 +217,21 @@ abstract class StartRun extends ParameterizedCommand { int taskid) { Runner runner = new Runner(cli); String startrun = ""; - if (runToBreak) - startrun = "running"; - else - startrun = "starting"; - if (cmd.size() == 0) { + if (runToBreak) + startrun = "running"; + else + startrun = "starting"; + + switch (cmd.size()) { + + case 0: cli.addMessage(startrun + " with this command: " + asString(template.getCmdLine()), Message.TYPE_NORMAL); Manager.host.requestCreateAttachedProc(template, runner); - } else { + break; + + default: String[] args = new String[cmd.size() + 1]; args[0] = template.getCmdLine()[0]; for (int i = 1; i < args.length; i++) @@ -248,6 +259,14 @@ abstract class StartRun extends ParameterizedCommand { cli.taskID = -1; } } + + /** + * asString takes an array of arguments and converts it to a single + * string of args as would be appropriate for a commandline + * @param args is an array of arguments to pass to the process to be run + * @return a String of args that are to be passed to the process + * on the commandline + */ private String asString(String[] args) { if (args == null || args.length <= 0) diff --git a/frysk-core/frysk/hpd/TestRunCommand.java b/frysk-core/frysk/hpd/TestRunCommand.java index 1c769bb..7513d35 100644 --- a/frysk-core/frysk/hpd/TestRunCommand.java +++ b/frysk-core/frysk/hpd/TestRunCommand.java @@ -188,4 +188,29 @@ public class TestRunCommand extends TestLib { e.expect("Quitting\\.\\.\\."); e.close(); } + + /** + * This test case gives the run command a specific targetset to run + * + */ + + public void testRunHpdParam() { + e = new HpdTestbed(); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(), + "\\[0\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(), + "\\[1\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(), + "\\[2\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("[1.0] run", "Attached to process ([0-9]+).*" + "Creating new.*" + + "running.*" + "Running process ([0-9]+).*"); + try { Thread.sleep(1000); } catch (Exception e) {} + //e.sendCommandExpectPrompt("load", "\\[0\\.0\\].*funit-hello.*\\[2\\.0\\].*funit-threads.*"); + e.sendCommandExpectPrompt("focus", "Target set.*\\[0\\.0\\]\t\t0\t0.*" + + "\\[1\\.0\\]\t\t([0-9]+).*\\t([0-9]+).*\\[1\\.1\\]\t\t([0-9]+)\t([0-9]+).*" + + "\\[2\\.0\\]\t\t0\t0.*"); + e.send("quit\n"); + e.expect("Quitting\\.\\.\\."); + e.close(); + } } \ No newline at end of file diff --git a/frysk-core/frysk/hpd/TestStartCommand.java b/frysk-core/frysk/hpd/TestStartCommand.java index 87aa2b9..5c64e56 100644 --- a/frysk-core/frysk/hpd/TestStartCommand.java +++ b/frysk-core/frysk/hpd/TestStartCommand.java @@ -131,4 +131,27 @@ public class TestStartCommand extends TestLib { e.expect("Quitting\\.\\.\\."); e.close(); } + + /** + * This test case gives the start command a specific targetset to run + * + */ + + public void testRunHpdParam() { + e = new HpdTestbed(); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-hello").getPath(), + "\\[0\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(), + "\\[1\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("load " + Config.getPkgLibFile("funit-threads-looper").getPath(), + "\\[2\\.0\\] Loaded executable file.*"); + e.sendCommandExpectPrompt("[1.0] start", "Attached to process ([0-9]+).*" + "Creating new.*" + + "starting.*"); + try { Thread.sleep(1000); } catch (Exception e) {} + e.sendCommandExpectPrompt("focus", "Target set.*\\[0\\.0\\]\t\t0\t0.*" + + "\\[1\\.0\\]\t\t([0-9]+).*\\t([0-9]+).*\\[2\\.0\\]\t\t0\t0.*"); + e.send("quit\n"); + e.expect("Quitting\\.\\.\\."); + e.close(); + } } \ No newline at end of file hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-03-31 17:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080331172128.3173.qmail@sourceware.org \ --to=rmoseley@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).