From: Andrew Burgess Date: Wed, 26 Aug 2020 13:05:45 +0000 (+0100) Subject: gdb/testsuite: make test names unique in gdb.arch/*.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2015ce4a4019ab9b026f13c33a7f55e8e0d77a0;p=binutils-gdb.git gdb/testsuite: make test names unique in gdb.arch/*.exp Make the test names unique in gdb.arch/*.exp by either modifying the test names or using with_test_prefix. I have also fixed a typo 'forth' -> 'fourth' throughout gdb.arch/*. Finally, I replaced code like this: gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ "Breakpoint .* at .*${srcfile}.*" \ "set first breakpoint in main" With this: gdb_breakpoint [gdb_get_line_number "first breakpoint here"] In those files that I was already modifying for the other reasons given above. gdb/testsuite/ChangeLog: * gdb.arch/amd64-byte.exp: Make test names unique, use gdb_breakpoint, and fix typo 'forth' -> 'fourth'. * gdb.arch/amd64-dword.exp: Likewise. * gdb.arch/amd64-pseudo.c: Fix typo 'forth' -> 'fourth'. * gdb.arch/amd64-stap-special-operands.exp: Make test names unique. * gdb.arch/amd64-tailcall-ret.exp: Likewise. * gdb.arch/amd64-word.exp: Make test names unique, use gdb_breakpoint, and fix typo 'forth' -> 'fourth'. * gdb.arch/i386-byte.exp: Make test names unique, use gdb_breakpoint. * gdb.arch/i386-word.exp: Likewise. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cb2945697ad..8da561ea650 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2020-08-27 Andrew Burgess + + * gdb.arch/amd64-byte.exp: Make test names unique, use + gdb_breakpoint, and fix typo 'forth' -> 'fourth'. + * gdb.arch/amd64-dword.exp: Likewise. + * gdb.arch/amd64-pseudo.c: Fix typo 'forth' -> 'fourth'. + * gdb.arch/amd64-stap-special-operands.exp: Make test names + unique. + * gdb.arch/amd64-tailcall-ret.exp: Likewise. + * gdb.arch/amd64-word.exp: Make test names unique, use + gdb_breakpoint, and fix typo 'forth' -> 'fourth'. + * gdb.arch/i386-byte.exp: Make test names unique, use + gdb_breakpoint. + * gdb.arch/i386-word.exp: Likewise. + 2020-08-25 Shahab Vahedi * gdb.arch/arc-tdesc-cpu.xml: Use new feature names. diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp index 0b46d6f9f8b..19cf5ff1a89 100644 --- a/gdb/testsuite/gdb.arch/amd64-byte.exp +++ b/gdb/testsuite/gdb.arch/amd64-byte.exp @@ -61,73 +61,73 @@ set byte_regs(16) bh set byte_regs(17) ch set byte_regs(18) dh -gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set first breakpoint in main" +gdb_breakpoint [gdb_get_line_number "first breakpoint here"] gdb_continue_to_breakpoint "continue to first breakpoint in main" -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "print/x \$$byte_regs($r)" \ - ".. = 0x[format %x $r]1" \ - "check contents of %$byte_regs($r)" +with_test_prefix "at first bp" { + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "print/x \$$byte_regs($r)" \ + ".. = 0x[format %x $r]1" \ + "check contents of %$byte_regs($r)" + } + + for { set r 1 } { $r <= 4 } { incr r } { + set h [expr $r + 14] + gdb_test "print/x \$$byte_regs($h)" \ + ".. = 0x[format %x $r]2" \ + "check contents of %$byte_regs($h)" + } } -for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] - gdb_test "print/x \$$byte_regs($h)" \ - ".. = 0x[format %x $r]2" \ - "check contents of %$byte_regs($h)" -} - -gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set second breakpoint in main" +gdb_breakpoint [gdb_get_line_number "second breakpoint here"] gdb_continue_to_breakpoint "continue to second breakpoint in main" -for { set r 7 } { $r <= 14 } { incr r } { - gdb_test "print/x \$$byte_regs($r)" \ - ".. = 0x[format %x $r]1" \ - "check contents of %$byte_regs($r)" -} - -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" -} - -for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] - gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" +with_test_prefix "at second bp" { + for { set r 7 } { $r <= 14 } { incr r } { + gdb_test "print/x \$$byte_regs($r)" \ + ".. = 0x[format %x $r]1" \ + "check contents of %$byte_regs($r)" + } + + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" + } + + for { set r 1 } { $r <= 4 } { incr r } { + set h [expr $r + 14] + gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" + } } -gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set third breakpoint in main" +gdb_breakpoint [gdb_get_line_number "third breakpoint here"] gdb_continue_to_breakpoint "continue to third breakpoint in main" -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "print \$$byte_regs($r)" \ - ".. = $r" \ - "check contents of %$byte_regs($r)" -} - -for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] - gdb_test "print \$$byte_regs($h)" \ - ".. = $h" \ - "check contents of %$byte_regs($h)" -} - -for { set r 7 } { $r <= 14 } { incr r } { - gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" +with_test_prefix "at third bp" { + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "print \$$byte_regs($r)" \ + ".. = $r" \ + "check contents of %$byte_regs($r)" + } + + for { set r 1 } { $r <= 4 } { incr r } { + set h [expr $r + 14] + gdb_test "print \$$byte_regs($h)" \ + ".. = $h" \ + "check contents of %$byte_regs($h)" + } + + for { set r 7 } { $r <= 14 } { incr r } { + gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" + } } -gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set forth breakpoint in main" -gdb_continue_to_breakpoint "continue to forth breakpoint in main" +gdb_breakpoint [gdb_get_line_number "fourth breakpoint here"] +gdb_continue_to_breakpoint "continue to fourth breakpoint in main" -for { set r 7 } { $r <= 14 } { incr r } { - gdb_test "print \$$byte_regs($r)" \ - ".. = $r" \ - "check contents of %$byte_regs($r)" +with_test_prefix "at fourth bp" { + for { set r 7 } { $r <= 14 } { incr r } { + gdb_test "print \$$byte_regs($r)" \ + ".. = $r" \ + "check contents of %$byte_regs($r)" + } } diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp index bce411db261..f2841aafafa 100644 --- a/gdb/testsuite/gdb.arch/amd64-dword.exp +++ b/gdb/testsuite/gdb.arch/amd64-dword.exp @@ -58,56 +58,56 @@ set dword_regs(12) r13d set dword_regs(13) r14d set dword_regs(14) r15d -gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set first breakpoint in main" +gdb_breakpoint [gdb_get_line_number "first breakpoint here"] gdb_continue_to_breakpoint "continue to first breakpoint in main" -for { set r 1 } { $r <= 6 } { incr r } { - set hexr [format %x $r] - gdb_test "print/x \$$dword_regs($r)" \ - ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \ - "check contents of %$dword_regs($r)" +with_test_prefix "at first bp" { + for { set r 1 } { $r <= 6 } { incr r } { + set hexr [format %x $r] + gdb_test "print/x \$$dword_regs($r)" \ + ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \ + "check contents of %$dword_regs($r)" + } } -gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set second breakpoint in main" +gdb_breakpoint [gdb_get_line_number "second breakpoint here"] gdb_continue_to_breakpoint "continue to second breakpoint in main" -for { set r 7 } { $r <= $nr_regs } { incr r } { - set hexr [format %x $r] - gdb_test "print/x \$$dword_regs($r)" \ - ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \ - "check contents of %$dword_regs($r)" +with_test_prefix "at second bp" { + for { set r 7 } { $r <= $nr_regs } { incr r } { + set hexr [format %x $r] + gdb_test "print/x \$$dword_regs($r)" \ + ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \ + "check contents of %$dword_regs($r)" + } + + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)" + } } -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)" -} - -gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set third breakpoint in main" +gdb_breakpoint [gdb_get_line_number "third breakpoint here"] gdb_continue_to_breakpoint "continue to third breakpoint in main" -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "print \$$dword_regs($r)" \ - ".. = $r" \ - "check contents of %$dword_regs($r)" -} +with_test_prefix "at third bp" { + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "print \$$dword_regs($r)" \ + ".. = $r" \ + "check contents of %$dword_regs($r)" + } -for { set r 7 } { $r <= $nr_regs } { incr r } { - gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)" + for { set r 7 } { $r <= $nr_regs } { incr r } { + gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)" + } } -gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set forth breakpoint in main" -gdb_continue_to_breakpoint "continue to forth breakpoint in main" +gdb_breakpoint [gdb_get_line_number "fourth breakpoint here"] +gdb_continue_to_breakpoint "continue to fourth breakpoint in main" -for { set r 7 } { $r <= $nr_regs } { incr r } { - gdb_test "print \$$dword_regs($r)" \ - ".. = $r" \ - "check contents of %$dword_regs($r)" +with_test_prefix "at fourth bp" { + for { set r 7 } { $r <= $nr_regs } { incr r } { + gdb_test "print \$$dword_regs($r)" \ + ".. = $r" \ + "check contents of %$dword_regs($r)" + } } diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo.c b/gdb/testsuite/gdb.arch/amd64-pseudo.c index 4c3d3cc5b1b..50bb15eaa30 100644 --- a/gdb/testsuite/gdb.arch/amd64-pseudo.c +++ b/gdb/testsuite/gdb.arch/amd64-pseudo.c @@ -118,7 +118,7 @@ main (int argc, char **argv) a temp to build %0. */ "r" (r8), "r" (r9), "r" (r10), "r" (r11), "r" (r12), "r" (r13), "r" (r14), "r" (r15)); - puts ("Bye!"); /* forth breakpoint here */ + puts ("Bye!"); /* fourth breakpoint here */ return 0; } diff --git a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp index 0dbcb4d6b9d..1e2ce1959f9 100644 --- a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp +++ b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp @@ -19,13 +19,15 @@ if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } { } proc test_probe { probe_name } { - if { ![runto "-pstap $probe_name"] } { - fail "run to probe $probe_name" - return + with_test_prefix "probe: ${probe_name}" { + if { ![runto "-pstap $probe_name"] } { + fail "run to probe $probe_name" + return + } + + gdb_test "print \$_probe_argc" " = 1" + gdb_test "print \$_probe_arg0" " = 10" } - - gdb_test "print \$_probe_argc" " = 1" - gdb_test "print \$_probe_arg0" " = 10" } standard_testfile amd64-stap-triplet.S diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp index 4dc5cd815f6..60c9a504176 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp @@ -34,11 +34,11 @@ if ![runto_main] { } gdb_breakpoint "g" -gdb_continue_to_breakpoint "g" ".* v = 2;" +gdb_continue_to_breakpoint "first time in g" ".* v = 2;" gdb_test "return" { f \(\); /\* second \*/} "return" \ {Make g return now\? \(y or n\) } "y" -gdb_continue_to_breakpoint "g" ".* v = 2;" +gdb_continue_to_breakpoint "second time in g" ".* v = 2;" gdb_test "finish" " v = 3;" diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp index 4ede5482f13..9f5e5d7e9cc 100644 --- a/gdb/testsuite/gdb.arch/amd64-word.exp +++ b/gdb/testsuite/gdb.arch/amd64-word.exp @@ -58,56 +58,56 @@ set word_regs(12) r13w set word_regs(13) r14w set word_regs(14) r15w -gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set first breakpoint in main" +gdb_breakpoint [gdb_get_line_number "first breakpoint here"] gdb_continue_to_breakpoint "continue to first breakpoint in main" -for { set r 1 } { $r <= 6 } { incr r } { - set hexr [format %x $r] - gdb_test "print/x \$$word_regs($r)" \ - ".. = 0x${hexr}2${hexr}1" \ - "check contents of %$word_regs($r)" +with_test_prefix "at first bp" { + for { set r 1 } { $r <= 6 } { incr r } { + set hexr [format %x $r] + gdb_test "print/x \$$word_regs($r)" \ + ".. = 0x${hexr}2${hexr}1" \ + "check contents of %$word_regs($r)" + } } -gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set second breakpoint in main" +gdb_breakpoint [gdb_get_line_number "second breakpoint here"] gdb_continue_to_breakpoint "continue to second breakpoint in main" -for { set r 7 } { $r <= $nr_regs } { incr r } { - set hexr [format %x $r] - gdb_test "print/x \$$word_regs($r)" \ - ".. = 0x${hexr}2${hexr}1" \ - "check contents of %$word_regs($r)" +with_test_prefix "at second bp" { + for { set r 7 } { $r <= $nr_regs } { incr r } { + set hexr [format %x $r] + gdb_test "print/x \$$word_regs($r)" \ + ".. = 0x${hexr}2${hexr}1" \ + "check contents of %$word_regs($r)" + } + + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" + } } -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" -} - -gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set third breakpoint in main" +gdb_breakpoint [gdb_get_line_number "third breakpoint here"] gdb_continue_to_breakpoint "continue to third breakpoint in main" -for { set r 1 } { $r <= 6 } { incr r } { - gdb_test "print \$$word_regs($r)" \ - ".. = $r" \ - "check contents of %$word_regs($r)" -} +with_test_prefix "at third bp" { + for { set r 1 } { $r <= 6 } { incr r } { + gdb_test "print \$$word_regs($r)" \ + ".. = $r" \ + "check contents of %$word_regs($r)" + } -for { set r 7 } { $r <= $nr_regs } { incr r } { - gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" + for { set r 7 } { $r <= $nr_regs } { incr r } { + gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" + } } -gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set forth breakpoint in main" -gdb_continue_to_breakpoint "continue to forth breakpoint in main" +gdb_breakpoint [gdb_get_line_number "fourth breakpoint here"] +gdb_continue_to_breakpoint "continue to fourth breakpoint in main" -for { set r 7 } { $r <= $nr_regs } { incr r } { - gdb_test "print \$$word_regs($r)" \ - ".. = $r" \ - "check contents of %$word_regs($r)" +with_test_prefix "at fourth bp" { + for { set r 7 } { $r <= $nr_regs } { incr r } { + gdb_test "print \$$word_regs($r)" \ + ".. = $r" \ + "check contents of %$word_regs($r)" + } } diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp index aa5b8d7bea0..8903346158f 100644 --- a/gdb/testsuite/gdb.arch/i386-byte.exp +++ b/gdb/testsuite/gdb.arch/i386-byte.exp @@ -51,38 +51,38 @@ set byte_regs(6) bh set byte_regs(7) ch set byte_regs(8) dh -gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set first breakpoint in main" +gdb_breakpoint [gdb_get_line_number "first breakpoint here"] gdb_continue_to_breakpoint "continue to first breakpoint in main" -for { set r 1 } { $r <= 4 } { incr r } { - gdb_test "print/x \$$byte_regs($r)" \ - ".. = 0x[format %x $r]1" \ - "check contents of %$byte_regs($r)" - set h [expr $r + 4] - gdb_test "print/x \$$byte_regs($h)" \ - ".. = 0x[format %x $r]2" \ - "check contents of %$byte_regs($h)" +with_test_prefix "at first bp" { + for { set r 1 } { $r <= 4 } { incr r } { + gdb_test "print/x \$$byte_regs($r)" \ + ".. = 0x[format %x $r]1" \ + "check contents of %$byte_regs($r)" + set h [expr $r + 4] + gdb_test "print/x \$$byte_regs($h)" \ + ".. = 0x[format %x $r]2" \ + "check contents of %$byte_regs($h)" + } + + for { set r 1 } { $r <= 4 } { incr r } { + gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" + set h [expr $r + 4] + gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" + } } -for { set r 1 } { $r <= 4 } { incr r } { - gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" - set h [expr $r + 4] - gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" -} - -gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set second breakpoint in main" +gdb_breakpoint [gdb_get_line_number "second breakpoint here"] gdb_continue_to_breakpoint "continue to second breakpoint in main" -for { set r 1 } { $r <= 4 } { incr r } { - gdb_test "print \$$byte_regs($r)" \ - ".. = $r" \ - "check contents of %$byte_regs($r)" - set h [expr $r + 4] - gdb_test "print \$$byte_regs($h)" \ - ".. = $h" \ - "check contents of %$byte_regs($h)" +with_test_prefix "at second bp" { + for { set r 1 } { $r <= 4 } { incr r } { + gdb_test "print \$$byte_regs($r)" \ + ".. = $r" \ + "check contents of %$byte_regs($r)" + set h [expr $r + 4] + gdb_test "print \$$byte_regs($h)" \ + ".. = $h" \ + "check contents of %$byte_regs($h)" + } } diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp index 336ea27a1f6..55c2ea62af0 100644 --- a/gdb/testsuite/gdb.arch/i386-word.exp +++ b/gdb/testsuite/gdb.arch/i386-word.exp @@ -47,28 +47,28 @@ set word_regs(2) bx set word_regs(3) cx set word_regs(4) dx -gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set first breakpoint in main" +gdb_breakpoint [gdb_get_line_number "first breakpoint here"] gdb_continue_to_breakpoint "continue to first breakpoint in main" -for { set r 1 } { $r <= 4 } { incr r } { - gdb_test "print/x \$$word_regs($r)" \ - ".. = 0x[format %x $r]2[format %x $r]1" \ - "check contents of %$word_regs($r)" -} +with_test_prefix "at first bp" { + for { set r 1 } { $r <= 4 } { incr r } { + gdb_test "print/x \$$word_regs($r)" \ + ".. = 0x[format %x $r]2[format %x $r]1" \ + "check contents of %$word_regs($r)" + } -for { set r 1 } { $r <= 4 } { incr r } { - gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" + for { set r 1 } { $r <= 4 } { incr r } { + gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" + } } -gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ - "Breakpoint .* at .*${srcfile}.*" \ - "set second breakpoint in main" +gdb_breakpoint [gdb_get_line_number "second breakpoint here"] gdb_continue_to_breakpoint "continue to second breakpoint in main" -for { set r 1 } { $r <= 4 } { incr r } { - gdb_test "print \$$word_regs($r)" \ - ".. = $r" \ - "check contents of %$word_regs($r)" +with_test_prefix "at second bp" { + for { set r 1 } { $r <= 4 } { incr r } { + gdb_test "print \$$word_regs($r)" \ + ".. = $r" \ + "check contents of %$word_regs($r)" + } }