For review: call-ar-st.exp: don't fail on slow targets

Andrew Cagney ac131313@cygnus.com
Wed Jun 23 03:57:00 GMT 1999


Hello,

The attached patch tries to fix a number of bogus failures when the
testsuite is being run on a very slow target (such as a simulator).

Instead of trying to match the output using a single pattern, it matches
the output incrementally.

Before checking in this patch, I'd be interested in hearing if it adds
any failures (it adds a lot of extra passes :-)

	Andrew

Wed Jun 23 20:53:02 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdb.base/call-ar-st.exp (gdb_expect_list): New procedure.
  	Matches a list of patterns.
	* gdb.base/call-ar-st.exp: Use gdb_expect_list in "print
 	print_double_array(double_array)", "continuing to breakpoint
 	1018", "print print_double_array(array_d)" and "continuing to
 	1034" tests.
Index: ./gdb/testsuite/gdb.base/call-ar-st.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/call-ar-st.exp,v
retrieving revision 1.8
diff -p -r1.8 call-ar-st.exp
*** call-ar-st.exp	1999/06/08 10:11:33	1.8
--- call-ar-st.exp	1999/06/23 10:46:04
*************** proc set_lang_c {} {
*** 85,90 ****
--- 85,134 ----
  source ${binfile}.ci
  
  
+ # Check for long sequence of output by parts.
+ # TEST: is the test message.
+ # SENTINAL: Is the terminal pattern indicating that output has finished.
+ # LIST: is the sequence of outputs to match.
+ # If the sentinal is recognized early, it is considered an error.
+ 
+ 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}"
+     }
+ }
+ 
+ 
  # Start with a fresh gdb.
  
  gdb_exit
*************** gdb_test continue \
*** 114,125 ****
  #call print_double_array(double_array)
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_double_array(double_array)\n"
!   gdb_expect {
!     -re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" {
!       pass "print print_double_array(double_array)"
!     }
!     -re ".*$gdb_prompt $" { fail "print print_double_array(double_array)" }
!     timeout           { fail "(timeout) print print_double_array(double_array)" }
    }
  }
  
--- 158,180 ----
  #call print_double_array(double_array)
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_double_array(double_array)\n"
!   gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" {
! 	"\[ \t\r\n\]+array_d :"
! 	"\[ \t\r\n\]+=========\[ \t\r\n\]+"
! 	"\[ \t\r\n\]+0.000000"
! 	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
! 	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
! 	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
! 	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
! 	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
! 	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
! 	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
! 	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
! 	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
! 	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
! 	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
! 	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
! 	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
    }
  }
  
*************** gdb_test "tbreak 1018" \
*** 168,176 ****
      "Breakpoint.* file .*$srcfile, line 1018.*" \
      "tbreakpoint line 1018"
  
! gdb_test continue \
! "Continuing\\..*array_d :.*array_f :.*student id :\[\t \]+.*YELLOW.*array_i :.*main \\(\\) at .*call-ar-st.c:1018\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." \
! "continuing to breakpoint 1018"
  
  #step
      send_gdb "step\n"
--- 223,252 ----
      "Breakpoint.* file .*$srcfile, line 1018.*" \
      "tbreakpoint line 1018"
  
! send_gdb "continue\n"
! gdb_expect_list "continuing to breakpoint 1018" ".*$gdb_prompt $" {
!     "Continuing\\."
!     "\[ \t\r\n\]+array_d :"
!     "\[ \t\r\n\]+=========\[ \t\r\n\]+"
!     "\[ \t\r\n\]+0.000000"
!     "\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
!     "\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
!     "\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
!     "\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
!     "\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
!     "\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
!     "\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
!     "\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
!     "\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
!     "\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
!     "\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
!     "\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
!     "\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
!     ".*array_f :"
!     ".*student id :\[\t \]+.*YELLOW"
!     ".*array_i :"
!     ".*main \\(\\) at .*call-ar-st.c:1018\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)."
! }
  
  #step
      send_gdb "step\n"
*************** gdb_test continue \
*** 194,205 ****
  #call print_double_array(array_d)
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_double_array(array_d)\n"
!   gdb_expect {
!     -re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" {
!       pass "print print_double_array(array_d)"
!     }
!     -re ".*$gdb_prompt $" { fail "print print_double_array(array_d)" }
!     timeout           { fail "(timeout) print print_double_array(array_d)" }
    }
  }
  
--- 270,292 ----
  #call print_double_array(array_d)
  if {![target_info exists gdb,skip_float_tests]} {
    send_gdb "print print_double_array(array_d)\n"
!   gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" {
!       "array_d :"
!       "\[ \t\r\n\]+========="
!       "\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
!       "\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
!       "\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
!       "\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
!       "\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
!       "\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
!       "\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
!       "\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
!       "\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
!       "\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
!       "\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
!       "\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
!       "\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
!       "\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
    }
  }
  
*************** gdb_test "tbreak 1034" \
*** 208,214 ****
  "Breakpoint.* file .*$srcfile, line 1034.*" \
  "tbreakpoint line 1034"
  
! gdb_test continue "Continuing\\..*array_c.*array_f.*array_d.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1034.*printf\\(.BYE BYE FOR NOW.n.\\)." "continuing to 1034"
  
  
  #call sum_array_print(10, *list1, *list2, *list3, *list4)
--- 295,321 ----
  "Breakpoint.* file .*$srcfile, line 1034.*" \
  "tbreakpoint line 1034"
  
! send_gdb "continue\n"
! gdb_expect_list "continuing to 1034"  ".*$gdb_prompt $" {
!     "Continuing\\..*array_c"
!     ".*array_f"
!     "\[ \t\r\n\]+array_d :"
!     "\[ \t\r\n\]+=========\[ \t\r\n\]+"
!     "\[ \t\r\n\]+0.000000"
!     "\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
!     "\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
!     "\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
!     "\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
!     "\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
!     "\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
!     "\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
!     "\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
!     "\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
!     "\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
!     "\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
!     "\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
!     "\[ \t\r\n\]+2275.299900  2298.756600  2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1034.*printf\\(.BYE BYE FOR NOW.n.\\)."
! }
  
  
  #call sum_array_print(10, *list1, *list2, *list3, *list4)


More information about the Gdb mailing list