public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb/gdb-12-branch] [gdb/testsuite] Make gdb.base/annota1.exp more robust
Date: Thu, 14 Apr 2022 12:56:26 +0000 (GMT)	[thread overview]
Message-ID: <20220414125626.481013858418@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=013dbf15db036ad1513fa41ecfa30d4885c2d18c

commit 013dbf15db036ad1513fa41ecfa30d4885c2d18c
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Apr 14 14:56:21 2022 +0200

    [gdb/testsuite] Make gdb.base/annota1.exp more robust
    
    On openSUSE Tumbleweed I run into:
    ...
    FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
    ...
    
    The problem is that the libthread_db message occurs at a location where it's
    not expected:
    ...
    Starting program: outputs/gdb.base/annota1/annota1 ^M
    ^M
    ^Z^Zstarting^M
    ^M
    ^Z^Zframes-invalid^M
    [Thread debugging using libthread_db enabled]^M
    Using host libthread_db library "/lib64/libthread_db.so.1".^M
    ^M
    ^Z^Zbreakpoints-invalid^M
    ^M
    ...
    
    Fix this by making the matching more robust:
    - rewrite the regexp such that each annotation is on a single line,
      starting with \r\n\032\032 and ending with \r\n
    - add a regexp variable optional_re, that matches all possible optional
      output, and use it as a separator in the first part of the regexp
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.base/annota1.exp | 71 +++++++++++++++++++++++++-------------
 1 file changed, 47 insertions(+), 24 deletions(-)

diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index c9544eec0ec..40a13e7cf19 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -128,41 +128,64 @@ gdb_test_multiple "info break" "breakpoint info" {
 set binexp [string_to_regexp $binfile]
 
 set warning_slow_re \
-    "warning: File transfers from remote targets can be slow\[^\r\n\]+"
+    "warning: File transfers from remote targets can be slow\[^\r\n\]+\r\n"
 set warning_gdb_index_re \
     [multi_line \
 	 "warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \
 	 "Do \"set use-deprecated-index-sections on\" before the file is read" \
-	 "to use the section anyway\\."]
+	 "to use the section anyway\\.\r\n"]
 set reading_re \
-    "Reading \[^\r\n\]+"
+    "Reading \[^\r\n\]+\r\n"
 set libthread_db_re \
     [multi_line \
 	 "\\\[Thread debugging using libthread_db enabled\\\]" \
-	 "Using host libthread_db library \[^\r\n\]+"]
+	 "Using host libthread_db library \[^\r\n\]+\r\n"]
 
-set run_re \
+set optional_re \
     [list \
-	 "\r\n\032\032post-prompt\r\nStarting program: $binexp " \
-	 "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
+	 "\(" \
+	 "\($reading_re)" \
+	 "|" \
+	 "\($warning_slow_re\)" \
+	 "|" \
+	 "\($libthread_db_re\)" \
+	 "|" \
 	 "\(\r\n$warning_gdb_index_re\)?" \
-	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
-	 "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \
-	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
-	 "\032\032breakpoint 1\r\n\r\n" \
-	 "Breakpoint 1, \r\n" \
-	 "\032\032frame-begin 0 $hex\r\n\r\n" \
-	 "\032\032frame-function-name\r\n" \
-	 "main\r\n" \
-	 "\032\032frame-args\r\n \\(\\)\r\n" \
-	 "\032\032frame-source-begin\r\n at \r\n" \
-	 "\032\032frame-source-file\r\n.*annota1.c\r\n" \
-	 "\032\032frame-source-file-end\r\n:\r\n" \
-	 "\032\032frame-source-line\r\n$main_line\r\n" \
-	 "\032\032frame-source-end\r\n\r\n\r\n" \
-	 "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \
-	 "\032\032frame-end\r\n\r\n" \
-	 "\032\032stopped"]
+	 "\)*"]
+set optional_re [join $optional_re ""]
+
+set run_re \
+    [list \
+	 "\r\n\032\032post-prompt\r\n" \
+	 "Starting program: $binexp \r\n" \
+	 $optional_re \
+	 "\r\n\032\032starting\r\n" \
+	 $optional_re \
+	 "\r\n\032\032frames-invalid\r\n" \
+	 $optional_re \
+	 "\r\n\032\032breakpoints-invalid\r\n" \
+	 $optional_re \
+	 "\r\n\032\032breakpoint 1\r\n" \
+	 "\r\n" \
+	 "Breakpoint 1, " \
+	 "\r\n\032\032frame-begin 0 $hex\r\n" \
+	 "\r\n\032\032frame-function-name\r\n" \
+	 "main" \
+	 "\r\n\032\032frame-args\r\n" \
+	 " \\(\\)" \
+	 "\r\n\032\032frame-source-begin\r\n" \
+	 " at " \
+	 "\r\n\032\032frame-source-file\r\n" \
+	 ".*annota1.c" \
+	 "\r\n\032\032frame-source-file-end\r\n" \
+	 ":" \
+	 "\r\n\032\032frame-source-line\r\n" \
+	 "$main_line" \
+	 "\r\n\032\032frame-source-end\r\n" \
+	 "\r\n" \
+	 "\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n" \
+	 "\r\n\032\032frame-end\r\n" \
+	 "\r\n\032\032stopped\r\n"]
 
 set run_re [join $run_re ""]


                 reply	other threads:[~2022-04-14 12:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220414125626.481013858418@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).