Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
@ 2011-04-18 16:39 Marek Polacek
  2011-04-18 20:46 ` Tom Tromey
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Polacek @ 2011-04-18 16:39 UTC (permalink / raw)
  To: gdb-patches

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"
 	}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-18 16:39 [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649) Marek Polacek
@ 2011-04-18 20:46 ` Tom Tromey
  2011-04-19  7:01   ` Marek Polacek
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2011-04-18 20:46 UTC (permalink / raw)
  To: Marek Polacek; +Cc: gdb-patches

>>>>> "Marek" == Marek Polacek <mpolacek@redhat.com> writes:

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

This seems ok, but...

Marek> -    gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
Marek> +    gdb_test_multiple "set prompt \\(gdb\\) " "set prompt gdb" {

I think this should not be needed.

Tom


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-18 20:46 ` Tom Tromey
@ 2011-04-19  7:01   ` Marek Polacek
  2011-04-19 10:19     ` Andreas Schwab
  2011-04-19 12:52     ` Tom Tromey
  0 siblings, 2 replies; 14+ messages in thread
From: Marek Polacek @ 2011-04-19  7:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04/18/2011 10:45 PM, Tom Tromey wrote:
> Marek> -    gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
> Marek> +    gdb_test_multiple "set prompt \\(gdb\\) " "set prompt gdb" {
> 
> I think this should not be needed.

It is needed.  Not that I'd see WHY it is so.  But this is what I get without
those "\\":

FAIL: gdb.base/setshow.exp: set radix 11
FAIL: gdb.base/setshow.exp: set radix 16
FAIL: gdb.base/setshow.exp: show radix (16)
FAIL: gdb.base/setshow.exp: set radix 10
FAIL: gdb.base/setshow.exp: show radix (10)
FAIL: gdb.base/setshow.exp: set width 90
FAIL: gdb.base/setshow.exp: show width (90)
FAIL: gdb.base/setshow.exp: set write on
FAIL: gdb.base/setshow.exp: show write (on)
FAIL: gdb.base/setshow.exp: set symbol-reloading on
FAIL: gdb.base/setshow.exp: show symbol-reloading (on)
FAIL: gdb.base/setshow.exp: show user
FAIL: gdb.base/setshow.exp: set verbose on
FAIL: gdb.base/setshow.exp: show verbose (on)
FAIL: gdb.base/setshow.exp: set verbose off
FAIL: gdb.base/setshow.exp: show verbose (off)

		=== gdb Summary ===

# of expected passes		60
# of unexpected failures	16


_With_ them all seems just fine:

		=== gdb Summary ===

# of expected passes		76


	Marek


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2011-04-19 10:19 UTC (permalink / raw)
  To: Marek Polacek; +Cc: Tom Tromey, gdb-patches

Marek Polacek <mpolacek@redhat.com> writes:

> On 04/18/2011 10:45 PM, Tom Tromey wrote:
>> Marek> -    gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
>> Marek> +    gdb_test_multiple "set prompt \\(gdb\\) " "set prompt gdb" {
>> 
>> I think this should not be needed.
>
> It is needed.

The backslashes are removed when the prompt is expanded by readline, so
the output should be identical.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-19 10:19     ` Andreas Schwab
@ 2011-04-19 10:31       ` Marek Polacek
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Polacek @ 2011-04-19 10:31 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Tom Tromey, gdb-patches

On 04/19/2011 12:18 PM, Andreas Schwab wrote:
> The backslashes are removed when the prompt is expanded by readline, so
> the output should be identical.

Yes, this is also my understanding.  I am confused why the behaviour
with "\\" and without "\\" differs then.  Thanks,

	Marek


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-19  7:01   ` Marek Polacek
  2011-04-19 10:19     ` Andreas Schwab
@ 2011-04-19 12:52     ` Tom Tromey
  2011-04-19 13:21       ` Marek Polacek
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2011-04-19 12:52 UTC (permalink / raw)
  To: Marek Polacek; +Cc: gdb-patches

>>>>> "Marek" == Marek Polacek <mpolacek@redhat.com> writes:

Tom> I think this should not be needed.

Marek> It is needed.  Not that I'd see WHY it is so.  But this is what I
Marek> get without those "\\":

Marek> FAIL: gdb.base/setshow.exp: set radix 11

Maybe gdb.log says something, or maybe running with --verbose would
help.

Also, looking at the code, it seems to me that the section that sets the
prompt to "(FooBarBaz) " should also set and restore gdb_prompt.  That
is because gdb_test_multiple references this.  What do you think?

Tom


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  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
  0 siblings, 2 replies; 14+ messages in thread
From: Marek Polacek @ 2011-04-19 13:21 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04/19/2011 02:52 PM, Tom Tromey wrote:
> Maybe gdb.log says something, or maybe running with --verbose would
> help.

The `runtest -v -v -v gdb.base/setshow.exp' says this:

Looking to match ""[\r\n]*(Input and output radices now set to decimal 16, hex
10, octal 20..*)[\r\n]+\(gdb\) $"; "(^FOOBAR$)$""

Note those '\' around (gdb).  This is probably the reason why we need to supply
"\\".

> Also, looking at the code, it seems to me that the section that sets the
> prompt to "(FooBarBaz) " should also set and restore gdb_prompt.  That
> is because gdb_test_multiple references this.  What do you think?

