Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test
@ 2010-05-22 22:33 Michael Snyder
  2010-05-23  1:40 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2010-05-22 22:33 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: c.exp.txt --]
[-- Type: text/plain, Size: 57903 bytes --]

2010-05-22  Michael Snyder  <msnyder@vmware.com>

	* gdb.base/call-ar-st.exp: Replace send_gdb with gdb_test.
	* gdb.base/callfuncs.exp: Replace send_gdb with gdb_test.
	* gdb.base/call-rt-st.exp: Replace send_gdb with gdb_test.
	* gdb.base/call-signal-resume.exp: Replace send_gdb with gdb_test.
	* gdb.base/call-strs.exp: Replace send_gdb with gdb_test.
	* gdb.base/catch-syscall.exp: Replace send_gdb with gdb_test.
	* gdb.base/charset.exp: Replace send_gdb with gdb_test.
	* gdb.base/checkpoint.exp: Replace send_gdb with gdb_test.
	* gdb.base/commands.exp: Replace send_gdb with gdb_test.
	* gdb.base/condbreak.exp: Replace send_gdb with gdb_test.
	* gdb.base/cond-exprs.exp: Replace send_gdb with gdb_test.
	* gdb.base/consecutive.exp: Replace send_gdb with gdb_test.
	* gdb.base/constvars.exp: Replace send_gdb with gdb_test.
	* gdb.base/corefile.exp: Replace send_gdb with gdb_test.

Index: call-ar-st.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-ar-st.exp,v
retrieving revision 1.24
diff -u -p -r1.24 call-ar-st.exp
--- call-ar-st.exp	5 May 2010 18:06:57 -0000	1.24
+++ call-ar-st.exp	22 May 2010 21:15:10 -0000
@@ -61,24 +61,19 @@ set timeout [expr "$timeout + 60"]
 proc set_lang_c {} {
     global gdb_prompt
 
-    send_gdb "set language c\n"
-    gdb_expect {
-	-re ".*$gdb_prompt $" {}
-	timeout { fail "set language c (timeout)" ; return 0; }
-    }
+    gdb_test_no_output "set language c"
 
-    send_gdb "show language\n"
-    gdb_expect {
+    gdb_test_multiple "show language" "set language to \"c\"" {
 	-re ".* source language is \"c\".*$gdb_prompt $" {
 	    pass "set language to \"c\""
 	    return 1
 	}
 	-re ".*$gdb_prompt $" {
-	    fail "setting language to \"c\""
+	    fail "set language to \"c\""
 	    return 0
 	}
 	timeout {
-	    fail "can't show language (timeout)"
+	    fail "(timeout) set language to \"c\""
 	    return 0
 	}
     }
@@ -90,9 +85,9 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
 
 
 if ![runto_main] then {
@@ -201,28 +196,15 @@ if {![gdb_skip_float_test "continuing to
 }
 
 #step
-send_gdb "step\n"
-gdb_expect {
-    -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
-    -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
-    timeout { fail "step inside print_all_arrays (timeout)" }
-}
-
+gdb_test "step" \
+    "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*" \
+    "step inside print_all_arrays"
 
 #step -over
 if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
-    send_gdb "next\n"
-    gdb_expect {
-	-re "array_i :.*307.*print_char_array.*$gdb_prompt $" {
-	    pass "next over print_int_array in print-all_arrays"
-	}
-	-re ".*$gdb_prompt $" { 
-	    fail "next over print_int_array in print-all_arrays" 
-	}
-	timeout { 
-	    fail "next over print_int_array in print-all_arrays (timeout)"
-	}
-    }
+    gdb_test "next" \
+	"array_i :.*307.*print_char_array.*" \
+	"next over print_int_array in print-all_arrays"
 } else {
     gdb_test "next" "" ""
 }
@@ -265,24 +247,16 @@ if {![gdb_skip_float_test "continuing to
 #call sum_array_print(10, *list1, *list2, *list3, *list4)
 
 if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
-    send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
-    gdb_expect {
-	-re ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*$gdb_prompt $" {
-	    pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
-	}
-	-re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
-	timeout           { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
-    }
+    gdb_test "print sum_array_print(10, *list1, *list2, *list3, *list4)" \
+	".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*" \
+	"print sum_array_print(10, *list1, *list2, *list3, *list4)"
 }
 
 #step over
 if ![gdb_skip_stdio_test "next to 1237"] {
-    send_gdb "next\n"
-    gdb_expect {
-	-re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"}
-	-re ".*$gdb_prompt $" { fail "next to 1237" }
-	timeout { fail "next to 1237(timeout)" }
-    }
+    gdb_test "next" \
+	"BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*" \
+	"next to 1237"
 } else {
     gdb_test "next" "" ""
 }
@@ -290,18 +264,9 @@ if ![gdb_skip_stdio_test "next to 1237"]
 #call print_array_rep(\*list1, \*list2, \*list3)
 
 if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
-    send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
-    gdb_expect {
-	-re ".*$gdb_prompt $" {
-	    pass "print print_array_rep(*list1, *list2, *list3)"
-	}
-	-re ".*$gdb_prompt $" { 
-	    fail "print print_array_rep(*list1, *list2, *list3)" 
-	}
-	timeout               {
-	    fail "(timeout) print print_array_rep(*list1, *list2, *list3)" 
-	}
-    }
+    gdb_test "print print_array_rep(\*list1, \*list2, \*list3)" \
+	"Contents of linked list3:.*" \
+	"print print_array_rep(*list1, *list2, *list3)"
 }
 
 #go -until 1241
@@ -309,14 +274,9 @@ gdb_test "tbreak 1241" \
     "Temporary breakpoint..* file .*$srcfile, line 1241.*" \
     "tbreakpoint line 1241"
 
-send_gdb  "continue\n"
-gdb_expect {
- -re ".*main \\(\\) at .*call-ar-st.c:1241\r\n1241\[\t \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" {
-                   pass "continue to 1241"}
- -re ".*$gdb_prompt $" { fail "continue to 1241"}
- timeout           { fail "(timeout) continue to 1241"}
-}
-
+gdb_test "continue" \
+    "main \\(\\) at .*call-ar-st.c:1241\r\n1241\[\t \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*" \
+    "continue to 1241"
 
 
 # Run into sum_array_print, and verify that the arguments were passed
@@ -355,14 +315,9 @@ gdb_test "tbreak 1281" \
     "tbreakpoint line 1281"
 
 if ![gdb_skip_stdio_test "continuing to 1281"] {
-    send_gdb "continue\n"
-    gdb_expect {
-	-re  "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" {
-	    pass "continue to 1281"
-	}
-	-re ".*$gdb_prompt $" { fail "continue to 1281"}           
-	timeout           { fail "(timeout) continue to 1281"}
-    }
+    gdb_test "continue" \
+	"Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*" \
+	"continue to 1281"
 } else {
     gdb_test "continue" "" ""
 }
@@ -412,14 +367,9 @@ if {![gdb_skip_float_test "print print_s
 }
 
 #call compute_with_small_structs(20)
-send_gdb "print compute_with_small_structs(20)\n"
-gdb_expect {
-    -re ".*\[0-9\]+ =.*$gdb_prompt $" {
-        pass "print compute_with_small_structs(20)"
-      }
-    -re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
-    timeout           { fail "(timeout) compute_with_small_structs(20)" }
-  }
+gdb_test "print compute_with_small_structs(20)" \
+    "\[0-9\]+ = void" \
+    "print compute_with_small_structs(20)"
 
 
 #call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 
@@ -456,12 +406,9 @@ if { [istarget "hppa*-*-hpux*"] } {
     # FIXME: use step for hppa* testing for now
     # guo 990621
     #
-    send_gdb "step\n"
-    gdb_expect {
-        -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"}
-        -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
-        timeout { fail "step into print_long_arg_list (timeout)" }
-    }
+    gdb_test "step" \
+	"print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);" \
+	"step into print_long_arg_list"
 } else {
 
     # We can't just assume that a "step" will get us into
@@ -472,21 +419,20 @@ if { [istarget "hppa*-*-hpux*"] } {
     # The short match case below handles cases where a buffer
     # overflows or something, and expect can't deal with the full
     # line.  Perhaps a more elegant solution exists... -sts 1999-08-17
-    send_gdb "continue\n"
     if {![gdb_skip_float_test "step into print_long_arg_list"]} {
-	gdb_expect {
-	    -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" { pass "step into print_long_arg_list" }
-	    -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list (short match)"}
-	    -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
-	    timeout { fail "step into print_long_arg_list (timeout)" }
+	gdb_test_multiple "continue" "step into print_long_arg_list" {
+	    -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
+		pass "step into print_long_arg_list"
+	    }
+	    -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
+		pass "step into print_long_arg_list (short match)"
+	    }
 	}
     } else {
 	# If skipping float tests, don't expect anything in arg list.
-	gdb_expect {
-	    -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" }
-	    -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
-	    timeout { fail "step into print_long_arg_list (timeout)" }
-	}
+	gdb_test "continue" \
+	    "print_long_arg_list \\(.*\\).*" \
+	    "step into print_long_arg_list"
     }
 }
 
@@ -558,29 +504,15 @@ if ![gdb_skip_stdio_test "continuing to 
 }
 
 #step
-    send_gdb "step\n"
-    gdb_expect {
-        -re "
-init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
-                            pass "step into init_bit_flags_combo"}
-        -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
-        timeout { fail "step into init_bit_flags_combo (timeout)" }
-    }
+gdb_test "step" \
+    "init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;" \
+    "step into init_bit_flags_combo"
 
 #call print_bit_flags_combo(*bit_flags_combo)
 if ![gdb_skip_stdio_test "continuing to 1300"] {
-    send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
-    gdb_expect {
-	-re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" {
-	    pass "print print_bit_flags_combo from init_bit_flags_combo"
-	}
-	-re ".*$gdb_prompt $" {
-	    fail "print print_bit_flags_combo from init_bit_flags_combo" 
-	}
-	timeout           {
-	    fail "(timeout) print_bit_flags_combo from init_bit_flags_combo" 
-	}
-    }
+    gdb_test "print print_bit_flags_combo(*bit_flags_combo)" \
+	"alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*" \
+	"print print_bit_flags_combo from init_bit_flags_combo"
 }
 
 
@@ -655,18 +587,9 @@ gdb_test continue "Continuing\\..*main \
 
 #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
 if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
-    send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
-    gdb_expect {
-	-re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
-	    pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
-	}
-	-re ".*$gdb_prompt $" { 
-	    fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" 
-	}
-	timeout           { 
-	    fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" 
-	}
-    }
+    gdb_test "print sum_struct_print(10,*struct1,*struct2,*struct3,*struct4)" \
+	"Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*" \
+	"print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
 }
 
 
