aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <mpolacek@sourceware.org>2011-04-20 14:56:49 +0000
committerMarek Polacek <mpolacek@sourceware.org>2011-04-20 14:56:49 +0000
commit20429c40710b16bacfb67e05d723a7a1e68103ba (patch)
treee208d0a025aca6ac41b6d24037e42d18f78cd477
parent3251b3756a9c0baaac829ee0a475f06ff4985af4 (diff)
downloadgdb-20429c40710b16bacfb67e05d723a7a1e68103ba.zip
gdb-20429c40710b16bacfb67e05d723a7a1e68103ba.tar.gz
gdb-20429c40710b16bacfb67e05d723a7a1e68103ba.tar.bz2
Fix racy tests in gdb.base/setshow.exp
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/setshow.exp19
2 files changed, 17 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index cef18ac..1dbe936 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-20 Marek Polacek <mpolacek@redhat.com>
+ * gdb.base/setshow.exp: Fix racy tests.
+ ($old_gdb_prompt): New variable.
+
2011-04-19 Tom Tromey <tromey@redhat.com>
* gdb.mi/mi-nsmoribund.exp:
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index f014b4b..ef32f1c 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -55,25 +55,32 @@ gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level i
#test set annotate 2
+# Here we need to fiddle with prompts.
+set old_gdb_prompt $gdb_prompt
+set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
+
gdb_test_multiple "set annotate 2" "set annotate 2" {
- -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
- pass "set annotate 2"
+ -re "\r\n$gdb_prompt$" {
+ pass "set annotate 2"
}
}
gdb_test_multiple "show annotate" "show annotate 2" {
- -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
+ -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" {
pass "show annotate 2"
}
}
#test annotation_level 2
gdb_test_multiple "info line 1" "annotation_level 2" {
- -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
+ -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$old_gdb_prompt .*\032\032prompt.*$" {
pass "annotation_level 2"
}
}
+# Restore the original prompt for the rest of the testsuite.
+set gdb_prompt $old_gdb_prompt
+
#test set annotate 1
gdb_test "set annotate 1" ".*post-prompt.*" "set annotate 1"
gdb_test "show annotate" "Annotation_level is 1..*" "show annotate (1)"
@@ -197,7 +204,7 @@ if ![board_info target exists gdb_prompt] {
set newprompt "\\(FooBarBaz\\)"
gdb_test_multiple "set prompt (FooBarBaz) " "set prompt FooBarBaz" {
- -re "$newprompt $" {
+ -re "\[\r\n\]$newprompt $" {
pass "set prompt FooBarBaz"
}
}
@@ -213,7 +220,7 @@ if ![board_info target exists gdb_prompt] {
#test set prompt (gdb)
gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
- -re "$gdb_prompt $" {
+ -re "\[\r\n\]$gdb_prompt $" {
pass "set prompt gdb"
}
}