gdb/testsuite/gdb.base/lib/gdb.exp:gdb_expect_list() consistent pass/fail

Andrew Cagney ac131313@cygnus.com
Mon Jun 28 19:15:00 GMT 1999


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}"
  	    }
  	}
      }
  }
  




More information about the Gdb-patches mailing list