Allow multiple occurrences of the frames-invalid annotation in gdb.cp/annota2.exp

Message ID 1448293310-18824-1-git-send-email-yao.qi@linaro.org
State New, archived
Headers

Commit Message

Yao Qi Nov. 23, 2015, 3:41 p.m. UTC
  Hi,
I see one fail on aarch64-linux testing,

  FAIL: gdb.cp/annota2.exp: watch triggered on a.x (timeout)

because GDB prints two frames-invalid annotation but the test expects
only one.

next^M
^M
^Z^Zpost-prompt^M
^M
^Z^Zstarting^M
^M
^Z^Zframes-invalid^M
^M
^Z^Zframes-invalid^M
^M
Note I also see the fail on Debian-s390x-m64 too.
https://sourceware.org/ml/gdb-testers/2015-q4/msg07291.html

The test shouldn't only expect one frames-invalid annotation, because
there can be multiple times of stop/resume before the user visible
stop.  Ulrich did something similar before
https://www.sourceware.org/ml/gdb-patches/2009-06/msg00118.html

This patch only changes ${frames_invalid} to \(${frames_invalid}\)*
in the regexp pattern.

The patch below fixes the fail on aarch64-linux.

gdb/testsuite:

2015-11-23  Yao Qi  <yao.qi@linaro.org>

	* gdb.cp/annota2.exp: Allow multiple occurrences of the
	frames-invalid annotation.
---
 gdb/testsuite/gdb.cp/annota2.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Pedro Alves Nov. 23, 2015, 5:48 p.m. UTC | #1
On 11/23/2015 03:41 PM, Yao Qi wrote:
> Hi,
> I see one fail on aarch64-linux testing,
> 
>   FAIL: gdb.cp/annota2.exp: watch triggered on a.x (timeout)
> 
> because GDB prints two frames-invalid annotation but the test expects
> only one.
> 
> next^M
> ^M
> ^Z^Zpost-prompt^M
> ^M
> ^Z^Zstarting^M
> ^M
> ^Z^Zframes-invalid^M
> ^M
> ^Z^Zframes-invalid^M
> ^M
> Note I also see the fail on Debian-s390x-m64 too.
> https://sourceware.org/ml/gdb-testers/2015-q4/msg07291.html
> 
> The test shouldn't only expect one frames-invalid annotation, because
> there can be multiple times of stop/resume before the user visible
> stop.  Ulrich did something similar before
> https://www.sourceware.org/ml/gdb-patches/2009-06/msg00118.html
> 
> This patch only changes ${frames_invalid} to \(${frames_invalid}\)*
> in the regexp pattern.
> 
> The patch below fixes the fail on aarch64-linux.

Looks fine to me.

> diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
> index 041f65d..ed3fd1b 100644
> --- a/gdb/testsuite/gdb.cp/annota2.exp
> +++ b/gdb/testsuite/gdb.cp/annota2.exp
> @@ -162,7 +162,7 @@ gdb_test_multiple "watch a.x" "set watch on a.x" {
>  # annotate-watchpoint
>  #
>  gdb_test_multiple "next" "watch triggered on a.x" {
> -    -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n${frames_invalid}${breakpoints_invalid}\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
> +    -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\(${frames_invalid}\)*${breakpoints_invalid}\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
>  	pass "watch triggered on a.x"

For a rainy day: I think these tests would be much more readable
if they used multi_line...

Thanks,
Pedro Alves
  
Yao Qi Nov. 27, 2015, 2:24 p.m. UTC | #2
Pedro Alves <palves@redhat.com> writes:

> For a rainy day: I think these tests would be much more readable
> if they used multi_line...

Agreed.  The patch is pushed in.  I'll post another one to use
multi_line in annota2.exp.
  

Patch

diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index 041f65d..ed3fd1b 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -162,7 +162,7 @@  gdb_test_multiple "watch a.x" "set watch on a.x" {
 # annotate-watchpoint
 #
 gdb_test_multiple "next" "watch triggered on a.x" {
-    -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n${frames_invalid}${breakpoints_invalid}\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
+    -re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\(${frames_invalid}\)*${breakpoints_invalid}\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
 	pass "watch triggered on a.x"
     }
 }