@@ -685,18 +608,9 @@ if ![gdb_skip_stdio_test "print print_st
 }
 
 if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
-    send_gdb "print print_one_large_struct(*list1)\n"
-    gdb_expect {
-	-re ".*         4         1.*$gdb_prompt $" {
-	    pass "print print_one_large_struct(*list1)"
-	}
-	-re ".*$gdb_prompt $" {
-	    fail "print print_one_large_struct(*list1)"
-	}
-	timeout           {
-	    fail "(timeout) print_one_large_struct(*list1)"
-	}
-    }
+    gdb_test "print print_one_large_struct(*list1)" \
+	"         4         1.*" \
+	"print print_one_large_struct(*list1)"
 }
 
 set timeout $oldtimeout
Index: callfuncs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.exp,v
retrieving revision 1.34
diff -u -p -r1.34 callfuncs.exp
--- callfuncs.exp	5 May 2010 18:06:57 -0000	1.34
+++ callfuncs.exp	22 May 2010 21:15:10 -0000
@@ -58,24 +58,19 @@ if [target_info exists gdb,cannot_call_f
 proc set_lang_c {} {
     global gdb_prompt
 
-    send_gdb "set language c\n"
-    gdb_expect {
-	-re ".*$gdb_prompt $" {}
-	timeout { fail "set language c (timeout)" ; return 0; }
-    }
+    gdb_test_no_output "set language c" 
 
-    send_gdb "show language\n"
-    gdb_expect {
+    gdb_test_multiple "show language" "set language to \"c\"" {
 	-re ".* source language is \"c\".*$gdb_prompt $" {
 	    pass "set language to \"c\""
 	    return 1
 	}
 	-re ".*$gdb_prompt $" {
-	    fail "setting language to \"c\""
+	    fail "set language to \"c\""
 	    return 0
 	}
 	timeout {
-	    fail "can't show language (timeout)"
+	    fail "(timeout) set language to \"c\""
 	    return 0
 	}
     }
Index: call-rt-st.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-rt-st.exp,v
retrieving revision 1.27
diff -u -p -r1.27 call-rt-st.exp
--- call-rt-st.exp	5 May 2010 18:06:57 -0000	1.27
+++ call-rt-st.exp	22 May 2010 21:15:10 -0000
@@ -64,14 +64,9 @@ if [target_info exists gdb,cannot_call_f
 proc set_lang_c {} {
     global gdb_prompt
 
-    send_gdb "set language c\n"
-    gdb_expect {
-	-re ".*$gdb_prompt $" {}
-	timeout { fail "set language c (timeout)" ; return 0; }
-    }
+    gdb_test_no_output "set language c"
 
-    send_gdb "show language\n"
-    gdb_expect {
+    gdb_test_multiple "show language" "set language to \"c\"" {
 	-re ".* source language is \"c\".*$gdb_prompt $" {
 	    pass "set language to \"c\""
 	    return 1
@@ -93,9 +88,9 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
 
 
 if ![runto_main] then {
@@ -108,29 +103,17 @@ gdb_test "break loop_count" \
     "Breakpoint.* file .*call-rt-st.c, line 128\\." \
     "breakpoint loop_count"
 
+gdb_test "continue" \
+    "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+" \
+    "continue to loop_count"
 
-send_gdb "continue\n"
-gdb_expect {
- -re  "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
-                 pass "continue to loop_count"}
-      -re ".*$gdb_prompt $" { fail "continue to loop_count"}           
-      timeout           { fail "(timeout) continue to loop_count"}
-}
-
-send_gdb "finish\n"
-gdb_expect {
-    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" {
+gdb_test_multiple "finish" "finish out from loop count" {
+    -re "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" {
 	pass "finish out from loop_count (line 777)"
     }
     -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:775\[ \t\r\n\]+775\[\t \]+loop_count.*$gdb_prompt $" {
 	pass "finish out from loop_count (line 775)"
     }
-    -re ".*$gdb_prompt $" {
-	fail "finish out from loop_count"
-    }
-    timeout {
-	fail "finish out from loop_count (timeout)"
-    }
 }
 
 # Ask GDB to print the value of EXPR, and expect to see the regexp
@@ -142,20 +125,13 @@ proc print_struct_call { expr result } {
     global gdb_prompt
 
     set command "print $expr"
-    send_gdb "${command}\n"
-    gdb_expect {
+    gdb_test_multiple "${command}" "${command}" {
         -re "$result\[\r\n\]+$gdb_prompt $" {
             pass "$command"
         }
         -re "Function return value unknown.\[\r\n\]+$gdb_prompt $" {
             unsupported "$command"
         }
-        -re "$gdb_prompt $" {
-            fail "$command"
-        }
-        timeout {
-            fail "$command (timeout)"
-        }
     }
 }
 
Index: call-signal-resume.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-signal-resume.exp,v
retrieving revision 1.4
diff -u -p -r1.4 call-signal-resume.exp
--- call-signal-resume.exp	5 May 2010 18:06:57 -0000	1.4
+++ call-signal-resume.exp	22 May 2010 21:15:10 -0000
@@ -53,24 +53,20 @@ if [target_info exists gdb,cannot_call_f
 }
 
 proc get_dummy_frame_number { } {
-  global gdb_prompt
+    global gdb_prompt
 
-  send_gdb "bt\n"
-  gdb_expect {
-    -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $"
-      {
-	return $expect_out(1,string)
-      }
-    -re "$gdb_prompt $"
-      {
-	return ""
-      }
-    timeout
-      {
-	return ""
-      }
-  }
-  return ""
+    gdb_test_multiple "bt" "backtrace" {
+	-re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
+	    return $expect_out(1,string)
+	}
+	-re "$gdb_prompt $" {
+	    return ""
+	}
+	timeout {
+	    return ""
+	}
+    }
+    return ""
 }
 
 # Start with a fresh gdb.
Index: call-strs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-strs.exp,v
retrieving revision 1.15
diff -u -p -r1.15 call-strs.exp
--- call-strs.exp	5 May 2010 18:06:57 -0000	1.15
+++ call-strs.exp	22 May 2010 21:15:10 -0000
@@ -58,24 +58,19 @@ if [target_info exists gdb,cannot_call_f
 proc set_lang_c {} {
     global gdb_prompt
 
-    send_gdb "set language c\n"
-    gdb_expect {
-	-re ".*$gdb_prompt $" {}
-	timeout { fail "set language c (timeout)" ; return 0; }
-    }
+    gdb_test_no_output "set language c"
 
-    send_gdb "show language\n"
-    gdb_expect {
+    gdb_test_multiple "show language" "set language to c" {
 	-re ".* source language is \"c\".*$gdb_prompt $" {
 	    pass "set language to \"c\""
 	    return 1
 	}
 	-re ".*$gdb_prompt $" {
-	    fail "setting language to \"c\""
+	    fail "set language to \"c\""
 	    return 0
 	}
 	timeout {
-	    fail "can't show language (timeout)"
+	    fail "(timeout) set language to \"c\""
 	    return 0
 	}
     }
@@ -89,9 +84,9 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
 
 if ![runto_main] then {
     perror "couldn't run to breakpoint"
@@ -102,163 +97,81 @@ set prev_timeout $timeout
 set timeout 120
 
 #step
-send_gdb "step\n"
-gdb_expect {
-        -re ".*strcpy\\(buf, \"test string\"\\);.*$gdb_prompt $" {pass "step after assignment to s"}
-        -re ".*$gdb_prompt $" { fail "step after assignment to s" }
-        timeout { fail "step after assignment to s (timeout)" }
-    }
-
+gdb_test "step" \
+    "strcpy\\(buf, \"test string\"\\);" \
+    "step after assignment to s"
 
 #next
-send_gdb "next\n"
-gdb_expect {
-        -re ".*str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);.*$gdb_prompt $" {pass "next over strcpy"}
-        -re ".*$gdb_prompt $" { fail "next over strcpy" }
-        timeout { fail "next over strcpy (timeout)" }
-    }
+gdb_test "next" \
+    "str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);" \
+    "next over strcpy"
 
 #print buf
-send_gdb "print buf\n"
-gdb_expect {
-    -re ".*\"test string\",.*repeats 88 times.*$gdb_prompt $" {
-        pass "print buf"
-      }
-    -re ".*$gdb_prompt $" { fail "print buf" }
-    timeout           { fail "(timeout) print buf" }
-  }
-
+gdb_test "print buf" \
+    "\"test string\",.*repeats 88 times.*"
 
 #print s
-send_gdb "print s\n"
-gdb_expect {
-    -re ".*= \"test string\".*$gdb_prompt $" {
-        pass "print s"
-      }
-    -re ".*$gdb_prompt $" { fail "print s" }
-    timeout           { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
-  }
-
+gdb_test "print s" \
+    " = \"test string\".*"
 
 #print str_func1(s)
 if ![gdb_skip_stdio_test "print str_func1(s)"] {
-    send_gdb "print  str_func1(s)\n"
-    gdb_expect {
-	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-	    pass "print str_func1(s)"
-	}
-	-re ".*$gdb_prompt $" { fail "print str_func1(s)" }
-	timeout               { fail "(timeout) print str_func1(s)" }
-    }
+    gdb_test "print  str_func1(s)" \
+	"first string arg is: test string.*\"test string\".*"
 }
 
-
 #print str_func1("test string")
 if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
-    send_gdb "print  str_func1(\"test string\")\n"
-    gdb_expect {
-	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-	    pass "print str_func1(\"test string\")"
-	}
-	-re ".*$gdb_prompt $" { fail "print str_func1(\"test string\")" }
-	timeout     { fail "(timeout) print str_func1(\"test string\")" }
-    }
+    gdb_test "print  str_func1(\"test string\")" \
+	"first string arg is: test string.*\"test string\".*"
 }
 
 #call str_func1(s)
 if ![gdb_skip_stdio_test "call str_func1(s)"] {
-    send_gdb "call  str_func1(s)\n"
-    gdb_expect {
-	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-	    pass "call str_func1(s)"
-	}
-	-re ".*$gdb_prompt $" { fail "call str_func1(s)" }
-	timeout               { fail "(timeout) call str_func1(s)" }
-    }
+    gdb_test "call  str_func1(s)" \
+	"first string arg is: test string.*\"test string\".*"
 }
 
 #call str_func1("test string")
 if ![gdb_skip_stdio_test "call str_func1 (...)"] {
-    send_gdb "call  str_func1(\"test string\")\n"
-    gdb_expect {
-	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-	    pass "call str_func1(\"test string\")"
-	}
-	-re ".*$gdb_prompt $" { fail "call str_func1(\"test string\")" }
-	timeout     { fail "(timeout) call str_func1(\"test string\")" }
-    }
+    gdb_test "call  str_func1(\"test string\")" \
+	"first string arg is: test string.*\"test string\".*"
 }
 
 #print str_func1(buf)
 if ![gdb_skip_stdio_test "print str_func1(buf)"] {
-    send_gdb "print  str_func1(buf)\n"
-    gdb_expect {
-	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-	    pass "print str_func1(buf)"
-	}
-	-re ".*$gdb_prompt $" { fail "print str_func1(buf)" }
-	timeout               { fail "(timeout) print str_func1(buf)" }
-    }
+    gdb_test "print  str_func1(buf)" \
+	"first string arg is: test string.*\"test string\".*"
 }
 
 #call str_func1(buf)
 if ![gdb_skip_stdio_test "call str_func1(buf)"] {
-    send_gdb "call str_func1(buf)\n"
-    gdb_expect {
-	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-	    pass "call str_func1(buf)"
-	}
-	-re ".*$gdb_prompt $" { fail "call str_func1(buf)" }
-	timeout               { fail "(timeout) call str_func1(buf)" }
-    }
+    gdb_test "call str_func1(buf)" \
+	"first string arg is: test string.*\"test string\".*"
 }
 
 #print str_func("a","b","c","d","e","f","g")
 if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
-    send_gdb "print  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
-    gdb_expect {
-	-re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
-	    pass "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
-	}
-	-re ".*$gdb_prompt $" { fail "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-	timeout           { fail "(timeout) print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-    }
+    gdb_test "print  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
+	"first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*"
 }
 
 #call str_func("a","b","c","d","e","f","g")
 if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
-    send_gdb "call  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
-    gdb_expect {
-	-re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
-	    pass "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
-	}
-	-re ".*$gdb_prompt $" { fail "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-	timeout           { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-    }
+    gdb_test "call  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
+	"first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*"
 }
 
 #print str_func(s,s,s,s,s,s,s)
 if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
-    send_gdb "print  str_func(s,s,s,s,s,s,s)\n"
-    gdb_expect {
-	-re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
-	    pass "print str_func(s,s,s,s,s,s,s)"
-	}
-	-re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s)" }
-	timeout     { fail "(timeout) print str_func(s,s,s,s,s,s,s)" }
-    }
+    gdb_test "print  str_func(s,s,s,s,s,s,s)" \
+	"first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
 }
 
 #call str_func(s,s,s,s,s,s,s)
 if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
-    send_gdb "call  str_func(s,s,s,s,s,s,s)\n"
-    gdb_expect {
-	-re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
-	    pass "call str_func(s,s,s,s,s,s,s)"
-	}
-	-re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s)" }
-	timeout               { fail "(timeout) call str_func(s,s,s,s,s,s,s)" }
-    }
+    gdb_test "call  str_func(s,s,s,s,s,s,s)" \
+	"first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
 }
 
 gdb_exit
