aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-05-20 19:18:58 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-05-20 19:18:58 +0000
commita7b75dfda10bf308d3403f344186fc6fbbaa5631 (patch)
treeb0d316924ccd5fff2d74c0242518f92daad566a5
parent8148cf8d75e7d4f891976b3a6a85a7203f8c65b2 (diff)
downloadgdb-a7b75dfda10bf308d3403f344186fc6fbbaa5631.zip
gdb-a7b75dfda10bf308d3403f344186fc6fbbaa5631.tar.gz
gdb-a7b75dfda10bf308d3403f344186fc6fbbaa5631.tar.bz2
lib/gdb.exp: New gdb_test_no_output function.
This new testsuite routine allows us to test commands that are not expected to generate any output. 2010-05-20 Pedro Alves <pedro@codesourcery.com> Joel Brobecker <brobecker@adacore.com> * lib/gdb.exp (gdb_test_no_output): New function. * lib/gdb.ada/arrayidx.exp: Use gdb_test_no_output instead of gdb_test when testing commands that should produce no output. Tested on x86_64-linux.
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.ada/arrayidx.exp8
-rw-r--r--gdb/testsuite/lib/gdb.exp25
3 files changed, 34 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b6f9469..93df121 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-20 Pedro Alves <pedro@codesourcery.com>
+ Joel Brobecker <brobecker@adacore.com>
+
+ * lib/gdb.exp (gdb_test_no_output): New function.
+ * lib/gdb.ada/arrayidx.exp: Use gdb_test_no_output instead of gdb_test
+ when testing commands that should produce no output.
+
2010-05-19 Michael Snyder <msnyder@vmware.com>
* gdb.base/whatis.exp: Replace send_gdb with gdb_test.
diff --git a/gdb/testsuite/gdb.ada/arrayidx.exp b/gdb/testsuite/gdb.ada/arrayidx.exp
index 13be845..3d45461 100644
--- a/gdb/testsuite/gdb.ada/arrayidx.exp
+++ b/gdb/testsuite/gdb.ada/arrayidx.exp
@@ -41,9 +41,7 @@ runto "p.adb:$bp_location"
# First, print all the arrays without indexes
-gdb_test "set print array-indexes off" \
- "" \
- "set print array-indexes to off"
+gdb_test_no_output "set print array-indexes off"
gdb_test "print one_two_three" \
"= \\(1, 2, 3\\)" \
@@ -79,9 +77,7 @@ gdb_test "print empty" \
# Next, print all the arrays with the indexes
-gdb_test "set print array-indexes on" \
- "" \
- "set print array-indexes to on"
+gdb_test_no_output "set print array-indexes on"
gdb_test "print one_two_three" \
"= \\(1 => 1, 2 => 2, 3 => 3\\)" \
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 70df5ea..563ffa7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -877,6 +877,31 @@ proc gdb_test { args } {
}
}]
}
+
+# gdb_test_no_output COMMAND MESSAGE
+# Send a command to GDB and verify that this command generated no output.
+#
+# See gdb_test_multiple for a description of the COMMAND and MESSAGE
+# parameters. If MESSAGE is ommitted, then COMMAND will be used as
+# the message.
+
+proc gdb_test_no_output { args } {
+ global gdb_prompt
+ set command [lindex $args 0]
+ if [llength $args]>1 then {
+ set message [lindex $args 1]
+ } else {
+ set message $command
+ }
+
+ set command_regex [string_to_regexp $command]
+ gdb_test_multiple $command $message {
+ -re "^$command_regex\r\n$gdb_prompt $" {
+ pass $message
+ }
+ }
+}
+
# Test that a command gives an error. For pass or fail, return
# a 1 to indicate that more tests can proceed. However a timeout