This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: gdb/testsuite/gdb.base/lib/gdb.exp:gdb_expect_list() consistent pass/fail
- To: Andrew Cagney <ac131313@cygnus.com>
- Subject: Re: gdb/testsuite/gdb.base/lib/gdb.exp:gdb_expect_list() consistent pass/fail
- From: Fernando Nasser <fnasser@cygnus.com>
- Date: Tue, 29 Jun 1999 14:51:52 +0000
- CC: gdb-patches@sourceware.cygnus.com
- Organization: Cygnus Solutions - Toronto
- References: <37782C24.B53DDBAF@cygnus.com>
Thanks Andrew, this is great!
Everything that uses gdb_test is also covered.
When someone has to fix something on send_gdb+gdb_expect kind of tests,
please check if it is possible to get the messages right as well. I am
sure you will appreciate it when looking at the test results pages.
Cheers.
Fernando
Andrew Cagney wrote:
>
> FYI,
>
> I've just checked in the attached patch. It modifies the procedure
> gdb_expect_list() so that it outputs a constant number of tests (pass or
> fail) using a consistent format. This should make it easier to compare
> before/after results. Thanks to Fernando Nasser for reporting this
> problem.
>
> Andrew
>
> Tue Jun 29 11:56:06 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * lib/gdb.exp (gdb_expect_list): Output one message per pattern in
> a consistent format.
>
> ------------------------------------------------------------------------
> Index: lib/gdb.exp
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/testsuite/lib/gdb.exp,v
> retrieving revision 1.144
> diff -p -r1.144 gdb.exp
> *** gdb.exp 1999/06/25 23:39:42 1.144
> --- gdb.exp 1999/06/29 02:07:10
> *************** proc gdb_expect { args } {
> *** 1105,1141 ****
> proc gdb_expect_list {test sentinal list} {
> global gdb_prompt
> set index 0
> ! while { ${index} >= 0 && ${index} < [llength ${list}] } {
> set pattern [lindex ${list} ${index}]
> set index [expr ${index} + 1]
> if { ${index} == [llength ${list}] } {
> ! gdb_expect {
> ! -re "${pattern}${sentinal}" {
> ! pass "${test} (sentinal)"
> }
> ! timeout {
> ! fail "(timeout on sentinal) ${test}"
> ! set index -1
> ! }
> }
> } else {
> ! gdb_expect {
> ! -re "${pattern}" {
> ! pass "${test} (line ${index})"
> ! }
> ! -re "${sentinal}" {
> ! fail "${test} (line ${index})"
> ! set index -1
> ! }
> ! timeout {
> ! fail "(timeout on line ${index}) ${test}"
> ! set index -1
> }
> }
> }
> - }
> - if { ${index} >= 0 } {
> - pass "${test}"
> }
> }
>
> --- 1105,1147 ----
> proc gdb_expect_list {test sentinal list} {
> global gdb_prompt
> set index 0
> ! set ok 1
> ! while { ${index} < [llength ${list}] } {
> set pattern [lindex ${list} ${index}]
> set index [expr ${index} + 1]
> if { ${index} == [llength ${list}] } {
> ! if { ${ok} } {
> ! gdb_expect {
> ! -re "${pattern}${sentinal}" {
> ! pass "${test}, pattern ${index} + sentinal"
> ! }
> ! timeout {
> ! fail "${test}, pattern ${index} + sentinal (timeout)"
> ! set ok 0
> ! }
> }
> ! } else {
> ! fail "${test}, pattern ${index} + sentinal"
> }
> } else {
> ! if { ${ok} } {
> ! gdb_expect {
> ! -re "${pattern}" {
> ! pass "${test}, pattern ${index}"
> ! }
> ! -re "${sentinal}" {
> ! fail "${test}, pattern ${index}"
> ! set ok 0
> ! }
> ! timeout {
> ! fail "${test}, pattern ${index} (timeout)"
> ! set ok 0
> ! }
> }
> + } else {
> + fail "${test}, pattern ${index}"
> }
> }
> }
> }
>
--
Fernando Nasser
Cygnus Solutions - Toronto Office E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #502 Tel: 416-482-3039
Toronto, Ontario M4P 2C9 Fax: 416-482-6299