]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: tighten up some end-of-line patterns
authorAndrew Burgess <aburgess@redhat.com>
Wed, 29 Nov 2023 16:10:46 +0000 (16:10 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 8 Dec 2023 18:06:27 +0000 (18:06 +0000)
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.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.ada/catch_assert_if.exp
gdb/testsuite/gdb.ada/catch_ex.exp
gdb/testsuite/gdb.ada/dyn_loc.exp
gdb/testsuite/gdb.ada/excep_handle.exp
gdb/testsuite/gdb.ada/frame_args.exp
gdb/testsuite/gdb.ada/info_types.exp
gdb/testsuite/gdb.base/info-target.exp
gdb/testsuite/gdb.base/nofield.exp
gdb/testsuite/gdb.cp/local.exp
gdb/testsuite/gdb.stabs/exclfwd.exp

index 4078fa408d17b423d8ca180e1fbcfc48b1dd7e84..9b094d88dc8aea65274f5137cf31ac2abdadc659 100644 (file)
@@ -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:
index 388eb949e37715a358943d4c8cad8fad7a3a79bd..22175d83c0727630d45ee857630972563ade60c1 100644 (file)
@@ -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"
index 5e656ca8ccf3d83fa583b41f69d8386e9cb340f2..ef30a3c41d7ba1174f9f2667e02a61c39037ebd5 100644 (file)
@@ -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" {
index deb3ace298738e982b7518daa7be7eff0ae8f262..590c7fccdec9e0f05b32b4cf75e0054a14c675ec 100644 (file)
@@ -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"
index baaf51811218ae051604150bfb95097d16eb34de..891f241ce4693319a0bacc5d6e006d1883a15e2a 100644 (file)
@@ -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]} {
index 2e1f51a6e4d402f2ce3095a9215478fdb748905d..eac4bb5ae64dc69fd5944f66716e5a397a4e2f01 100644 (file)
@@ -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"
 
index ef55575aaf62a04d7bb8536e5af1ab7a31959fce..67e11c4252015e4abcc8fb9b7e2a7d000fba00aa 100644 (file)
@@ -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
index 6fbda7524c617d077b69dc7508a217609964f977..98c540f4cfd51649de13235de385dfdf02e5a33f 100644 (file)
@@ -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}
index 67b3eb7308d7063a1fc5dceb2b6d62b60ee9a9e2..7d84f57117db71f8e6438165642b118ec167da57 100644 (file)
@@ -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"
index a6e6ff860462ac15635c091ae26c00da6f05f5ee..7492dc5ebb40bd419e2009077932de7de39a7c6a 100644 (file)
@@ -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" *-*-*