[binutils-gdb] gdb/testsuite: Remove duplicates from gdb.base/realname-expand.exp

Lancelot SIX lsix@sourceware.org
Fri Jan 7 22:44:45 GMT 2022


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

commit f05f3e723568756ac523ffddfe90fe6ed12dbb95
Author: Lancelot SIX <lsix@lancelotsix.com>
Date:   Fri Nov 19 22:48:59 2021 +0000

    gdb/testsuite: Remove duplicates from gdb.base/realname-expand.exp
    
    When running the testsuite, I have:
    
        Running .../gdb/testsuite/gdb.base/realname-expand.exp ...
        DUPLICATE: gdb.base/realname-expand.exp: set basenames-may-differ on
    
    This is due to the fact that the test restarts GDB twice and each time
    sets the basenames-may-differ setting.  This patch proposes to fix this
    by not restarting GDB so the setting is maintained.  It just clears the
    breakpoints between the two tests and updates the breakpoints number as
    required.
    
    This patch also perform some minor refactorings to improve visibility.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.base/realname-expand.exp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/realname-expand.exp b/gdb/testsuite/gdb.base/realname-expand.exp
index 63299cd5b5c..b476ef876ef 100644
--- a/gdb/testsuite/gdb.base/realname-expand.exp
+++ b/gdb/testsuite/gdb.base/realname-expand.exp
@@ -40,10 +40,12 @@ clean_restart ${testfile}
 
 gdb_test_no_output "set basenames-may-differ on"
 
-gdb_test "rbreak realname-expand-real.c:func" "^rbreak realname-expand-real.c:func\r\nBreakpoint 1 at 0x\[0-9a-f\]+: file \[^\r\n\]*/realname-expand-link\\.c, line \[0-9\]+\\.\r\nvoid func\\(void\\);"
+gdb_test "rbreak realname-expand-real.c:func" \
+    [multi_line "" \
+		"Breakpoint 1 at $hex: file \[^\r\n\]*/realname-expand-link\\.c, line $decimal\\." \
+		"void func\\(void\\);"]
 
-clean_restart ${testfile}
-
-gdb_test_no_output "set basenames-may-differ on"
+delete_breakpoints
 
-gdb_test "break realname-expand-real.c:func" "^break realname-expand-real.c:func\r\nBreakpoint 1 at 0x\[0-9a-f\]+: file \[^\r\n\]*/realname-expand-link\\.c, line \[0-9\]+\\."
+gdb_test "break realname-expand-real.c:func" \
+    "\r\nBreakpoint 2 at $hex: file \[^\r\n\]*/realname-expand-link\\.c, line $decimal\\."


More information about the Gdb-cvs mailing list