From a127f7b4917bd9a4a1851451ae6f2c1a4af0a62a Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Wed, 26 May 2010 18:31:25 +0000 Subject: [PATCH] 2010-05-26 Michael Snyder * gdb.gdb/complaints.exp: Replace send_gdb with gdb_test. * gdb.gdb/selftest.exp: Replace send_gdb with gdb_test. * gdb.gdb/xfullpath.exp: Replace send_gdb with gdb_test. --- gdb/testsuite/ChangeLog | 4 ++ gdb/testsuite/gdb.gdb/complaints.exp | 73 ++++----------------- gdb/testsuite/gdb.gdb/selftest.exp | 94 +++++++--------------------- gdb/testsuite/gdb.gdb/xfullpath.exp | 6 +- 4 files changed, 39 insertions(+), 138 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b7808e87504..c9aaa2978d2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2010-05-26 Michael Snyder + * gdb.gdb/complaints.exp: Replace send_gdb with gdb_test. + * gdb.gdb/selftest.exp: Replace send_gdb with gdb_test. + * gdb.gdb/xfullpath.exp: Replace send_gdb with gdb_test. + * gdb.reverse/consecutive-reverse.exp: Replace send_gdb with gdb_test. * gdb.reverse/consecutive-precsave.exp: Replace send_gdb with gdb_test. diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp index b4afcb54cfb..cc66e309727 100644 --- a/gdb/testsuite/gdb.gdb/complaints.exp +++ b/gdb/testsuite/gdb.gdb/complaints.exp @@ -72,8 +72,7 @@ proc setup_test { executable } { set timeout 600 set description "run until breakpoint at captured_command_loop" - send_gdb "run -nw\n" - gdb_expect { + gdb_test_multiple "run -nw" "$description" { -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.* at .*main.c:.*$gdb_prompt $" { pass "$description" } @@ -92,9 +91,6 @@ proc setup_test { executable } { verbose "Timeout is now $timeout seconds" 2 return -1 } - timeout { - fail "$description (timeout)" - } } set timeout $oldtimeout @@ -140,44 +136,23 @@ proc test_serial_complaints { } { gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start" # Prime the system - send_gdb "call complaint (&symfile_complaints, \"serial line 1\")\n" - gdb_expect { - -re "During symbol reading...serial line 1...$gdb_prompt " { + gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 1\")" "serial line 1" { + -re "During symbol reading...serial line 1...$gdb_prompt $" { pass "serial line 1" } - "$gdb_prompt" { - fail "serial line 1" - } - timeout { - fail "serial line 1 (timeout)" - } } # Add a second complaint, expect it - send_gdb "call complaint (&symfile_complaints, \"serial line 2\")\n" - gdb_expect { + gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" { -re "serial line 2...$gdb_prompt " { pass "serial line 2" } - "$gdb_prompt" { - fail "serial line 2" - } - timeout { - fail "serial line 2 (timeout)" - } } - send_gdb "call clear_complaints (&symfile_complaints, 1, 0)\n" - gdb_expect { + gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "serial end" { -re "\r\n\r\n$gdb_prompt " { pass "serial end" } - "$gdb_prompt" { - fail "serial end" - } - timeout { - fail "serial end (timeout)" - } } return 0 @@ -192,44 +167,23 @@ proc test_short_complaints { } { gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start" # Prime the system - send_gdb "call complaint (&symfile_complaints, \"short line 1\")\n" - gdb_expect { + gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" { -re "short line 1...$gdb_prompt " { pass "short line 1" } - "$gdb_prompt" { - fail "short line 1" - } - timeout { - fail "short line 1 (timeout)" - } } # Add a second complaint, expect it - send_gdb "call complaint (&symfile_complaints, \"short line 2\")\n" - gdb_expect { + gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" { -re "short line 2...$gdb_prompt " { pass "short line 2" } - "$gdb_prompt" { - fail "short line 2" - } - timeout { - fail "short line 2 (timeout)" - } } - send_gdb "call clear_complaints (&symfile_complaints, 1, 0)\n" - gdb_expect { + gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "short end" { -re "\r\n\r\n$gdb_prompt " { pass "short end" } - "$gdb_prompt" { - fail "short end" - } - timeout { - fail "short end (timeout)" - } } return 0 @@ -241,19 +195,14 @@ proc test_short_complaints { } { proc test_empty_complaint { cmd msg } { global gdb_prompt - send_gdb $cmd - gdb_expect { - -re "\r\n\r\n$gdb_prompt " { + gdb_test_multiple $cmd $msg { + -re "\r\n\r\n$gdb_prompt $" { fail $msg } - "\r\n$gdb_prompt" { + "\r\n$gdb_prompt $" { pass $msg } - timeout { - fail "$msg (timeout)" - } } - } proc test_empty_complaints { } { diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp index 6e1236ddd19..d1574bc8801 100644 --- a/gdb/testsuite/gdb.gdb/selftest.exp +++ b/gdb/testsuite/gdb.gdb/selftest.exp @@ -39,12 +39,11 @@ proc do_steps_and_nexts {} { set unlikely_line 0 for {set count 0} {$count < 32} {incr count} { - send_gdb "list\n" # NOTE: carlton/2002-12-11: The "initial brace" and # "current_directory initialization" possibilities happen to # me with GCC 3.1 on i686-pc-linux-gnu when I compile with # optimization. - gdb_expect { + gdb_test_multiple "list" "list" { -re ".*context = data.*$gdb_prompt $" { set description "step over context initialization" set command "step" @@ -227,8 +226,7 @@ proc do_steps_and_nexts {} { return } } - send_gdb "$command\n" - gdb_expect { + gdb_test_multiple "$command" "$description" { -re ".*No such file or directory.\r\n$gdb_prompt $" { fail "$description (no source available)" } @@ -238,9 +236,6 @@ proc do_steps_and_nexts {} { -re ".*$gdb_prompt $" { pass "$description" } - timeout { - fail "$description (timeout)" - } } } } @@ -312,8 +307,7 @@ proc test_with_self { executable } { set timeout 600 set description "run until breakpoint at captured_main" - send_gdb "run -nw\n" - gdb_expect { + gdb_test_multiple "run -nw" "$description" { -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" { pass "$description" } @@ -332,17 +326,13 @@ proc test_with_self { executable } { verbose "Timeout is now $timeout seconds" 2 return -1 } - timeout { - fail "$description (timeout)" - } } set timeout $oldtimeout verbose "Timeout is now $timeout seconds" 2 # do we have a version number ? - send_gdb "print version\n" - gdb_expect { + gdb_test_multiple "print version" "printed version" { -re ".\[0-9\]+ = .\[0-9.\]+.*$gdb_prompt $" { pass "printed version as string" } @@ -352,8 +342,6 @@ proc test_with_self { executable } { -re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" { pass "printed version with cast" } - -re ".*$gdb_prompt $" { fail "printed version" } - timeout { fail "(timeout) printed version" } } do_steps_and_nexts @@ -370,8 +358,7 @@ proc test_with_self { executable } { set stepped_back 0 setup_xfail "alpha-*-*" "mips-*-*" set description "step into xmalloc call" - send_gdb "step\n" - gdb_expect { + gdb_test_multiple "step" "$description" { -re "ncmd = 0;.*$gdb_prompt $" { set stepped_back 1 send_gdb "step\n" @@ -404,48 +391,26 @@ proc test_with_self { executable } { -re "A file or directory .* does not exist..\r\n$gdb_prompt $" { pass "$description (no source available)" } - -re ".*$gdb_prompt $" { - fail "$description" - } - timeout { - fail "$description (timeout)" - } } # start the "xgdb" process - send_gdb "continue\n" - gdb_expect { - -re "GNU gdb \[0-9\.\]*.* -Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.* -License GPLv3\\+: GNU GPL version 3 or later .* -This is free software: you are free to change and redistribute it.* -There is NO WARRANTY, to the extent permitted by law. Type \"show copying\".* -and \"show warranty\" for details.* -This GDB was configured as .*$gdb_prompt $"\ - { pass "xgdb is at prompt" } - -re "GNU gdb \[0-9\.\]*.* -Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.* -GDB is free software, covered by the GNU General Public License, and you are.* -welcome to change it and/or distribute copies of it under certain conditions.* -Type \"show copying\" to see the conditions.* -There is absolutely no warranty for GDB. Type \"show warranty\" for details.* -This GDB was configured as .*$gdb_prompt $"\ - { pass "xgdb is at prompt (obsolescent gdb 2)" } - -re "GDB is free software and you are welcome to distribute copies of it.* - under certain conditions; type \"show copying\" to see the conditions..* -There is absolutely no warranty for GDB; type \"show warranty\" for details..* -GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ - { pass "xgdb is at prompt (obsolescent gdb 1)" } - -re ".*$gdb_prompt $" { fail "xgdb is at prompt" } - timeout { fail "(timeout) xgdb is at prompt" } + gdb_test_multiple "continue" "xgdb is at prompt" { + -re "GNU gdb \[0-9\.\]*.*Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.*License GPLv3\\+: GNU GPL version 3 or later .*This is free software: you are free to change and redistribute it.*There is NO WARRANTY, to the extent permitted by law. Type \"show copying\".*and \"show warranty\" for details.*This GDB was configured as .*$gdb_prompt $" { + pass "xgdb is at prompt" + } + -re "GNU gdb \[0-9\.\]*.*Copyright \\(C\\) \[0-9\]* Free Software Foundation, Inc.*GDB is free software, covered by the GNU General Public License, and you are.*welcome to change it and/or distribute copies of it under certain conditions.*Type \"show copying\" to see the conditions.*There is absolutely no warranty for GDB. Type \"show warranty\" for details.*This GDB was configured as .*$gdb_prompt $" { + pass "xgdb is at prompt (obsolescent gdb 2)" + } + -re "GDB is free software and you are welcome to distribute copies of it.* under certain conditions; type \"show copying\" to see the conditions..*There is absolutely no warranty for GDB; type \"show warranty\" for details..*GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $" { + pass "xgdb is at prompt (obsolescent gdb 1)" + } } # set xgdb prompt so we can tell which is which - send_gdb "set prompt (xgdb) \n" - gdb_expect { - -re "\[(\]xgdb\[)\].*\[(\]xgdb\[)\] $" { pass "Set xgdb prompt" } - -re ".*$gdb_prompt $" { fail "Set xgdb prompt" } - default { fail "(timeout) Set xgdb prompt" } + gdb_test_multiple "set prompt (xgdb) " "Set xgdb_prompt" { + -re "\[(\]xgdb\[)\].*\[(\]xgdb\[)\] $" { + pass "Set xgdb prompt" + } } # kill the xgdb process @@ -464,18 +429,9 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ } set description "send SIGINT signal to child process" - send_gdb "signal SIGINT\n" - gdb_expect { - -re "Continuing with signal SIGINT.*$gdb_prompt $" { - pass "$description" - } - -re ".*$gdb_prompt $" { - fail "$description" - } - timeout { - fail "$description (timeout)" - } - } + gdb_test "signal SIGINT" \ + "Continuing with signal SIGINT.*" \ + "$description" # get a stack trace # @@ -484,8 +440,7 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ # The testsuite failures may not be limited to just aout systems. setup_xfail "i*86-pc-linuxaout-gnu" set description "backtrace through signal handler" - send_gdb "backtrace\n" - gdb_expect { + gdb_test_multiple "backtrace" "$description" { -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" { pass "$description" } @@ -498,9 +453,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ setup_xfail "alpha*-*-osf*" fail "$description" } - timeout { - fail "$description (timeout)" - } } diff --git a/gdb/testsuite/gdb.gdb/xfullpath.exp b/gdb/testsuite/gdb.gdb/xfullpath.exp index d7234db8282..fce33dfdfcd 100644 --- a/gdb/testsuite/gdb.gdb/xfullpath.exp +++ b/gdb/testsuite/gdb.gdb/xfullpath.exp @@ -72,8 +72,7 @@ proc setup_test { executable } { set timeout 600 set description "run until breakpoint at captured_main" - send_gdb "run -nw\n" - gdb_expect { + gdb_test_multiple "run -nw" "$description" { -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" { pass "$description" } @@ -92,9 +91,6 @@ proc setup_test { executable } { verbose "Timeout is now $timeout seconds" 2 return -1 } - timeout { - fail "$description (timeout)" - } } set timeout $oldtimeout -- 2.30.2