From: Lancelot SIX Date: Fri, 19 Nov 2021 19:55:05 +0000 (+0000) Subject: gdb/testsuite: Remove duplicates from gdb.base/interp.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27e9a99fa02b635f5a89358c196fbf8f1670c6d7;p=binutils-gdb.git gdb/testsuite: Remove duplicates from gdb.base/interp.exp When running the testsuite I have: Running .../gdb/testsuite/gdb.base/interp.exp ... DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *" This is due to the fact that multiple successive instances of gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd to a new test name. Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set by gdb_test_multiple. While fixing this, this patch refactors all occurrences of the following pattern: set cmd foo gdb_test_multiple $cmd $cmd { -re ... { pass $cmd } } into gdb_test_multiple foo "" { -re ... { pass $gdb_test_name } } This makes this test file coherent in its use of $gdb_test_name. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp index 9e366571acb..f748ffd8050 100644 --- a/gdb/testsuite/gdb.base/interp.exp +++ b/gdb/testsuite/gdb.base/interp.exp @@ -22,10 +22,9 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } { } # Do not use gdb_test for this test, since it has two prompts. -set cmd "interpreter-exec mi \"-var-update *\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi \"-var-update *\"" "" { -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } @@ -37,47 +36,43 @@ gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*" gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \ "regression test for mi_parse crash" { -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi \"-stack-info-frame\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" { -re ".error,msg=.No registers\..\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi1 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi1 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi2 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } } } } -set cmd "interpreter-exec mi3 \"-break-insert main\"" -gdb_test_multiple $cmd $cmd { +gdb_test_multiple "interpreter-exec mi3 \"-break-insert main\"" "" { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { - pass "$cmd" + pass $gdb_test_name gdb_expect 1 { -re "\r\n$gdb_prompt $" { } }