Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/6] Fix racy output matching in gdb.base/memattr.exp
Date: Thu, 26 Oct 2017 17:42:00 -0000	[thread overview]
Message-ID: <1509039747-15026-4-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1509039747-15026-1-git-send-email-palves@redhat.com>

Testing with:
 $ make check-read1 TESTS="gdb.base/memattr.exp"


Exposes a testcase bug that can result in racy fails:

  info mem
  Using user-defined memory regions.
  Num Enb Low Addr           High Addr          Attrs
  1   y   0x0000000000601060 0x0000000000601160 wo nocache
  2   y   0x0000000000601180 0x0000000000601280 ro nocache
  4   y   0x0000000000601280 0x0000000000601380 rw nocache
  3   y   0x0000000000601380 0x0000000000601480 rw nocache
  5   y   0x0000000000601480 0x0000000000601580 rw nocache
  (gdb) FAIL: gdb.base/memattr.exp: info mem (1)

The problem is that:

  "Attrs\[^\n\r]*.."

matches:

  "Attrs \r"

when the output buffer is filled with partial output like this:

  "info mem\r\nUsing user-defined memory regions.\r\nNum Enb Low Addr           High Addr          Attrs \r"

gdb/testsuite/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* gdb.base/memattr.exp: Tighten regexes to match the end line.
---
 gdb/testsuite/gdb.base/memattr.exp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp
index 48f0496..88eb51c 100644
--- a/gdb/testsuite/gdb.base/memattr.exp
+++ b/gdb/testsuite/gdb.base/memattr.exp
@@ -114,30 +114,30 @@ set see4 0
 set see5 0
 
 set info_mem_header_pattern \
-    "info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\n\r]*.."
+    "info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\r\n\]*\r\n"
 
 gdb_test_multiple "info mem" "info mem(1)" {
     -re ${info_mem_header_pattern} {
 	# Discard the header.
 	exp_continue
     }
-    -re "^1   y  \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." {
+    -re "^1   y  \[ \t\]+$hex $hex wo nocache \[^\r\n\]*\r\n" {
 	set see1 1
 	exp_continue
     }
-    -re "^2   y  \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." {
+    -re "^2   y  \[ \t\]+$hex $hex ro nocache \[^\r\n\]*\r\n" {
 	set see2 1
 	exp_continue
     }
-    -re "^3   y  \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
+    -re "^3   y  \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" {
 	set see3 1
 	exp_continue
     }
-    -re "^4   y  \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
+    -re "^4   y  \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" {
 	set see4 1
 	exp_continue
     }
-    -re "^5   y  \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." {
+    -re "^5   y  \[ \t\]+$hex $hex rw nocache \[^\r\n\]*\r\n" {
 	set see5 1
 	exp_continue
     }
-- 
2.5.5


  reply	other threads:[~2017-10-26 17:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26 17:42 [PATCH 0/6] Fix several cases of racy output matching Pedro Alves
2017-10-26 17:42 ` Pedro Alves [this message]
2017-10-26 17:42 ` [PATCH 1/6] Fix racy output matching in gdb.asm/asm-source.exp Pedro Alves
2017-10-26 17:42 ` [PATCH 6/6] Fix racy output matching in gdb.tui/tui-completion.exp Pedro Alves
2017-11-15 16:09   ` Simon Marchi
2017-11-15 16:16     ` Pedro Alves
2017-10-26 17:42 ` [PATCH 4/6] Fix racy output matching in gdb.base/cpcompletion.exp Pedro Alves
2017-10-26 17:42 ` [PATCH 5/6] Fix racy output matching in gdb.base/multi-attach.exp, gdb.server/ext-{attach, restart, ext-run}.exp Pedro Alves
2017-10-26 17:42 ` [PATCH 2/6] Fix racy output matching in gdb.base/completion.exp Pedro Alves
2017-11-09 22:50 ` [PATCH 0/6] Fix several cases of racy output matching Pedro Alves

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=1509039747-15026-4-git-send-email-palves@redhat.com \
    --to=palves@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