This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfa] gdb.base/volatile.exp / varargs.exp: replace send_gdb with gdb_test
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 19 May 2010 13:26:38 -0700
- Subject: [rfa] gdb.base/volatile.exp / varargs.exp: replace send_gdb with gdb_test
2010-05-19 Michael Snyder <msnyder@vmware.com>
* gdb.base/varargs.exp: Replace send_gdb with gdb_test.
* gdb.base/volatile.exp: Replace send_gdb with gdb_test.
Index: varargs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/varargs.exp,v
retrieving revision 1.12
diff -u -p -r1.12 varargs.exp
--- varargs.exp 5 May 2010 18:06:58 -0000 1.12
+++ varargs.exp 19 May 2010 20:23:15 -0000
@@ -62,9 +62,13 @@ 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 "set print sevenbit-strings" "" \
+ "set print sevenbit-strings; ${testfile}"
+gdb_test "set print address off" "" \
+ "set print address off; ${testfile}"
+gdb_test "set width 0" "" \
+ "set width 0; ${testfile}"
+
if [gdb_skip_stdio_test "varargs.exp"] {
# Nothing in this module is testable without printf.
@@ -89,57 +93,25 @@ if { $hp_aCC_compiler } {
gdb_test "set overload-resolution 0" ""
}
-send_gdb "print find_max1(5,1,2,3,4,5)\n"
-gdb_expect {
- -re ".*find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5.*$gdb_prompt $" {
- pass "print find_max1(5,1,2,3,4,5)"
- }
- -re ".*$gdb_prompt $" { fail "print find_max1(5,1,2,3,4,5)" }
- timeout { fail "(timeout) print find_max1(5,1,2,3,4,5)" }
- }
-
-
-
-
-send_gdb "print find_max1(1,3)\n"
-gdb_expect {
- -re ".*find_max\\(1, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3.*$gdb_prompt $" {
- pass "print find_max1(1,3)"
- }
- -re ".*$gdb_prompt $" { fail "print find_max1(1,3)" }
- timeout { fail "(timeout) print find_max1(1,3)" }
- }
-
-
-send_gdb "print find_max1(10,1,2,3,4,5,6,7,8,29,0)\n"
-gdb_expect {
- -re ".*find_max\\(10, 1, 2, 3, 4, 5, 6, 7, 8, 29, 0\\) returns 29\[ \r\n\]+.\[0-9\]+ = 29.*$gdb_prompt $" {
- pass "print find_max1(10,1,2,3,4,5,6,7,8,29,0)"
- }
- -re ".*$gdb_prompt $" { fail "print find_max1(10,1,2,3,4,5,6,7,8,29,0)" }
- timeout { fail "(timeout) print find_max1(10,1,2,3,4,5,6,7,8,29,0)" }
- }
-
-
-
-send_gdb "print find_max2(3,1,2,3)\n"
-gdb_expect {
- -re ".*find_max\\(3, 1, 2, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3.*$gdb_prompt $" {
- pass "print find_max2(3,1,2,3)"
- }
- -re ".*$gdb_prompt $" { fail "print find_max2(3,1,2,3)" }
- timeout { fail "(timeout) print find_max2(3,1,2,3)" }
- }
-
+gdb_test "print find_max1(5,1,2,3,4,5)" \
+ "find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5" \
+ "print find_max1(5,1,2,3,4,5)"
+
+gdb_test "print find_max1(1,3)" \
+ ".*find_max\\(1, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3" \
+ "print find_max1(1,3)"
+
+gdb_test "print find_max1(10,1,2,3,4,5,6,7,8,29,0)" \
+ ".*find_max\\(10, 1, 2, 3, 4, 5, 6, 7, 8, 29, 0\\) returns 29\[ \r\n\]+.\[0-9\]+ = 29" \
+ "print find_max1(10,1,2,3,4,5,6,7,8,29,0)"
+
+gdb_test "print find_max2(3,1,2,3)" \
+ ".*find_max\\(3, 1, 2, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3" \
+ "print find_max2(3,1,2,3)"
if {![target_info exists gdb,skip_float_tests]} {
- send_gdb "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)\n"
- gdb_expect {
- -re ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17.*$gdb_prompt $" {
- pass "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)"
- }
- -re ".*$gdb_prompt $" { fail "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" }
- timeout { fail "(timeout) print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" }
- }
+ gdb_test "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" \
+ ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17" \
+ "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)"
}
Index: volatile.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/volatile.exp,v
retrieving revision 1.18
diff -u -p -r1.18 volatile.exp
--- volatile.exp 5 May 2010 18:06:58 -0000 1.18
+++ volatile.exp 19 May 2010 20:23:15 -0000
@@ -87,28 +87,17 @@ proc local_compiler_xfail_check_2 { } {
}
}
-send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+gdb_test "break marker1" "" ""
- send_gdb "cont\n"
- gdb_expect {
- -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
- send_gdb "up\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {}
- timeout { fail "up from marker1" }
- }
- }
- -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
- fail "continue to marker1 (demangling)"
- send_gdb "up\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {}
- timeout { fail "up from marker1" }
- }
- }
- -re "$gdb_prompt $" { fail "continue to marker1" }
- timeout { fail "(timeout) continue to marker1" }
+gdb_test_multiple "cont" "continue to marker1" {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ pass "continue to marker1"
}
+ -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ fail "continue to marker1 (demangling)"
+ }
+}
+gdb_test "up" " in main .*" "up from marker1"
# As of Feb 1999, GCC does not issue info about volatility of vars, so
# these tests are all expected to fail if GCC is the compiler. -sts
@@ -248,11 +237,7 @@ gdb_test "ptype vendor" "type = const vo
# test function parameters
local_compiler_xfail_check
local_compiler_xfail_check_2
-send_gdb "ptype qux2\n"
-gdb_expect {
- -re "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" {
- pass "ptype qux2"
- }
- -re ".*$gdb_prompt $" { fail "ptype qux2" }
- timeout { fail "(timeout) ptype qux2" }
- }
+
+gdb_test "ptype qux2" \
+ "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" \
+ "ptype qux2"