[SCM] master: Fix <<(fhpd) ;oust>>.

cagney@sourceware.org cagney@sourceware.org
Tue Dec 11 22:53:00 GMT 2007


The branch, master has been updated
       via  233bb4509cad26e0c903fcaba28bb5f5564ee863 (commit)
      from  2be25cf2737c5c61f4f77659d8b49d0a44f22e33 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 233bb4509cad26e0c903fcaba28bb5f5564ee863
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Dec 11 17:52:12 2007 -0500

    Fix <<(fhpd) ;oust>>.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-12-11  Andrew Cagney  <cagney@redhat.com>
    
    	* MultiLevelCommand.java (interpret(CLI,Input)): Add comment on
    	why help(CLI,Input) is called.
    	* TestPreprocessor.java: New.
    	* CLI.java (execCommand(String)): Ignore empty lines.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/hpd/CLI.java                      |   35 +++++++-------
 frysk-core/frysk/hpd/ChangeLog                     |    5 ++
 frysk-core/frysk/hpd/MultiLevelCommand.java        |    2 +
 ...ompletionFactory.java => TestPreprocessor.java} |   51 ++++++++++---------
 4 files changed, 51 insertions(+), 42 deletions(-)
 copy frysk-core/frysk/hpd/{TestCompletionFactory.java => TestPreprocessor.java} (72%)

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/CLI.java b/frysk-core/frysk/hpd/CLI.java
index 1e072b1..d03e62d 100644
--- a/frysk-core/frysk/hpd/CLI.java
+++ b/frysk-core/frysk/hpd/CLI.java
@@ -255,24 +255,23 @@ public class CLI {
     }
 
     public String execCommand(String cmd) {
-        String pcmd = ""; // preprocessed command
-        Input command;
-
-        if (cmd != null) {
-            try {
-                // preprocess and iterate
-                for (Iterator iter = prepro.preprocess(cmd); iter.hasNext();) {
-                    pcmd = (String)iter.next();
-                    command = new Input(pcmd);
-		    topLevelCommand.interpret(this, command);
-                }
-            }
-            catch (RuntimeException e) {
-                printError(e);
-            }
-            flushMessages();
-        }
-        return null;
+	if (cmd != null) {
+	    // NULL when EOF.
+	    try {
+		// preprocess and iterate
+		for (Iterator iter = prepro.preprocess(cmd); iter.hasNext();) {
+		    String pcmd = (String)iter.next();
+		    Input command = new Input(pcmd);
+		    // Ignore empty commands
+		    if (command.size() > 0)
+			topLevelCommand.interpret(this, command);
+		}
+	    } catch (RuntimeException e) {
+		printError(e);
+	    }
+	}
+	flushMessages();
+	return null;
     }
     
     /**
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 3050030..c096d29 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,5 +1,10 @@
 2007-12-11  Andrew Cagney  <cagney@redhat.com>
 
+	* MultiLevelCommand.java (interpret(CLI,Input)): Add comment on
+	why help(CLI,Input) is called.
+	* TestPreprocessor.java: New.
+	* CLI.java (execCommand(String)): Ignore empty lines.
+
 	* ListCommand.java: Update; DebugInfoFrame's .getLines() replaced
 	by getLine().
 	* StepCommand.java: Ditto.
diff --git a/frysk-core/frysk/hpd/MultiLevelCommand.java b/frysk-core/frysk/hpd/MultiLevelCommand.java
index 2a8eaea..266d5ef 100644
--- a/frysk-core/frysk/hpd/MultiLevelCommand.java
+++ b/frysk-core/frysk/hpd/MultiLevelCommand.java
@@ -132,6 +132,8 @@ public abstract class MultiLevelCommand extends Command {
     void interpret(CLI cli, Input input) {
 	String subAction = input.parameter(0);
 	if (subAction == null) {
+	    // So that typing a partial command prints the list of
+	    // possible completions.
 	    help(cli, input);
 	    return;
 	}
diff --git a/frysk-core/frysk/hpd/TestCompletionFactory.java b/frysk-core/frysk/hpd/TestPreprocessor.java
similarity index 72%
copy from frysk-core/frysk/hpd/TestCompletionFactory.java
copy to frysk-core/frysk/hpd/TestPreprocessor.java
index 3f595bd..84e4ffd 100644
--- a/frysk-core/frysk/hpd/TestCompletionFactory.java
+++ b/frysk-core/frysk/hpd/TestPreprocessor.java
@@ -39,35 +39,38 @@
 
 package frysk.hpd;
 
-import frysk.Config;
+import frysk.expunit.Regex;
+import frysk.expunit.EofException;
 
-public class TestCompletionFactory extends TestLib {
+/**
+ * Test the pre-processor which unpacks stuff like
+ * <<COMMAND;COMMAND>>.
+ */
 
-    public void setUp() {
-	super.setUp();
+public class TestPreprocessor extends TestLib {
+    public void testEmptyCompound() {
 	e = new HpdTestbed();
+	e.sendCommandExpectPrompt(";", "\r\n");
     }
-
-    /**
-     * At least two expansions of "funit-stack-" are
-     * "funit-stack-inlined" and "funit-stack-outlined"; there might
-     * also be .o files, but ignore that.
-     */
-    private void checkFunitStackCompletion() {
-	e.send(Config.getPkgLibFile("funit-stack-").getAbsolutePath());
-	e.send("\t");
-	e.expect("funit-stack-inlined\\r\\n");
-	e.expect("funit-stack-outlined\\r\\n");
-	e.expectPrompt();
-    }
-
-    public void testCompleteFirstFileNameArg() {
-	e.send("run ");
-	checkFunitStackCompletion();
+    public void testUnknownSecondCompound() {
+	e = new HpdTestbed();
+	e.sendCommandExpectPrompt(";oust", "Error: Unknown command: oust\r\n");
     }
 
-    public void testCompleteSecondFileNameArg() {
-	e.send("run a ");
-	checkFunitStackCompletion();
+    public void testEOF() {
+	e = new HpdTestbed();
+	e.send("\004"); // ^D; PTY converts this to EOF.
+	// Match just EOF, if there is any other output fail.
+	boolean eof = false;
+	try {
+	    e.expect(new Regex(".+") {
+		    public void execute() {
+			fail("Unexpected input: <<" + group() + ">>");
+		    }
+		});
+	} catch (EofException e) {
+	    eof = true;
+	}
+	assertTrue("eof", eof);
     }
 }


hooks/post-receive
--
frysk system monitor/debugger



More information about the Frysk-cvs mailing list