public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/5] gdb/testsuite: fix occasional failure in gdb.base/clear_non_user_bp.exp
Date: Fri, 31 Mar 2023 21:20:54 +0100	[thread overview]
Message-ID: <62e7b6208a24dea949d901aa1945a87e8683478e.1680293848.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1680293848.git.aburgess@redhat.com>

I noticed that the gdb.base/clear_non_user_bp.exp test would sometime
fail when run from a particular directory.

The test tries to find the number of the first internal breakpoint
using this proc:

  proc get_first_maint_bp_num { } {
      gdb_test_multiple "maint info break" "find first internal bp num" {
  	-re -wrap "(-\[0-9\]).*" {
  	    return $expect_out(1,string)
  	}
      }
      return ""
  }

The problem is, at the time we issue 'maint info break' there are both
internal breakpoint and non-internal (user created) breakpoints in
place.  The user created breakpoints include the path to the source
file.

Sometimes, I'll be working from a directory that includes a number,
like '/tmp/blah-1/gdb/etc', in which case the pattern above actually
matches the '-1' from 'blah-1'.  In this case there's no significant
problem as it turns out that -1 is the number of the first internal
breakpoint.

Sometimes my directory name might be '/tmp/blah-4/gdb/etc', in which
case the above pattern patches '-4' from 'blah-4'.  It turns out this
is also not a problem -- the test doesn't actually need the first
internal breakpoint number, it just needs the number of any internal
breakpoint.

But sometimes my directory name might be '/tmp/blah-0/gdb/etc', in
which case the pattern above matches '-0' from 'blah-0', and in this
case the test fails - there is no internal breakpoint '-0'.

Fix this by spotting that the internal breakpoint numbers always occur
after a '\r\n', and that they never start with a 0.  Our pattern
becomes:

  	-re -wrap "\r\n(-\[1-9\]\[0-9\]*).*" {
  	    return $expect_out(1,string)
  	}

After this I'm no longer seeing any failures.
---
 gdb/testsuite/gdb.base/clear_non_user_bp.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/clear_non_user_bp.exp b/gdb/testsuite/gdb.base/clear_non_user_bp.exp
index 10e6efddc14..dc1557695bd 100644
--- a/gdb/testsuite/gdb.base/clear_non_user_bp.exp
+++ b/gdb/testsuite/gdb.base/clear_non_user_bp.exp
@@ -30,7 +30,7 @@
 #
 proc get_first_maint_bp_num { } {
     gdb_test_multiple "maint info break" "find first internal bp num" {
-	-re -wrap "(-\[0-9\]).*" {
+	-re -wrap "\r\n(-\[1-9\]\[0-9\]*).*" {
 	    return $expect_out(1,string)
 	}
     }
-- 
2.25.4


  reply	other threads:[~2023-03-31 20:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 20:20 [PATCH 0/5] gdb/testsuite: stricter matching for gdb_test Andrew Burgess
2023-03-31 20:20 ` Andrew Burgess [this message]
2023-03-31 20:20 ` [PATCH 2/5] gdb: remove some trailing newlines from warning messages Andrew Burgess
2023-03-31 20:20 ` [PATCH 3/5] gdb/testsuite: use 'return' in gdb_test_no_output Andrew Burgess
2023-03-31 20:20 ` [PATCH 4/5] gdb/testsuite: change newline patterns used in gdb_test Andrew Burgess
2023-04-27 19:39   ` Simon Marchi
2023-04-28 14:05     ` Andrew Burgess
2023-04-28 15:51     ` Andrew Burgess
2023-04-28 15:57       ` Simon Marchi
2023-04-28 18:37         ` Simon Marchi
2023-04-28 21:50           ` Andrew Burgess
2023-05-02 19:16             ` Simon Marchi
2023-04-29 15:20   ` Tom de Vries
2023-05-01 14:33     ` Andrew Burgess
2023-05-01 15:10       ` Tom de Vries
2023-05-02 11:13         ` Andrew Burgess
2023-05-02 14:48           ` Tom de Vries
2023-05-05 17:01             ` Andrew Burgess
2023-05-09  9:54               ` Andrew Burgess
2023-05-10  7:22                 ` Tom de Vries
2023-05-12 12:54                   ` Andrew Burgess
2023-03-31 20:20 ` [PATCH 5/5] gdb/testsuite: special case '^' in gdb_test pattern Andrew Burgess
2023-04-17 16:12 ` [PATCH 0/5] gdb/testsuite: stricter matching for gdb_test Tom Tromey
2023-04-27 12:58   ` Andrew Burgess

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=62e7b6208a24dea949d901aa1945a87e8683478e.1680293848.git.aburgess@redhat.com \
    --to=aburgess@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).