From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6364 invoked by alias); 6 Sep 2007 13:40:33 -0000 Received: (qmail 6354 invoked by uid 22791); 6 Sep 2007 13:40:32 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DK_POLICY_SIGNSOME,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 06 Sep 2007 13:40:28 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l86DeQ14013992 for ; Thu, 6 Sep 2007 09:40:26 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l86DeP9C007095 for ; Thu, 6 Sep 2007 09:40:25 -0400 Received: from [127.0.0.1] (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l86DeOKr021260 for ; Thu, 6 Sep 2007 09:40:25 -0400 Message-ID: <46E0036D.7030907@redhat.com> Date: Thu, 06 Sep 2007 13:40:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 1.5.0.12 (X11/20070530) MIME-Version: 1.0 To: frysk@sourceware.org Subject: Easier HPD expect methods Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00385.txt.bz2 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: expecting: <5 > got: 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