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.
This commit is contained in:
Lancelot SIX 2021-11-19 22:48:59 +00:00
parent 27e9a99fa0
commit f05f3e7235

View file

@ -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}
delete_breakpoints
gdb_test_no_output "set basenames-may-differ on"
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\\."