From: Andrew Cagney <cagney@redhat.com>
To: frysk@sourceware.org
Subject: Easier HPD expect methods
Date: Thu, 06 Sep 2007 13:40:00 -0000 [thread overview]
Message-ID: <46E0036D.7030907@redhat.com> (raw)
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
reply other threads:[~2007-09-06 13:40 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=46E0036D.7030907@redhat.com \
--to=cagney@redhat.com \
--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: link
Be 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).