Index: catch-syscall.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/catch-syscall.exp,v
retrieving revision 1.6
diff -u -p -r1.6 catch-syscall.exp
--- catch-syscall.exp	5 May 2010 18:06:57 -0000	1.6
+++ catch-syscall.exp	22 May 2010 21:15:10 -0000
@@ -278,15 +278,7 @@ proc do_syscall_tests {} {
     global gdb_prompt srcdir
 
     # First, we need to set GDB datadir.
-    send_gdb "set data-directory $srcdir/..\n"
-    gdb_expect 10 {
-	-re "$gdb_prompt $" {
-	    verbose "Setting GDB datadir to $srcdir/..." 2
-	}
-	timeout {
-	    error "Couldn't set GDB datadir."
-	}
-    }
+    gdb_test_no_output "set data-directory $srcdir/.."
 
     # Verify that the 'catch syscall' help is available
     set thistest "help catch syscall"
Index: charset.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/charset.exp,v
retrieving revision 1.23
diff -u -p -r1.23 charset.exp
--- charset.exp	5 May 2010 18:06:57 -0000	1.23
+++ charset.exp	22 May 2010 21:15:10 -0000
@@ -374,15 +374,7 @@ foreach target_charset $charset_subset {
 	set param target-charset
 	set L ""
     }
-    send_gdb "set $param $target_charset\n" 
-    gdb_expect {
-        -re "$gdb_prompt $" {
-            pass "set $param $target_charset"
-        }
-        timeout {
-            fail "set $param $target_charset (timeout)"
-        }
-    }
+    gdb_test_no_output "set $param $target_charset"
 
     # Try printing the null character.  There seems to be a bug in
     # gdb_test that requires us to use gdb_expect here.
Index: checkpoint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/checkpoint.exp,v
retrieving revision 1.13
diff -u -p -r1.13 checkpoint.exp
--- checkpoint.exp	5 May 2010 18:06:57 -0000	1.13
+++ checkpoint.exp	22 May 2010 21:15:10 -0000
@@ -337,18 +337,9 @@ gdb_load ${binfile}
 runto_main
 gdb_breakpoint $break1_loc
 
-send_gdb "commands\n"
-send_gdb "  silent\n"
-send_gdb "  if (lines % 2)\n"
-send_gdb "    checkpoint\n"
-send_gdb "  end\n"
-send_gdb "  continue\n"
-send_gdb "end\n"
-
-gdb_expect {
-    -re ".*$gdb_prompt $" { pass "set checkpoint breakpoint" }
-    timeout { fail "(timeout) set checkpoint breakpoint" }
-}
+gdb_test "commands\nsilent\nif (lines % 2)\ncheckpoint\nend\n  continue\nend" \
+    "" \
+    "set checkpoint breakpoint"
 
 set prev_timeout $timeout
 set timeout [expr $timeout + 120]
Index: commands.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/commands.exp,v
retrieving revision 1.34
diff -u -p -r1.34 commands.exp
--- commands.exp	5 May 2010 18:06:57 -0000	1.34
+++ commands.exp	22 May 2010 21:15:10 -0000
@@ -136,15 +136,13 @@ proc if_while_breakpoint_command_test {}
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #1"
 
-    send_gdb "commands\n"
-    gdb_expect {
-	-re "End with" {
-	    pass "commands in if_while_breakpoint_command_test"
-	}
-        default {
-	    fail "(timeout or eof) commands in if_while_breakpoint_command_test"
+    gdb_test_multiple "commands" \
+	"commands in if_while_breakpoint_command_test" {
+	    -re "End with" {
+		pass "commands in if_while_breakpoint_command_test"
+	    }
 	}
-    }
+
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
     gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
 	    "" \
@@ -182,21 +180,18 @@ proc infrun_breakpoint_command_test {} {
 # to get around a synchronization problem in expect.
 # part1: issue the gdb command "commands"
 # part2: send the list of commands
-    send_gdb "commands\n"
-    gdb_expect {
-	-re "End with" {
-	    pass "commands in infrun_breakpoint_command_test #1"
-	}
-        default {
-	    fail "(timeout or eof) commands in infrun_breakpoint_command_test"
+    gdb_test_multiple "commands" \
+	"commands in infrun_breakpoint_command_test #1" {
+	    -re "End with" {
+		pass "commands in infrun_breakpoint_command_test #1"
+	    }
 	}
-    }
     gdb_test "step\nstep\nstep\nstep\nend" "" \
 	"commands in infrun_breakpoint_command_test #2"
 
-	gdb_test "continue" \
-		"Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[      \]*if \\(value > 1\\) \{.*\[0-9\]*\[      \]*value \\*= factorial \\(value - 1\\);.*" \
-		"continue in infrun_breakpoint_command_test"
+    gdb_test "continue" \
+	"Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[      \]*if \\(value > 1\\) \{.*\[0-9\]*\[      \]*value \\*= factorial \\(value - 1\\);.*" \
+	"continue in infrun_breakpoint_command_test"
 
     gdb_stop_suppressing_tests;
 }
@@ -229,15 +224,13 @@ proc user_defined_command_test {} {
 
     gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test"
 
-    send_gdb "define mycommand\n"
-    gdb_expect {
-	-re "End with"  {
-	    pass "define mycommand in user_defined_command_test"
-	}
-        default {
-	    fail "(timeout or eof) define mycommand in user_defined_command_test"
+    gdb_test_multiple "define mycommand" \
+	"define mycommand in user_defined_command_test" {
+	    -re "End with"  {
+		pass "define mycommand in user_defined_command_test"
+	    }
 	}
-    }
+
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
     gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
 	    "" \
@@ -282,52 +275,37 @@ proc watchpoint_command_test {} {
     #
     set wp_id -1
 
-    send_gdb "watch local_var\n"
-    gdb_expect {
-        -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" {
+    gdb_test_multiple "watch local_var" "watch local_var" {
+        -re "\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" {
             set wp_id $expect_out(1,string)
             pass "watch local_var"
         }
-        -re "$gdb_prompt $"\
-            {fail "watch local_var"}
-        timeout {fail "(timeout) watch local_var"}
     }
 
     if {$wp_id == -1} {return}
 
-    send_gdb "commands $wp_id\n"
-    gdb_expect {
-      -re "Type commands for breakpoint.*, one per line.*>" {
-	  pass "begin commands on watch"
-      }
-      -re "$gdb_prompt $" {fail "begin commands on watch"}
-      timeout             {fail "(timeout) begin commands on watch"}
-    }
-    send_gdb "print value\n"
-    gdb_expect {
-	-re ">"               {pass "add print command to watch"}
-	-re "$gdb_prompt $"   {fail "add print command to watch"}
-	timeout               {fail "(timeout) add print command to watch"}
-    }
-    send_gdb "continue\n"
-    gdb_expect {
-	-re ">"               {pass "add continue command to watch"}
-	-re "$gdb_prompt $"   {fail "add continue command to watch"}
-	timeout               {fail "(timeout) add continue command to watch"}
+    gdb_test_multiple "commands $wp_id\n" "begin commands on watch" {
+	-re "Type commands for breakpoint.*, one per line.*>$" {
+	    pass "begin commands on watch"
+	}
     }
-    send_gdb "end\n"
-    gdb_expect {
-	-re "$gdb_prompt $"   {pass "end commands on watch"}
-	timeout               {fail "(timeout) end commands on watch"}
+    gdb_test_multiple "print value" "add print command to watch" {
+	-re ">$" {
+	    pass "add print command to watch"
+	}
     }
-    send_gdb "continue\n"
-    gdb_expect {
-	-re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(57|82).*$gdb_prompt $" {
-	    pass "continue with watch"
+    gdb_test_multiple "continue" "add continue command to watch" {
+	-re ">$" {
+	    pass "add continue command to watch"
 	}
-	-re "$gdb_prompt $"   {fail "continue with watch"}
-	timeout               {fail "(timeout) continue with watch"}
     }
+    gdb_test "end" \
+	"" \
+	"end commands on watch"
+
+    gdb_test "continue" \
+	"Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(57|82).*" \
+	"continue with watch"
 }
 
 proc test_command_prompt_position {} {
@@ -448,41 +426,35 @@ proc bp_deleted_in_command_test {} {
              "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
              "breakpoint in bp_deleted_in_command_test"
     
-    send_gdb "commands\n"
-    gdb_expect {
-      -re "Type commands for breakpoint.*>" {
+    gdb_test_multiple "commands" "begin commands in bp_deleted_in_command_test" {
+      -re "Type commands for breakpoint.*>$" {
           pass "begin commands in bp_deleted_in_command_test"
       }
-      -re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
-      timeout             {fail "(timeout) begin commands bp_deleted_in_command_test"}
     }
-    send_gdb "silent\n"
-    gdb_expect {
-        -re ">"               {pass "add silent command"}
-        -re "$gdb_prompt $"   {fail "add silent command"}
-        timeout               {fail "(timeout) add silent command"}
+    gdb_test_multiple "silent" "add silent command" {
+        -re ">$" {
+	    pass "add silent command"
+	}
     }
-    send_gdb "clear factorial\n"
-    gdb_expect {
-        -re ">"               {pass "add clear command"}
-        -re "$gdb_prompt $"   {fail "add clear command"}
-        timeout               {fail "(timeout) add clear command"} }
-    send_gdb "printf \"factorial command-list executed\\n\"\n"
-    gdb_expect {
-        -re ">"               {pass "add printf command"}
-        -re "$gdb_prompt $"   {fail "add printf command"}
-        timeout               {fail "(timeout) add printf command"}
+    gdb_test_multiple "clear factorial" "add clear command" {
+        -re ">$" {
+	    pass "add clear command"
+	}
     }
-    send_gdb "cont\n"
-    gdb_expect {
-        -re ">"               {pass "add cont command"}
-        -re "$gdb_prompt $"   {fail "add cont command"}
-        timeout               {fail "(timeout) add cont command"} }
-    send_gdb "end\n"
-    gdb_expect {
-        -re "$gdb_prompt $"   {pass "end commands"}
-        timeout               {fail "(timeout) end commands"}
+    gdb_test_multiple "printf \"factorial command-list executed\\n\"" \
+	"add printf command" {
+        -re ">$" {
+	    pass "add printf command"
+	}
+    }
+    gdb_test_multiple "cont" "add cont command" {
+        -re ">$" {
+	    pass "add cont command"
+	}
     }
+    gdb_test "end" \
+	"" \
+	"end commands"
 
     gdb_run_cmd
     gdb_expect {
@@ -515,36 +487,31 @@ proc temporary_breakpoint_commands {} {
 	    "Temporary breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
 	    "breakpoint in temporary_breakpoint_commands"
     
-    send_gdb "commands\n"
-    gdb_expect {
-	-re "Type commands for breakpoint.*>" {
-	    pass "begin commands in bp_deleted_in_command_test"
+    gdb_test_multiple "commands" \
+	"begin commands in bp_deleted_in_command_test" {
+	    -re "Type commands for breakpoint.*>$" {
+		pass "begin commands in bp_deleted_in_command_test"
+	    }
+	}
+    gdb_test_multiple "silent" "add silent tbreak command" {
+	-re ">$" {
+	    pass "add silent tbreak command"
 	}
-	-re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
-	timeout             {fail "(timeout) begin commands bp_deleted_in_command_test"}
     }
-    send_gdb "silent\n"
-    gdb_expect {
-	-re ">"               {pass "add silent tbreak command"}
-	-re "$gdb_prompt $"   {fail "add silent tbreak command"}
-	timeout               {fail "(timeout) add silent tbreak command"}
-     }
-    send_gdb "printf \"factorial tbreak commands executed\\n\"\n"
-    gdb_expect {
-	-re ">"               {pass "add printf tbreak command"}
-	-re "$gdb_prompt $"   {fail "add printf tbreak command"}
-	timeout               {fail "(timeout) add printf tbreak command"}
-     }
-    send_gdb "cont\n"
-    gdb_expect {
-	-re ">"               {pass "add cont tbreak command"}
-	-re "$gdb_prompt $"   {fail "add cont tbreak command"}
-	timeout               {fail "(timeout) add cont tbreak command"} }
-    send_gdb "end\n"
-    gdb_expect {
-	-re "$gdb_prompt $"   {pass "end tbreak commands"}
-	timeout               {fail "(timeout) end tbreak commands"}
-     }
+    gdb_test_multiple "printf \"factorial tbreak commands executed\\n\"\n" \
+	"add printf tbreak command" {
+	    -re ">$" {
+		pass "add printf tbreak command"
+	    }
+	}
+    gdb_test_multiple "cont" "add cont tbreak command" {
+	-re ">$" {
+	    pass "add cont tbreak command"
+	}
+    }
+    gdb_test "end" \
+	"" \
+	"end tbreak commands"
 
     gdb_run_cmd
     gdb_expect {
Index: condbreak.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/condbreak.exp,v
retrieving revision 1.17
diff -u -p -r1.17 condbreak.exp
--- condbreak.exp	5 May 2010 18:06:57 -0000	1.17
+++ condbreak.exp	22 May 2010 21:15:10 -0000
@@ -205,39 +205,25 @@ gdb_test "continue" "Continuing\\..*Brea
 # take precedence over real code.
 #
 # Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
-send_gdb "continue\n"
-gdb_expect {
+gdb_test_multiple "continue" "run until breakpoint at marker1" {
     -re  "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
 	pass "run until breakpoint at marker1"
     }
     -re  "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
 	xfail "run until breakpoint at marker1"
     }
-    -re "$gdb_prompt $" {
-	fail "run until breakpoint at marker1"
-    }
-    timeout {
-	fail "(timeout) run until breakpoint at marker1"
-    }
 }
 
 # run until the breakpoint at marker2
 # Same issues here as above.
 setup_xfail hppa2.0w-*-* 11512CLLbs
-send_gdb "continue\n"
-gdb_expect {
+gdb_test_multiple "continue" "run until breakpoint at marker2" {
     -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
 	pass "run until breakpoint at marker2"
     }
     -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
 	xfail "run until breakpoint at marker2"
     }
-    -re "$gdb_prompt $" {
-	fail "run until breakpoint at marker2"
-    }
-    timeout {
-	fail "(timeout) run until breakpoint at marker2"
-    }
 }
 
 # Test combinations of conditional and thread-specific breakpoints.
Index: cond-expr.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/cond-expr.exp,v
retrieving revision 1.10
diff -u -p -r1.10 cond-expr.exp
--- cond-expr.exp	1 Jan 2010 07:32:00 -0000	1.10
+++ cond-expr.exp	22 May 2010 21:15:10 -0000
@@ -55,57 +55,26 @@ if ![runto_main] then {
     continue
 }
 
-send_gdb "print (2 ? 3 : 4)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 3.*$gdb_prompt $" {
-        pass "print value of cond expr (const true)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (const true)" }
-    timeout           { fail "(timeout) print value of cond expr (const true)" }
-  }
-
-send_gdb "print (0 ? 3 : 4)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 4.*$gdb_prompt $" {
-        pass "print value of cond expr (const false)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (const false)" }
-    timeout           { fail "(timeout) print value of cond expr (const false)" }
-  }
+gdb_test "print (2 ? 3 : 4)" "\[0-9\]* = 3" \
+    "print value of cond expr (const true)"
+
+gdb_test "print (0 ? 3 : 4)" "\[0-9\]* = 4" \
+    "print value of cond expr (const false)"
 
 gdb_test "set variable x=14" "" "set variable x=14"
 gdb_test "set variable y=2" "" "set variable y=2"
 gdb_test "set variable z=3" "" "set variable z=3"
 
-send_gdb "print (x ? y : z)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 2.*$gdb_prompt $" {
-        pass "print value of cond expr (var true)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (var true)" }
-    timeout           { fail "(timeout) print value of cond expr (var true)" }
-  }
+gdb_test "print (x ? y : z)" "\[0-9\]* = 2" \
+    "print value of cond expr (var true)"
 
 gdb_test "set variable x=0" "" "set variable x=0"
 
-send_gdb "print (x ? y : z)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 3.*$gdb_prompt $" {
-        pass "print value of cond expr (var false)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (var false)" }
-    timeout           { fail "(timeout) print value of cond expr (var false)" }
-  }
-
-
-send_gdb "whatis (0 ? 3 : 4)\n"
-gdb_expect {
-    -re "type = int.*$gdb_prompt $" {
-        pass "print whatis of cond expr"
-      }
-    -re ".*$gdb_prompt $" { fail "print whatis of cond expr" }
-    timeout           { fail "(timeout) print whatis of cond expr" }
-  }
+gdb_test "print (x ? y : z)" "\[0-9\]* = 3" \
+    "print value of cond expr (var false)"
+
+gdb_test "whatis (0 ? 3 : 4)" "type = int" \
+    "print whatis of cond expr"
 
 
 
Index: consecutive.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/consecutive.exp,v
retrieving revision 1.12
diff -u -p -r1.12 consecutive.exp
--- consecutive.exp	5 May 2010 18:06:57 -0000	1.12
+++ consecutive.exp	22 May 2010 21:15:10 -0000
@@ -60,27 +60,17 @@ gdb_test "continue" "Breakpoint $decimal
 set bp_addr 0
 set stop_addr 0
 
-send_gdb "x /2i \$pc\n"
-gdb_expect {
+gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" {
     -re "=> $hex.*${nl}   ($hex).*$gdb_prompt $" {
 	set bp_addr $expect_out(1,string)
 	pass "get breakpoint address for foo"
     }
-    -re ".*$gdb_prompt $" {
-	fail "get breakpoint address for foo"
-	return 0;
-    }
-    timeout {
-	fail "get breakpoint address for foo (timeout)"
-	return 0;
-    }
 }
 
 gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
 	"set bp, 2nd instr"
 
-send_gdb "step\n"
-gdb_expect {
+gdb_test_multiple "step" "stopped at bp, 2nd instr" {
     -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
 	set stop_addr $expect_out(1,string)
 	if [eval expr "$bp_addr == $stop_addr"] then {
@@ -89,12 +79,5 @@ gdb_expect {
 	    fail "stopped at bp, 2nd instr (wrong address)"
 	}
     }
-    -re ".*$gdb_prompt $" {
-	fail "stopped at bp, 2nd instr"
-    }
-    timeout {
-	fail "stopped at bp, 2nd instr (timeout)"
-
-    }
 }
 
Index: constvars.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/constvars.exp,v
retrieving revision 1.22
diff -u -p -r1.22 constvars.exp
--- constvars.exp	5 May 2010 18:06:57 -0000	1.22
+++ constvars.exp	22 May 2010 21:15:10 -0000
@@ -90,52 +90,26 @@ proc local_compiler_xfail_check_2 { } {
     }
 }
 
-send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+gdb_test "break marker1" "Breakpoint $decimal at .*" 
 
-    send_gdb "cont\n"
-    gdb_expect {
-        -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
-            send_gdb "up\n"
-            gdb_expect {
-		-re ".*main.*$gdb_prompt $" {
-		    pass "up from marker1"
-		}
-                -re ".*$gdb_prompt $" {
-		    fail "up from marker1"
-		}
-                timeout { fail "up from marker1 (timeout)" }
-            }
-        }
-        -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
-	    fail "continue to marker1 (demangling)"
-            send_gdb "up\n"
-            gdb_expect {
-		-re ".*main.*$gdb_prompt $" {
-		    pass "up from marker1"
-		}
-                -re ".*$gdb_prompt $" {
-		    fail "up from marker1"
-		}
-                timeout { fail "up from marker1 (timeout)" }
-            }
-        }
-        -re "$gdb_prompt $" { fail "continue to marker1"  }
-        timeout { fail "(timeout) continue to marker1"  }
+gdb_test_multiple "cont" "up from marker1" {
+    -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+	pass "continue to marker1"
+	gdb_test "up" " main .*" "up from marker1"
     }
+    -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
+	fail "continue to marker1 (demangling)"
+	gdb_test "up" " main .*" "up from marker1"
+    }
+}
 
 # test function parameters
 
 local_compiler_xfail_check
 local_compiler_xfail_check_2
 
-send_gdb "ptype qux1\n"
-gdb_expect {
-    -re "type = int \\(const char, const char, const char \\*, char \\* const\\).*$gdb_prompt $" {
-        pass "ptype qux1"
-    }
-    -re ".*$gdb_prompt $" { fail "ptype qux1" }
-    timeout           { fail "(timeout) ptype qux1" }
-}   
+gdb_test "ptype qux1" \
+    "type = int \\(const char, const char, const char \\*, char \\* const\\).*"
 
 # test vars and pointers
 
Index: corefile.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/corefile.exp,v
retrieving revision 1.20
diff -u -p -r1.20 corefile.exp
--- corefile.exp	5 May 2010 18:06:57 -0000	1.20
+++ corefile.exp	22 May 2010 21:15:10 -0000
@@ -123,8 +123,7 @@ gdb_load ${binfile}
 
 # Test basic corefile recognition via core-file command.
 
-send_gdb "core-file $corefile\n"
-gdb_expect {
+gdb_test_multiple "core-file $corefile" "core-file command" {
     -re ".* program is being debugged already.*y or n. $" {
 	# gdb_load may connect us to a gdbserver.
 	send_gdb "y\n"
@@ -139,8 +138,6 @@ gdb_expect {
     -re ".*registers from core file: File in wrong format.* $" {
 	fail "core-file command (could not read registers from core file)"
     }
-    -re ".*$gdb_prompt $"	{ fail "core-file command" }
-    timeout 		{ fail "(timeout) core-file command" }
 }
 
 # Test correct mapping of corefile sections by printing some variables.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test
  2010-05-22 22:33 [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test Michael Snyder
@ 2010-05-23  1:40 ` Pedro Alves
  2010-05-23 20:15   ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-05-23  1:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Snyder

On Saturday 22 May 2010 22:19:30, Michael Snyder wrote:

> 
> Index: call-ar-st.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-ar-st.exp,v
> retrieving revision 1.24
> diff -u -p -r1.24 call-ar-st.exp
> --- call-ar-st.exp      5 May 2010 18:06:57 -0000       1.24
> +++ call-ar-st.exp      22 May 2010 21:15:10 -0000
> @@ -61,24 +61,19 @@ set timeout [expr "$timeout + 60"]
>  proc set_lang_c {} {
>      global gdb_prompt
>  
> -    send_gdb "set language c\n"
> -    gdb_expect {
> -       -re ".*$gdb_prompt $" {}
> -       timeout { fail "set language c (timeout)" ; return 0; }
> -    }
> +    gdb_test_no_output "set language c"
>  
> -    send_gdb "show language\n"
> -    gdb_expect {
> +    gdb_test_multiple "show language" "set language to \"c\"" {
>         -re ".* source language is \"c\".*$gdb_prompt $" {
>             pass "set language to \"c\""
>             return 1
>         }
>         -re ".*$gdb_prompt $" {
> -           fail "setting language to \"c\""
> +           fail "set language to \"c\""
>             return 0
>         }
>         timeout {
> -           fail "can't show language (timeout)"
> +           fail "(timeout) set language to \"c\""
>             return 0
>         }

You'll need to have the pass branch set a variable, and
do the return outside gdb_test_multiple.  This is because
gdb_test_multiple catches other error reasons (the whole purpose
of gdb_test_multiple).  This pattern shows up in several
other files, I'll skip mentioning those from here on.

(I'm not sure whether you've missed the "return 0" on the
"set" test above: it does seem okay to let the "show" test
handle it.)

>  #call compute_with_small_structs(20)
> -send_gdb "print compute_with_small_structs(20)\n"
> -gdb_expect {
> -    -re ".*\[0-9\]+ =.*$gdb_prompt $" {
> -        pass "print compute_with_small_structs(20)"
> -      }
> -    -re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
> -    timeout           { fail "(timeout) compute_with_small_structs(20)" }
> -  }
> +gdb_test "print compute_with_small_structs(20)" \
> +    "\[0-9\]+ = void" \
> +    "print compute_with_small_structs(20)"
>  

You didn't resist changing the expected output here?  :-)

> -    send_gdb "step\n"
> -    gdb_expect {
> -        -re "
> -init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
> -                            pass "step into init_bit_flags_combo"}
> -        -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
> -        timeout { fail "step into init_bit_flags_combo (timeout)" }
> -    }
> +gdb_test "step" \
> +    "init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;" \
> +    "step into init_bit_flags_combo"
>  

Missing .* at end of expected output?  I saw several of
those; I don't know if this was on purpose.

On Saturday 22 May 2010 22:19:30, Michael Snyder wrote:
> +    gdb_test_multiple "bt" "backtrace" {
> +       -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
> +           return $expect_out(1,string)
> +       }
> +       -re "$gdb_prompt $" {
> +           return ""
> +       }
> +       timeout {
> +           return ""
> +       }
> +    }
> +    return ""

Similar remark one of the above, but in this case, there's already a
return outside gdb_test_multiple, so you can remove the last -re and
the timeout handling.

>  if ![gdb_skip_stdio_test "call str_func1(s)"] {
> -    send_gdb "call  str_func1(s)\n"
> -    gdb_expect {
> -       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
> -           pass "call str_func1(s)"
> -       }
> -       -re ".*$gdb_prompt $" { fail "call str_func1(s)" }
> -       timeout               { fail "(timeout) call str_func1(s)" }
> -    }
> +    gdb_test "call  str_func1(s)" \

The previous test output didn't have the extra space.  Could you
remove it?  There are several instances of this.

I've been assuming you've been diffing gdb.sum before/after
these patches; it'd be nice if you mentioned any changes shown by
that diff.

> +       "first string arg is: test string.*\"test string\".*"
>  }

Are you planning on committing the patches that have been
reviewed soon?  I think it would be a good idea to get them in
sooner than later, so that we can see if there are any problems
we may have missed in review, and so we'd avoid propagating the
same mistakes in all these other patches.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test
  2010-05-23  1:40 ` Pedro Alves
@ 2010-05-23 20:15   ` Michael Snyder
  2010-05-23 21:40     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2010-05-23 20:15 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves wrote:
> On Saturday 22 May 2010 22:19:30, Michael Snyder wrote:
> 
>> Index: call-ar-st.exp
>> ===================================================================
>> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-ar-st.exp,v
>> retrieving revision 1.24
>> diff -u -p -r1.24 call-ar-st.exp
>> --- call-ar-st.exp      5 May 2010 18:06:57 -0000       1.24
>> +++ call-ar-st.exp      22 May 2010 21:15:10 -0000
>> @@ -61,24 +61,19 @@ set timeout [expr "$timeout + 60"]
>>  proc set_lang_c {} {
>>      global gdb_prompt
>>  
>> -    send_gdb "set language c\n"
>> -    gdb_expect {
>> -       -re ".*$gdb_prompt $" {}
>> -       timeout { fail "set language c (timeout)" ; return 0; }
>> -    }
>> +    gdb_test_no_output "set language c"
>>  
>> -    send_gdb "show language\n"
>> -    gdb_expect {
>> +    gdb_test_multiple "show language" "set language to \"c\"" {
>>         -re ".* source language is \"c\".*$gdb_prompt $" {
>>             pass "set language to \"c\""
>>             return 1
>>         }
>>         -re ".*$gdb_prompt $" {
>> -           fail "setting language to \"c\""
>> +           fail "set language to \"c\""
>>             return 0
>>         }
>>         timeout {
>> -           fail "can't show language (timeout)"
>> +           fail "(timeout) set language to \"c\""
>>             return 0
>>         }
> 
> You'll need to have the pass branch set a variable, and
> do the return outside gdb_test_multiple.  This is because
> gdb_test_multiple catches other error reasons (the whole purpose
> of gdb_test_multiple).  This pattern shows up in several
> other files, I'll skip mentioning those from here on.

OK, I'll fix it in this instance.  The other instances are
never called, so I'll just remove them.

> 
> (I'm not sure whether you've missed the "return 0" on the
> "set" test above: it does seem okay to let the "show" test
> handle it.)
> 
>>  #call compute_with_small_structs(20)
>> -send_gdb "print compute_with_small_structs(20)\n"
>> -gdb_expect {
>> -    -re ".*\[0-9\]+ =.*$gdb_prompt $" {
>> -        pass "print compute_with_small_structs(20)"
>> -      }
>> -    -re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
>> -    timeout           { fail "(timeout) compute_with_small_structs(20)" }
>> -  }
>> +gdb_test "print compute_with_small_structs(20)" \
>> +    "\[0-9\]+ = void" \
>> +    "print compute_with_small_structs(20)"
>>  
> 
> You didn't resist changing the expected output here?  :-)

Caught me.

> 
>> -    send_gdb "step\n"
>> -    gdb_expect {
>> -        -re "
>> -init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
>> -                            pass "step into init_bit_flags_combo"}
>> -        -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
>> -        timeout { fail "step into init_bit_flags_combo (timeout)" }
>> -    }
>> +gdb_test "step" \
>> +    "init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;" \
>> +    "step into init_bit_flags_combo"
>>  
> 
> Missing .* at end of expected output?  I saw several of
> those; I don't know if this was on purpose.
> 
> On Saturday 22 May 2010 22:19:30, Michael Snyder wrote:
>> +    gdb_test_multiple "bt" "backtrace" {
>> +       -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
>> +           return $expect_out(1,string)
>> +       }
>> +       -re "$gdb_prompt $" {
>> +           return ""
>> +       }
>> +       timeout {
>> +           return ""
>> +       }
>> +    }
>> +    return ""
> 
> Similar remark one of the above, but in this case, there's already a
> return outside gdb_test_multiple, so you can remove the last -re and
> the timeout handling.

OK.

>>  if ![gdb_skip_stdio_test "call str_func1(s)"] {
>> -    send_gdb "call  str_func1(s)\n"
>> -    gdb_expect {
>> -       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
>> -           pass "call str_func1(s)"
>> -       }
>> -       -re ".*$gdb_prompt $" { fail "call str_func1(s)" }
>> -       timeout               { fail "(timeout) call str_func1(s)" }
>> -    }
>> +    gdb_test "call  str_func1(s)" \
> 
> The previous test output didn't have the extra space.  Could you
> remove it?  There are several instances of this.

What extra space are you talking about?

> 
> I've been assuming you've been diffing gdb.sum before/after
> these patches; it'd be nice if you mentioned any changes shown by
> that diff.


I run the test after each change, and note any changes in numbers of
pass/fails.


> 
>> +       "first string arg is: test string.*\"test string\".*"
>>  }
> 
> Are you planning on committing the patches that have been
> reviewed soon?  I think it would be a good idea to get them in
> sooner than later, so that we can see if there are any problems
> we may have missed in review, and so we'd avoid propagating the
> same mistakes in all these other patches.
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test
  2010-05-23 20:15   ` Michael Snyder
@ 2010-05-23 21:40     ` Pedro Alves
  2010-05-24 22:07       ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-05-23 21:40 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

On Sunday 23 May 2010 20:38:48, Michael Snyder wrote:
> >> -    send_gdb "call  str_func1(s)\n"
> >> -    gdb_expect {
> >> -       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
> >> -           pass "call str_func1(s)"
> >> -       }
> >> -       -re ".*$gdb_prompt $" { fail "call str_func1(s)" }
> >> -       timeout               { fail "(timeout) call str_func1(s)" }
> >> -    }
> >> +    gdb_test "call  str_func1(s)" \
> > 
> > The previous test output didn't have the extra space.  Could you
> > remove it?  There are several instances of this.
> 
> What extra space are you talking about?

'pass "call str_func1(s)"' vs 'gdb_test "call  str_func1(s)"'
           ^                                 ^^

Your gdb_test didn't have an explicit message, so the command
string is used as replacement.  If gdb.sum diffing didn't reveal
this, I missed something obvious.  :-)  Anyway, just a nit.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test
  2010-05-23 21:40     ` Pedro Alves
@ 2010-05-24 22:07       ` Michael Snyder
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2010-05-24 22:07 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro Alves wrote:
> On Sunday 23 May 2010 20:38:48, Michael Snyder wrote:
>>>> -    send_gdb "call  str_func1(s)\n"
>>>> -    gdb_expect {
>>>> -       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
>>>> -           pass "call str_func1(s)"
>>>> -       }
>>>> -       -re ".*$gdb_prompt $" { fail "call str_func1(s)" }
>>>> -       timeout               { fail "(timeout) call str_func1(s)" }
>>>> -    }
>>>> +    gdb_test "call  str_func1(s)" \
>>> The previous test output didn't have the extra space.  Could you
>>> remove it?  There are several instances of this.
>> What extra space are you talking about?
> 
> 'pass "call str_func1(s)"' vs 'gdb_test "call  str_func1(s)"'
>            ^                                 ^^
> 
> Your gdb_test didn't have an explicit message, so the command
> string is used as replacement.  If gdb.sum diffing didn't reveal
> this, I missed something obvious.  :-)  Anyway, just a nit.
> 

OK fixed and committed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-24 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-22 22:33 [RFA] gdb.base/c*.exp, send_gdb vs. gdb_test Michael Snyder
2010-05-23  1:40 ` Pedro Alves
2010-05-23 20:15   ` Michael Snyder
2010-05-23 21:40     ` Pedro Alves
2010-05-24 22:07       ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox