dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Intro to dejagnu: Help!


From: Yan Jiang
Subject: RE: Intro to dejagnu: Help!
Date: Thu, 08 Jun 2006 23:12:23 +0800

Hi, Paulo.

first of all, expect and dejagnu is good at testing interactive project.
If the result of yout test cases can be decided by the input and output pair.
then it's the right thing for you.
other wise you really should look for another tool.

secondly.
I know it's pretty hard to find expect tutorial on internet.
But i think it's easier for you to find some tcl tutorial.
expect is based on Tcl.

thirdly:)
there is a tool in the expect release project, called "autoexpect".
try>>
$ autoexpect -f testcase1.exp
$ run_your_project
input something
you got the output here.
$ pkill autoexpect

after this , you will find a expect script "testcase1.exp" in the directory.
use an editor to open it.

autoexpect will record the input and output of the current running process.
then all you have to do is to do a little modification to use it as one of your case.

Finally, a brief into to expect.
common used expect way is like this

set timeout n; # this is optional, be default n=10 seconds.
expect{
   -re "pattern1" { send "pass" }
   -re "pattern2" { send "fail"   }
   timeout          { send "time out" }
}

expect will read the output of the process,
if output starts to match pattern1, then pass will be print-out.
match pattern2, fail will be print-out.
otherwise timeout will be print-out.

set timeout -1. then expect will encounter timetout.

Hope it could help.:)

some expect scripts in dejagnu release packet might also be helpful.

Best wishes.



From: "Paulo J. Matos" <address@hidden>
Reply-To: address@hidden
To: address@hidden
Subject: Intro to dejagnu: Help!
Date: Thu, 8 Jun 2006 14:35:33 +0100

Hi all,

I'm searching for a way to test a software I'm developing for some
time ago. Since I'm using autotools, seems dejagnu seems the way to
go. But I don't know expect and don't have the slightest idea what do
to. I've briefly read through the manual but it doesn't really 'teach
you'. I don't want to know expect besides scripts to work with
dejagnu. I would like someone to tell me where to start or a quick
tutorial in it. From what I understand it seems it is easy to test my
program.
My program is called with some command line arguments and then it
output 3 values "yes", "no", "unknown". In fact, this could be done
with a bash script but using dejagnu seems more integrated. Given the
command line argument (a file), I know the correct output. I just want
to check if the program is giving the correct output.

Another more technical issue is that my program may or may not use
GMP, this is set from within configure by using the --enable-gmp. This
changes the program output, what might be before "unknown", can be now
"yes" or "no". So I need different testsuites for the program compiled
with or without --enable-gmp. Any ideas on how to do this?

Thanks in advance,

--
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group


_______________________________________________
DejaGnu mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/dejagnu






reply via email to

[Prev in Thread] Current Thread [Next in Thread]