aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-01-29 16:22:36 +0000
committerDaniel Jacobowitz <drow@false.org>2007-01-29 16:22:36 +0000
commit704a4f78bb7a2617b283fc2ea08dd19804348af2 (patch)
treed3c5b2fc65b001e2245723125960007ed490c2d0
parent0f48aa010ef072334329172e66f0c4f31bc4a441 (diff)
downloadgdb-704a4f78bb7a2617b283fc2ea08dd19804348af2.zip
gdb-704a4f78bb7a2617b283fc2ea08dd19804348af2.tar.gz
gdb-704a4f78bb7a2617b283fc2ea08dd19804348af2.tar.bz2
* gdb.base/commands.exp: Call if_commands_test.
(gdb_test_no_prompt, if_commands_test): New.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/commands.exp74
2 files changed, 79 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 80dbc28..2d3a68e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-29 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb.base/commands.exp: Call if_commands_test.
+ (gdb_test_no_prompt, if_commands_test): New.
+
2007-01-28 Mark Kettenis <kettenis@gnu.org>
* gdb.threads/sigthread.c (NSIGS): Make bigger.
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 3ef04f5..6bd9be5 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -618,6 +618,79 @@ end}
file delete file3
}
+proc gdb_test_no_prompt { command result msg } {
+ global gdb_prompt
+
+ set msg "$command - $msg"
+ set result "^[string_to_regexp $command]\r\n$result$"
+ gdb_test_multiple $command $msg {
+ -re "$result" {
+ pass $msg
+ return 1
+ }
+ -re "\r\n *>$" {
+ fail $msg
+ return 0
+ }
+ }
+ return 0
+}
+
+proc if_commands_test {} {
+ global gdb_prompt
+
+ gdb_test "set \$tem = 1" "" "set \$tem in if_commands_test"
+
+ set test "if_commands_test 1"
+ gdb_test_no_prompt "if \$tem == 2" { >} $test
+ gdb_test_no_prompt "break main" { >} $test
+ gdb_test_no_prompt "else" { >} $test
+ gdb_test_no_prompt "break factorial" { >} $test
+ gdb_test_no_prompt "commands" { >} $test
+ gdb_test_no_prompt "silent" { >} $test
+ gdb_test_no_prompt "set \$tem = 3" { >} $test
+ gdb_test_no_prompt "continue" { >} $test
+ gdb_test_multiple "end" "first end - $test" {
+ -re " >\$" {
+ pass "first end - $test"
+ }
+ -re "\r\n>\$" {
+ fail "first end - $test"
+ }
+ }
+ gdb_test_multiple "end" "second end - $test" {
+ -re "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\.\r\n$gdb_prompt $" {
+ pass "second end - $test"
+ }
+ -re "Undefined command: \"silent\".*$gdb_prompt $" {
+ fail "second end - $test"
+ }
+ }
+
+ set test "if_commands_test 2"
+ gdb_test_no_prompt "if \$tem == 1" { >} $test
+ gdb_test_no_prompt "break main" { >} $test
+ gdb_test_no_prompt "else" { >} $test
+ gdb_test_no_prompt "break factorial" { >} $test
+ gdb_test_no_prompt "commands" { >} $test
+ gdb_test_no_prompt "silent" { >} $test
+ gdb_test_no_prompt "set \$tem = 3" { >} $test
+ gdb_test_no_prompt "continue" { >} $test
+ gdb_test_multiple "end" "first end - $test" {
+ -re " >\$" {
+ pass "first end - $test"
+ }
+ -re "\r\n>\$" {
+ fail "first end - $test"
+ }
+ }
+ gdb_test_multiple "end" "second end - $test" {
+ -re "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\.\r\n$gdb_prompt $" {
+ pass "second end - $test"
+ }
+ }
+}
+
gdbvar_simple_if_test
gdbvar_simple_while_test
gdbvar_complex_if_while_test
@@ -635,3 +708,4 @@ bp_deleted_in_command_test
temporary_breakpoint_commands
stray_arg0_test
recursive_source_test
+if_commands_test