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

Tom de Vries vries@sourceware.org
Tue Jun 8 08:04:52 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ac6c175edd1f4574afbac8606e4954e83d061821

commit ac6c175edd1f4574afbac8606e4954e83d061821
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Jun 8 10:04:44 2021 +0200

    [gdb/testsuite] Simplify gdb.base/sect-cmd.exp
    
    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.
    
    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.

Diff:
---
 gdb/testsuite/ChangeLog             |  5 +++++
 gdb/testsuite/gdb.base/sect-cmd.exp | 19 ++++++-------------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a856e890f80..d89ef4a00cf 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-08  Tom de Vries  <tdevries@suse.de>
+
+	* gdb.base/sect-cmd.exp: Use gdb_test.  Use -wrap "".  Fix
+	test name.
+
 2021-06-08  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.base/sect-cmd.exp: Fix saw_section_address_line regexp.
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"


More information about the Gdb-cvs mailing list