The prompt is restored by the gdb_test_multiple "set prompt \\(gdb\\) ".
Then it is checked by the -re "$gdb_prompt $".  I think this is correct.

	Marek


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-19 13:21       ` Marek Polacek
@ 2011-04-19 13:48         ` Andreas Schwab
  2011-04-19 18:47         ` Tom Tromey
  1 sibling, 0 replies; 14+ messages in thread
From: Andreas Schwab @ 2011-04-19 13:48 UTC (permalink / raw)
  To: Marek Polacek; +Cc: Tom Tromey, gdb-patches

Marek Polacek <mpolacek@redhat.com> writes:

> On 04/19/2011 02:52 PM, Tom Tromey wrote:
>> Maybe gdb.log says something, or maybe running with --verbose would
>> help.
>
> The `runtest -v -v -v gdb.base/setshow.exp' says this:
>
> Looking to match ""[\r\n]*(Input and output radices now set to decimal 16, hex
> 10, octal 20..*)[\r\n]+\(gdb\) $"; "(^FOOBAR$)$""
>
> Note those '\' around (gdb).

That's because it's a regexp, of course.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2011-04-19 18:47 UTC (permalink / raw)
  To: Marek Polacek; +Cc: gdb-patches

>>>>> "Marek" == Marek Polacek <mpolacek@redhat.com> writes:

Marek> Note those '\' around (gdb).  This is probably the reason why we
Marek> need to supply "\\".

If I revert that hunk, it still works for me.
So, something else must be going on.

Tom


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-19 18:47         ` Tom Tromey
@ 2011-04-19 19:11           ` Marek Polacek
  2011-04-19 20:28             ` Andreas Schwab
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Polacek @ 2011-04-19 19:11 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04/19/2011 08:46 PM, Tom Tromey wrote:
> If I revert that hunk, it still works for me.
> So, something else must be going on.

Yes, but try running it without those "\\"s and _with_ read1()
from:

http://sourceware.org/bugzilla/show_bug.cgi?id=12649

I bet you will see those FAILs afterwards.
Do we really have to avoid those backslashes?  Couldn't they just
stay?  Thanks,

	Marek


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-19 19:11           ` Marek Polacek
@ 2011-04-19 20:28             ` Andreas Schwab
  2011-04-20 11:25               ` Marek Polacek
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Schwab @ 2011-04-19 20:28 UTC (permalink / raw)
  To: Marek Polacek; +Cc: Tom Tromey, gdb-patches

Marek Polacek <mpolacek@redhat.com> writes:

> On 04/19/2011 08:46 PM, Tom Tromey wrote:
>> If I revert that hunk, it still works for me.
>> So, something else must be going on.
>
> Yes, but try running it without those "\\"s and _with_ read1()
> from:
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=12649
>
> I bet you will see those FAILs afterwards.

Obviously:

@@ -3719,7 +3719,8 @@ board_info target exists gdb,timeout
 board_info target exists gdb,timeout
 board_info host fileid 
 getting igel fileid
-set prompt (gdb) PASS: gdb.base/setshow.exp: set prompt gdb
+set prompt \(gdb\) 
+(gdb) PASS: gdb.base/setshow.exp: set prompt gdb
 Sending "set radix 11" to gdb
 Looking to match ""[\r\n]*(Unsupported output radix ``decimal 11''; output radix unchanged..*)[\r\n]+\(gdb\) $"; "(^FOOBAR$)$""
 Message is "set radix 11"

--- setshow.exp	1 Jan 2011 15:33:42 -0000	1.20
+++ setshow.exp	19 Apr 2011 20:25:09 -0000
@@ -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"
 	}
     }

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-19 20:28             ` Andreas Schwab
@ 2011-04-20 11:25               ` Marek Polacek
  2011-04-20 13:54                 ` Tom Tromey
  0 siblings, 1 reply; 14+ messages in thread
From: Marek Polacek @ 2011-04-20 11:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Tom Tromey, gdb-patches

On 04/19/2011 10:28 PM, Andreas Schwab wrote:
> Obviously:

...

Yes, this works.  Thank you, Andreas!

Tom, ok to apply with these changes?  Thanks,

	Marek	


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-20 11:25               ` Marek Polacek
@ 2011-04-20 13:54                 ` Tom Tromey
  2011-04-20 14:58                   ` Marek Polacek
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2011-04-20 13:54 UTC (permalink / raw)
  To: Marek Polacek; +Cc: Andreas Schwab, gdb-patches

>>>>> "Marek" == Marek Polacek <mpolacek@redhat.com> writes:

Marek> Yes, this works.  Thank you, Andreas!
Marek> Tom, ok to apply with these changes?  Thanks,

Yes, thanks.

Tom


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649)
  2011-04-20 13:54                 ` Tom Tromey
@ 2011-04-20 14:58                   ` Marek Polacek
  0 siblings, 0 replies; 14+ messages in thread
From: Marek Polacek @ 2011-04-20 14:58 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andreas Schwab, gdb-patches

Applied.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-04-20 14:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-18 16:39 [PATCH] gdb.base/setshow.exp: fix racy tests (PR testsuite/12649) Marek Polacek
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox