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 2/2] gdb/testsuite: tighten up some end-of-line patterns
Date: Wed, 29 Nov 2023 17:55:44 +0000	[thread overview]
Message-ID: <90f05fc11d1bf8fc39af46ac057a48e1327174e2.1701280438.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1701280438.git.aburgess@redhat.com>

Following on from the previous commit, I searched the testsuite for
places where we did:

  set eol "<some pattern>"

in most cases the <some pattern> could be replaced with "\r\n" though
in the stabs test I've switched to using the multi_line proc as that
seemed like a better choice.

In gdb.ada/info_types.exp I did need to add an extra use of $eol as
the previous pattern would match multiple newlines, and in this one
place we were actually expecting to match multiple newlines.  The
tighter pattern only matches a single newline, so we now need to be
explicit when multiple newlines are expected -- I think this is a good
thing.

All the tests are still passing for me after these changes.
---
 gdb/testsuite/gdb.ada/catch_assert_if.exp |  2 +-
 gdb/testsuite/gdb.ada/catch_ex.exp        |  2 +-
 gdb/testsuite/gdb.ada/dyn_loc.exp         |  2 +-
 gdb/testsuite/gdb.ada/excep_handle.exp    |  2 +-
 gdb/testsuite/gdb.ada/frame_args.exp      |  2 +-
 gdb/testsuite/gdb.ada/info_types.exp      |  4 ++--
 gdb/testsuite/gdb.base/info-target.exp    |  2 +-
 gdb/testsuite/gdb.base/nofield.exp        |  2 +-
 gdb/testsuite/gdb.cp/local.exp            |  2 +-
 gdb/testsuite/gdb.stabs/exclfwd.exp       | 20 +++++++++++---------
 10 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/catch_assert_if.exp b/gdb/testsuite/gdb.ada/catch_assert_if.exp
index 4078fa408d1..9b094d88dc8 100644
--- a/gdb/testsuite/gdb.ada/catch_assert_if.exp
+++ b/gdb/testsuite/gdb.ada/catch_assert_if.exp
@@ -25,7 +25,7 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional
 
 clean_restart ${testfile}
 
-set eol "\[\r\n\]+"
+set eol "\r\n"
 set sp "\[ \t\]*"
 
 # Here is the scenario:
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index 388eb949e37..22175d83c07 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -29,7 +29,7 @@ clean_restart ${testfile}
 # the regular expressions below.
 set any_nb "\[0-9\]+"
 set any_addr "0x\[0-9a-zA-Z\]+"
-set eol "\[\r\n\]+"
+set eol "\r\n"
 set sp "\[ \t\]*"
 
 set info_break_header "Num${sp}Type${sp}Disp${sp}Enb${sp}Address${sp}What"
diff --git a/gdb/testsuite/gdb.ada/dyn_loc.exp b/gdb/testsuite/gdb.ada/dyn_loc.exp
index 5e656ca8ccf..ef30a3c41d7 100644
--- a/gdb/testsuite/gdb.ada/dyn_loc.exp
+++ b/gdb/testsuite/gdb.ada/dyn_loc.exp
@@ -30,7 +30,7 @@ if {![runto "pack.adb:$bp_location"]} {
   return -1
 }
 
-set eol "\[\r\n\]+"
+set eol "\r\n"
 
 set test "info locals"
 gdb_test_multiple "$test" "$test" {
diff --git a/gdb/testsuite/gdb.ada/excep_handle.exp b/gdb/testsuite/gdb.ada/excep_handle.exp
index deb3ace2987..590c7fccdec 100644
--- a/gdb/testsuite/gdb.ada/excep_handle.exp
+++ b/gdb/testsuite/gdb.ada/excep_handle.exp
@@ -27,7 +27,7 @@ clean_restart ${testfile}
 
 # Some global variables used to simplify the maintenance of some of
 # the regular expressions below.
-set eol "\[\r\n\]+"
+set eol "\r\n"
 set sp "\[ \t\]*"
 
 set when "when"
diff --git a/gdb/testsuite/gdb.ada/frame_args.exp b/gdb/testsuite/gdb.ada/frame_args.exp
index baaf5181121..891f241ce46 100644
--- a/gdb/testsuite/gdb.ada/frame_args.exp
+++ b/gdb/testsuite/gdb.ada/frame_args.exp
@@ -27,7 +27,7 @@ clean_restart ${testfile}
 
 set any_nb "\[0-9\]+"
 set any_addr "0x\[0-9a-zA-Z\]+"
-set eol "\[\r\n\]+"
+set eol "\r\n"
 set sp "\[ \t\]*"
 
 if {![runto break_me]} {
diff --git a/gdb/testsuite/gdb.ada/info_types.exp b/gdb/testsuite/gdb.ada/info_types.exp
index 2e1f51a6e4d..eac4bb5ae64 100644
--- a/gdb/testsuite/gdb.ada/info_types.exp
+++ b/gdb/testsuite/gdb.ada/info_types.exp
@@ -26,8 +26,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # when the Ada language is being used.
 gdb_test "set lang ada" ""
 
-set eol "\[\r\n\]+"
+set eol "\r\n"
 
 gdb_test "info types new_integer_type" \
-         "All types matching regular expression \"new_integer_type\":${eol}File .*info_types.c:${eol}.*\tint"
+         "All types matching regular expression \"new_integer_type\":${eol}${eol}File .*info_types.c:${eol}.*\tint"
 
diff --git a/gdb/testsuite/gdb.base/info-target.exp b/gdb/testsuite/gdb.base/info-target.exp
index ef55575aaf6..67e11c42520 100644
--- a/gdb/testsuite/gdb.base/info-target.exp
+++ b/gdb/testsuite/gdb.base/info-target.exp
@@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-set eol "\[\r\n\]+"
+set eol "\r\n"
 
 # Check the output of "info target".  Note that we are not interested
 # in this case in checking the actual info, but rather to make sure that
diff --git a/gdb/testsuite/gdb.base/nofield.exp b/gdb/testsuite/gdb.base/nofield.exp
index 6fbda7524c6..98c540f4cfd 100644
--- a/gdb/testsuite/gdb.base/nofield.exp
+++ b/gdb/testsuite/gdb.base/nofield.exp
@@ -20,7 +20,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
     return -1
 }
 
-set eol "\[\r\n\]+"
+set eol "\r\n"
 set sp "\[ \t\]*"
 
 clean_restart ${binfile}
diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp
index 67b3eb7308d..7d84f57117d 100644
--- a/gdb/testsuite/gdb.cp/local.exp
+++ b/gdb/testsuite/gdb.cp/local.exp
@@ -157,7 +157,7 @@ gdb_test "up" ".*main.*" "up from marker2"
 # Make sure that `Local' isn't in scope here; it's local to foobar.
 # setup_kfail "gdb/825"
 
-set eol "\[\t \]*\[\r\n\]+\[\t \]*"
+set eol "\[\t \]*\r\n\[\t \]*"
 gdb_test_multiple "ptype Local" "local out of scope" {
     -re "No symbol \"Local\" in current context.*${gdb_prompt} $" {
         pass "local out of scope"
diff --git a/gdb/testsuite/gdb.stabs/exclfwd.exp b/gdb/testsuite/gdb.stabs/exclfwd.exp
index a6e6ff86046..7492dc5ebb4 100644
--- a/gdb/testsuite/gdb.stabs/exclfwd.exp
+++ b/gdb/testsuite/gdb.stabs/exclfwd.exp
@@ -35,19 +35,21 @@ if {![runto_main]} {
 
 get_debug_format
 
-set eol "\[ \t\]*\[\n\r\]+"
-
-gdb_test "ptype v1" "type = struct a {$eol
-    int x;$eol
-    int y;$eol
-}"
+gdb_test "ptype v1" \
+    [multi_line \
+	 "type = struct a {" \
+	 "    int x;" \
+	 "    int y;" \
+	 "}"]
 
 if {[test_debug_format "stabs"]} {
     setup_kfail "gdb/1602" *-*-*
 }
-gdb_test "ptype v2" "type = struct a {$eol
-    const char .c;$eol
-}"
+gdb_test "ptype v2" \
+    [multi_line \
+	 "type = struct a {" \
+	 "    const char .c;" \
+	 "}"]
 
 if {[test_debug_format "stabs"]} {
     setup_kfail "gdb/1603" *-*-*
-- 
2.25.4


  parent reply	other threads:[~2023-11-29 17:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 17:55 [PATCH 0/2] A few minor testsuite cleanups Andrew Burgess
2023-11-29 17:55 ` [PATCH 1/2] gdb/testsuite: fix gdb.ada/complete.exp timeout in READ1 mode Andrew Burgess
2023-11-30 19:22   ` Tom Tromey
2023-11-29 17:55 ` Andrew Burgess [this message]
2023-11-30 19:23   ` [PATCH 2/2] gdb/testsuite: tighten up some end-of-line patterns Tom Tromey
2023-12-08 22:25     ` Tom de Vries
2023-12-09  6:59       ` Tom de Vries
2023-12-11 14:52         ` Andrew Burgess
2023-12-11 14:55           ` Tom de Vries
2023-12-11 16:16             ` Tom de Vries
2023-12-11 16:44               ` Andrew Burgess
2023-12-08 18:07 ` [PATCH 0/2] A few minor testsuite cleanups 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=90f05fc11d1bf8fc39af46ac057a48e1327174e2.1701280438.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).