public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Simplify gdb.base/sect-cmd.exp
Date: Tue, 8 Jun 2021 10:05:49 +0200	[thread overview]
Message-ID: <20210608080547.GA14627@delia> (raw)

Hi,

While looking at gdb.base/sect-cmd.exp, I noticed a few things that can be
simplified:
- use gdb_test instead of gdb_test_multiple
- use -wrap "" as regexp

Also, I noticed this:
...
           fail "$gdb_test_name, saw not found marker"
...
while our usual test naming scheme uses parentheses, like so:
...
           fail "$gdb_test_name (saw not found marker)"
...

Fix the test-name and do the simplifications.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Simplify gdb.base/sect-cmd.exp

gdb/testsuite/ChangeLog:

2021-06-08  Tom de Vries  <tdevries@suse.de>

	* gdb.base/sect-cmd.exp: Use gdb_test.  Use -wrap "".  Fix
	test name.

---
 gdb/testsuite/gdb.base/sect-cmd.exp | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp
index cb1e4464a69..387198d3732 100644
--- a/gdb/testsuite/gdb.base/sect-cmd.exp
+++ b/gdb/testsuite/gdb.base/sect-cmd.exp
@@ -63,21 +63,17 @@ gdb_test_multiple "section $section_name $address1" \
 	    exp_continue
 	}
 	-re "Section \[^\r\n\]+ not found\r\n" {
-	    fail "$gdb_test_name, saw not found marker"
+	    fail "$gdb_test_name (saw not found marker)"
 	    exp_continue
 	}
-	-re "$gdb_prompt $" {
+	-re -wrap "" {
 	    gdb_assert { $saw_section_address_line } $gdb_test_name
 	}
     }
 
 # Verify that GDB responds gracefully to a non-existent section name.
 #
-gdb_test_multiple "section FOOBARBAZ 0x1234" "" {
-    -re -wrap "Section FOOBARBAZ not found" {
-	pass $gdb_test_name
-    }
-}
+gdb_test "section FOOBARBAZ 0x1234" "Section FOOBARBAZ not found"
 
 # Check that GDB can still print the error message when the section
 # name is very long.  It used to be the case that GDB could only print
@@ -86,9 +82,6 @@ gdb_test_multiple "section FOOBARBAZ 0x1234" "" {
 #
 set long_sect_name \
     "A234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"
-gdb_test_multiple "section $long_sect_name 0x1234" \
-    "non-existent too-long section disallowed" {
-	-re -wrap "Section $long_sect_name not found" {
-	    pass $gdb_test_name
-	}
-    }
+gdb_test "section $long_sect_name 0x1234" \
+    "Section $long_sect_name not found" \
+    "non-existent too-long section disallowed"

                 reply	other threads:[~2021-06-08  8:05 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=20210608080547.GA14627@delia \
    --to=tdevries@suse.de \
    --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).