From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16218 invoked by alias); 2 Feb 2007 20:52:34 -0000 Received: (qmail 16211 invoked by uid 22791); 2 Feb 2007 20:52:34 -0000 X-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,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; Fri, 02 Feb 2007 20:52:29 +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 l12KqQeM020784 for ; Fri, 2 Feb 2007 15:52:26 -0500 Received: from pobox.hsv.redhat.com (pobox.hsv.redhat.com [172.16.16.12]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l12KqPUN001944; Fri, 2 Feb 2007 15:52:26 -0500 Received: from [172.16.17.199] (dhcp-199.hsv.redhat.com [172.16.17.199]) by pobox.hsv.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id l12KqPTa027019; Fri, 2 Feb 2007 15:52:25 -0500 Message-ID: <45C3A489.9060805@redhat.com> Date: Fri, 02 Feb 2007 20:52:00 -0000 From: Phil Muldoon User-Agent: Thunderbird 1.5.0.9 (X11/20061219) MIME-Version: 1.0 To: Andrew Cagney CC: frysk Subject: Re: frysk.expunit, Expect like functionality within JUnit References: <45C0E033.2060808@redhat.com> In-Reply-To: <45C0E033.2060808@redhat.com> 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-q1/txt/msg00061.txt.bz2 Andrew Cagney wrote: > Hello, > > The Expect program lets the user interact with a console based > program, sending it input and checking its output. The existing > testing framework dejagnu builds on expect. > > The package frysk.expunit provides functionality similar to Expect, > but in a way that integrates into the JUnit framework. By doing this, > developers: > > -> need only learn JUnit, and this extension, and not an entirely new > language (tcl/tk) and test framework (dejagnu) The current expect tests use tcl, so having the expect-like tests in Java will be a welcome addition. For fcore, the tests are: create an expected fail condition, check that it fails like it should. Here is an existing test: #start test program, and store pid. set funit_path [findfile "$pwd/frysk/pkglibdir/funit-child" "$pwd/frysk/pkglibdir/funit-child" funit-child] set funit_pid [spawn ${funit_path} 100 0 0] set funit_sid $spawn_id #start tester program with valid pid, but wrong -console argument spawn $fcore_path -console frysk=BADLOG $funit_pid #test output. expect { -re "fcore: Invalid log console: BADLOG" {pass test_fcore_bad_console_log_argument} default {fail test_fcore_bad_console_log_argument} } So for the purposes of the above test, the new Java Expect should simplfy things nicely. Given the above, would the correct java code be something like: {start up an example java process, using DetachedAckProcess or AckDaemonProcess} e = new Expect (new String[] { "fcore", "-console","frysk=BADLOG",myPid}); e.assertExpect ("fcore: Invalid log console: BADLOG"); I'm not sure how you would find the fcore in the above (in-tree and out-of-tree testing), but if the test converts to as simply as above, that is great! Regards Phil