This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
Easier HPD expect methods
- From: Andrew Cagney <cagney at redhat dot com>
- To: frysk at sourceware dot org
- Date: Thu, 06 Sep 2007 09:41:01 -0400
- Subject: Easier HPD expect methods
FYI,
For code wanting to test HPD interactions (as found in frysk.hpd.Test*)
I've added the class frysk.hpd.HpdTestbed which extends Expect. This
class both creates an instance of the HPD wrapped up in Expect and
provides easier / more friendly expect methods vis:
-> they detect wrong-output+PROMPT; no longer is there a 5 second
timeout before things fail
-> the failure message includes what was expected and what was in the
buffer - easier to debug
For instance:
public void testUnattached() {
e = new HpdTestbed();
// Add with no process; shouldn't crash.
e.sendCommandExpectPrompt("print 2+2", "5\r\n");
}
$ ./TestRunner frysk.hpd.TestPrint.testUnattached
Running testUnattached(frysk.hpd.TestPrint) ...FAIL
junit.framework.AssertionFailedError: sent: <print 2+2> expecting: <5
> got: <print 2+2
4
(fhpd) >
Note that this class isn't intended for testing HPD invocation, or
option parser (as done by the tests in frysk.bindir.TestHpd); as some
point this class is going to get changed to run HPD as a thread in
TestRunner.
Andrew