Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marek Polacek <mpolacek@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
Date: Mon, 18 Apr 2011 16:39:00 -0000	[thread overview]
Message-ID: <4DAC6924.2000100@redhat.com> (raw)

It took some time, but I've fixed all racy cases by using {,old_}gdb_prompt
variable.  Also it was needed to escape "(gdb) " prompt properly.  Ok to apply?

2011-04-18  Marek Polacek  <mpolacek@redhat.com>

        * gdb.base/setshow.exp: Fix racy tests.
        ($old_gdb_prompt): New variable.


Index: testsuite/gdb.base/setshow.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/setshow.exp,v
retrieving revision 1.20
diff -u -r1.20 setshow.exp
--- testsuite/gdb.base/setshow.exp	1 Jan 2011 15:33:42 -0000	1.20
+++ testsuite/gdb.base/setshow.exp	18 Apr 2011 16:28:28 -0000
@@ -55,25 +55,32 @@
 
 #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)" 
@@ -212,7 +219,7 @@
 
     #test set prompt (gdb) 
 
-    gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
+    gdb_test_multiple "set prompt \\(gdb\\) " "set prompt gdb" {
 	-re "$gdb_prompt $" {
 	    pass "set prompt gdb"
 	}


             reply	other threads:[~2011-04-18 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18 16:39 Marek Polacek [this message]
2011-04-18 20:46 ` Tom Tromey
2011-04-19  7:01   ` Marek Polacek
2011-04-19 10:19     ` Andreas Schwab
2011-04-19 10:31       ` Marek Polacek
2011-04-19 12:52     ` Tom Tromey
2011-04-19 13:21       ` Marek Polacek
2011-04-19 13:48         ` Andreas Schwab
2011-04-19 18:47         ` Tom Tromey
2011-04-19 19:11           ` Marek Polacek
2011-04-19 20:28             ` Andreas Schwab
2011-04-20 11:25               ` Marek Polacek
2011-04-20 13:54                 ` Tom Tromey
2011-04-20 14:58                   ` Marek Polacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DAC6924.2000100@redhat.com \
    --to=mpolacek@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox