public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, testsuite] Fix some duplicate test names
@ 2020-05-26 14:18 Luis Machado
  2020-05-26 15:35 ` Pedro Alves
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Luis Machado @ 2020-05-26 14:18 UTC (permalink / raw)
  To: gdb-patches

While doing a testsuite run on aarch64-linux, I noticed a bunch of duplicated
test name results. It annoyed me a little, so I decided to go ahead and fix the
worst offenders.

The following patch brings the duplicate test names down from 461 to 137.

The remaining ones are mostly scattered across the testsuite, with 1 to 3
duplicates per testcase. We can fix those as we go, or if I get annoyed with
them again.

It is worth mentioning that making those stand out and be annoying worked
nicely as a motivation to get them fixed.

I've confirmed the tests are still passing, but would be nice to have another
pair of eyes to make sure things are sane, given the changes are mostly
mechanical.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Luis Machado  <luis.machado@linaro.org>

	* gdb.arch/aarch64-sighandler-regs.exp: Fix duplicated test names.
	* gdb.arch/aarch64-tagged-pointer.exp: Likewise.
	* gdb.arch/arm-disassembler-options.exp: Likewise.
	* gdb.arch/arm-disp-step.exp: Likewise.
	* gdb.arch/thumb-prologue.exp: Likewise.
	* gdb.base/async.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/complex-parts.exp: Likewise.
	* gdb.base/ena-dis-br.exp: Likewise.
	* gdb.base/foll-exec.exp: Likewise.
	* gdb.base/permissions.exp: Likewise.
	* gdb.base/relocate.exp: Likewise.
	* gdb.base/return2.exp: Likewise.
	* gdb.base/sigbpt.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.cp/converts.exp: Likewise.
	* gdb.cp/exceptprint.exp: Likewise.
	* gdb.cp/inherit.exp: Likewise.
	* gdb.cp/nsnoimports.exp: Likewise.
	* gdb.cp/virtbase2.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/var-cmd.c: Likewise.
---
 .../gdb.arch/aarch64-sighandler-regs.exp      |  67 ++++++-----
 .../gdb.arch/aarch64-tagged-pointer.exp       |   8 +-
 .../gdb.arch/arm-disassembler-options.exp     |   2 +-
 gdb/testsuite/gdb.arch/arm-disp-step.exp      |   8 +-
 gdb/testsuite/gdb.arch/thumb-prologue.exp     |   2 +-
 gdb/testsuite/gdb.base/async.exp              |   2 +-
 gdb/testsuite/gdb.base/auxv.exp               |   4 +-
 gdb/testsuite/gdb.base/complex-parts.exp      |  12 +-
 gdb/testsuite/gdb.base/ena-dis-br.exp         |  27 ++++-
 gdb/testsuite/gdb.base/foll-exec.exp          |  12 +-
 gdb/testsuite/gdb.base/permissions.exp        |  59 +++++-----
 gdb/testsuite/gdb.base/relocate.exp           | 104 +++++++++++-------
 gdb/testsuite/gdb.base/return2.exp            |   2 +-
 gdb/testsuite/gdb.base/sigbpt.exp             |   8 +-
 gdb/testsuite/gdb.base/siginfo-obj.exp        |  36 +++---
 gdb/testsuite/gdb.cp/converts.exp             |  60 +++++-----
 gdb/testsuite/gdb.cp/exceptprint.exp          |  24 ++--
 gdb/testsuite/gdb.cp/inherit.exp              |  11 +-
 gdb/testsuite/gdb.cp/nsnoimports.exp          |  44 ++++----
 gdb/testsuite/gdb.cp/virtbase2.exp            |  28 +++--
 gdb/testsuite/gdb.mi/mi-var-cmd.exp           |  28 +++--
 gdb/testsuite/gdb.mi/var-cmd.c                |  34 +++---
 22 files changed, 339 insertions(+), 243 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
index 9faab7897c..1dedd336b5 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
@@ -100,16 +100,18 @@ set mainframe [expr $handlerframe + 2]
 
 # Check register values
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 1st" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+  }
 }
 
 # Switch to the frame for main(), and check register values
@@ -118,16 +120,19 @@ gdb_test "frame $mainframe" \
       "#$mainframe.*in main ().*" \
       "set to main frame"
 
-check_regs x $xreg_nums $reg_main_value_64 ""
-check_regs v $vreg_nums $reg_main_value_128 ".q.u"
-check_regs q $vreg_nums $reg_main_value_128 ".u"
-check_regs d $vreg_nums $reg_main_value_64 ".u"
-check_regs s $vreg_nums $reg_main_value_32 ".u"
-check_regs h $vreg_nums $reg_main_value_16 ".u"
-check_regs b $vreg_nums $reg_main_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_main_value ".d.u"
-  check_regs p $preg_nums $preg_main_value ""
+
+with_test_prefix "main frame" {
+  check_regs x $xreg_nums $reg_main_value_64 ""
+  check_regs v $vreg_nums $reg_main_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_main_value_128 ".u"
+  check_regs d $vreg_nums $reg_main_value_64 ".u"
+  check_regs s $vreg_nums $reg_main_value_32 ".u"
+  check_regs h $vreg_nums $reg_main_value_16 ".u"
+  check_regs b $vreg_nums $reg_main_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_main_value ".d.u"
+    check_regs p $preg_nums $preg_main_value ""
+  }
 }
 
 # Switch back to the signal handler frame, and check register values
@@ -136,14 +141,16 @@ gdb_test "frame $handlerframe" \
       "#$handlerframe.*handler \\\(sig=4\\\).*" \
       "set to signal handler frame"
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 2nd" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+}
 }
diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
index be19d8c0d7..fd8a2283b6 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
@@ -35,17 +35,17 @@ gdb_continue_to_breakpoint "breakpoint here"
 
 # Test that GDB manages caches correctly for tagged address.
 # Read from P2,
-gdb_test "x p2" "$hex:\[\t \]+0x000004d2"
+gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2"
 gdb_test_no_output "set variable i = 5678"
 # Test that *P2 is updated.
-gdb_test "x p2" "$hex:\[\t \]+0x0000162e"
+gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2 (updated)"
 
 # Read from SP1->i,
-gdb_test "print sp1->i" " = 1234"
+gdb_test "print sp1->i" " = 1234" "print SP1->i"
 # Write to SP2->i,
 gdb_test_no_output "set variable sp2->i = 5678"
 # Test that SP1->i is updated.
-gdb_test "print sp1->i" " = 5678"
+gdb_test "print sp1->i" " = 5678" "print SP1->i (updated)"
 
 gdb_test "x/d &sp2->i" "$hex:\[\t \]+5678"
 gdb_test "x/d &sp1->i" "$hex:\[\t \]+5678"
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index 82ead79f25..b347cc5270 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -52,5 +52,5 @@ gdb_test "set architecture $arch2" \
 
 gdb_test "show disassembler-options" \
 	"The current disassembler options are '$option'.*" \
-	"show disassembler-options $option"
+	"show disassembler-options $option, modified architecture"
 
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp
index 034b8363b7..7032a4c3a6 100644
--- a/gdb/testsuite/gdb.arch/arm-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp
@@ -103,7 +103,7 @@ proc test_ldr_literal_16 {} {
 
     gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass "break test_ldr_literal_16"
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -193,7 +193,7 @@ proc test_cbz_cbnz {} {
 
     gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass "break test_ldr_literal in test_zero_cbnz"
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -251,7 +251,7 @@ proc test_adr_32bit {} {
 
     gdb_test_multiple "break *test_adr_32bit" "break test_adr_32bit" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass "break test_adr_32bit"
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -309,7 +309,7 @@ proc test_pop_pc {} {
 	"break test_pop_pc_3_right"
     gdb_test "break *test_pop_pc_3_wrong" \
 	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break test_pop_pc_1_wrong"
+	"break test_pop_pc_3_wrong"
 
     gdb_continue_to_breakpoint "continue to test_pop_pc_1" \
 	".*b.*\{r1\, pc\}.*"
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp
index b463fd7dc4..0c6de8a7ce 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.exp
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp
@@ -83,4 +83,4 @@ gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128"
 
 gdb_test "backtrace 10" \
 	"#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \
-	"backtrace in write_sp"
+	"backtrace in write_sp, 2nd stop"
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index 1a4d3fbee8..99951b9e40 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -102,7 +102,7 @@ test_background "stepi&" "" ".*$prefix x = 5; .*"
 
 # Get the next instruction address.
 set next_insn_addr ""
-set test "get next insn"
+set test "get next insn, 2nd"
 gdb_test_multiple {x/2i $pc} "$test" {
     -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
 	set next_insn_addr $expect_out(1,string)
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 9834a3564d..07c07c451e 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -126,8 +126,8 @@ set live_data [fetch_auxv "info auxv on live process"]
 set gcore_works [gdb_gcore_cmd "$gcorefile" "gcore"]
 
 # Let the program continue and die.
-gdb_test continue ".*Program received signal.*"
-gdb_test continue ".*Program terminated with signal.*"
+gdb_test continue ".*Program received signal.*" "continue until signal"
+gdb_test continue ".*Program terminated with signal.*" "continue and terminate"
 
 # Now collect the core dump it left.
 set test "generate native core dump"
diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp
index 38aad395ad..895f5344ef 100644
--- a/gdb/testsuite/gdb.base/complex-parts.exp
+++ b/gdb/testsuite/gdb.base/complex-parts.exp
@@ -36,22 +36,22 @@ gdb_test "ptype z2" " = complex float"
 gdb_test "ptype z3" " = complex long double"
 
 gdb_test "p \$_cimag (z1)" " = 4.5"
-gdb_test "ptype \$" " = double"
+gdb_test "ptype \$" " = double" "ptype \$_cimag (z1)"
 
 gdb_test "p \$_cimag (z2)" " = -5.5"
-gdb_test "ptype \$" " = float"
+gdb_test "ptype \$" " = float" "ptype \$_cimag (z2)"
 
 gdb_test "p \$_cimag (z3)" " = 6.5"
-gdb_test "ptype \$" " = long double"
+gdb_test "ptype \$" " = long double" "ptype \$_cimag (z3)"
 
 gdb_test "p \$_creal (z1)" " = 1.5"
-gdb_test "ptype \$" " = double"
+gdb_test "ptype \$" " = double" "ptype \$_creal (z1)"
 
 gdb_test "p \$_creal (z2)" " = 2.5"
-gdb_test "ptype \$" " = float"
+gdb_test "ptype \$" " = float" "ptype \$_creal (z2)"
 
 gdb_test "p \$_creal (z3)" " = 3.5"
-gdb_test "ptype \$" " = long double"
+gdb_test "ptype \$" " = long double" "ptype \$_creal (z3)"
 
 gdb_test "p \$_cimag (d1)" "expected a complex number"
 gdb_test "p \$_cimag (f1)" "expected a complex number"
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index c338a0d51f..fd90e73a99 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -48,7 +48,7 @@ proc break_at { breakpoint where } {
     gdb_test_multiple "$test" "$test" {
 	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
 	    set bp $expect_out(1,string)
-	    pass "$test"
+	    pass "$test inserted as number $bp"
 	}
     }
     return $bp
@@ -104,7 +104,12 @@ gdb_test "info break $bp" \
 
 # Verify that we don't stop at a disabled breakpoint.
 gdb_continue_to_end "no stop"
-rerun_to_main
+
+set count 1
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 gdb_continue_to_end "no stop at auto-disabled break marker2"
 
 # Verify that we can set a breakpoint to be self-deleting after the
@@ -216,7 +221,11 @@ gdb_test "info break $bp" \
     "info ignored break marker1"
 
 gdb_continue_to_end "no stop at ignored break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 # See the comments in condbreak.exp for "run until breakpoint at marker1" 
 # for an explanation of the xfail below.
@@ -249,7 +258,11 @@ gdb_test "info break $bp" \
     "info break marker1 after hitting breakpoint"
 
 gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "continue" \
     ".*marker1 .*:$bp_location15.*" \
@@ -271,7 +284,11 @@ gdb_test "ignore $bp 10" \
 gdb_test_no_output "disable $bp" "disable break marker1"
 
 gdb_continue_to_end "no stop at ignored & disabled break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "info break $bp" \
     "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 825c7e22c1..aad8b3b44f 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -80,8 +80,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 1st"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 1st" ".*execlp \\(.*"
 
    # Verify that we can see various global and local variables
    # in this program, and that they have expected values.  Some
@@ -236,8 +236,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 2nd"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 2nd" ".*execlp \\(.*"
 
    # Verify that we can follow through follow an execl()
    # call.  (We must jump around earlier exec* calls.)
@@ -301,8 +301,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 3rd"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 3rd" ".*execlp \\(.*"
 
    # Verify that we can follow through follow an execv()
    # call.  (We must jump around earlier exec* calls.)
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 4a41f74115..d89b8ab5b8 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -34,43 +34,48 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is on."
+with_test_prefix "observer mode off" {
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is on."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is on."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is on."
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is on."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is on."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is on."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
+
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is on."
+}
 
 gdb_test "set observer on" "Observer mode is now on." "enable observer mode"
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is off."
+with_test_prefix "observer mode on" {
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is off."
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is off."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is off."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is off."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is off."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is off."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is off."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is off."
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is off."
+}
 
 gdb_test "set observer off" "Observer mode is now off." "disable observer mode"
 
@@ -87,14 +92,14 @@ if ![runto_main] then {
 
 gdb_test "print x = 45" "$decimal = 45" "set a global"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global"
 
 gdb_test "set may-write-memory off"
 
 gdb_test "print x = 92" "Writing to memory is not allowed.*" \
-    "try to set a global"
+    "set a global, 2nd time"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a globa, 2nd time"
 
 # FIXME Add tests for other flags when a testsuite-able target becomes
 # available.
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 68b0edeba5..906d16b4a4 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -152,9 +152,11 @@ gdb_test "add-symbol-file ${binfile} 0" \
 	"add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x0\[\r\n\]+\\(y or n\\) " \
 	"y"
 
-# Print the addresses of static variables.
-set static_foo_addr [get_var_address static_foo]
-set static_bar_addr [get_var_address static_bar]
+with_test_prefix "print addresses, static vars" {
+    # Print the addresses of static variables.
+    set static_foo_addr [get_var_address static_foo]
+    set static_bar_addr [get_var_address static_bar]
+}
 
 # Make sure they have different addresses.
 if { "${static_foo_addr}" == "${static_bar_addr}" } {
@@ -163,9 +165,11 @@ if { "${static_foo_addr}" == "${static_bar_addr}" } {
   pass "static variables have different addresses"
 }
 
-# Print the addresses of global variables.
-set global_foo_addr [get_var_address global_foo]
-set global_bar_addr [get_var_address global_bar]
+with_test_prefix "print addresses, global vars" {
+    # Print the addresses of global variables.
+    set global_foo_addr [get_var_address global_foo]
+    set global_bar_addr [get_var_address global_bar]
+}
 
 # Make sure they have different addresses.
 if { "${global_foo_addr}" == "${global_bar_addr}" } {
@@ -174,9 +178,11 @@ if { "${global_foo_addr}" == "${global_bar_addr}" } {
   pass "global variables have different addresses"
 }
 
-# Print the addresses of functions.
-set function_foo_addr [get_var_address function_foo]
-set function_bar_addr [get_var_address function_bar]
+with_test_prefix "print addresses, functions" {
+    # Print the addresses of functions.
+    set function_foo_addr [get_var_address function_foo]
+    set function_bar_addr [get_var_address function_bar]
+}
 
 # Make sure they have different addresses.
 if { "${function_foo_addr}" == "${function_bar_addr}" } {
@@ -220,20 +226,26 @@ gdb_test "symbol-file -o $offset $binfile" \
     "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with offset"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
-    "static variable foo is moved by offset"
+with_test_prefix "static vars" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
-    "function foo is moved by offset"
+with_test_prefix "functions" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
+	"function foo is moved by offset"
+}
 
 # Load the object using add-symbol-file with an offset and check that
 # all addresses are moved by that offset.
@@ -246,20 +258,26 @@ gdb_test "add-symbol-file -o $offset $binfile" \
     "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
-    "static variable foo is moved by offset"
+with_test_prefix "static scope, 2nd" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars, 2nd" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
-    "function foo is moved by offset"
+with_test_prefix "functions, 2nd" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
+	"function foo is moved by offset"
+}
 
 # Re-load the object giving an explicit address for .text
 
@@ -271,10 +289,12 @@ gdb_test "add-symbol-file $binfile -o $offset $text" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure function has a different addresses now.
-set function_foo_addr [get_var_address function_foo]
-gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
-    "function foo has a different address"
+with_test_prefix "functions, 3rd" {
+    # Make sure function has a different addresses now.
+    set function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
+	"function foo has a different address"
+}
 
 # Re-load the object giving an explicit address for .data
 
@@ -286,10 +306,12 @@ gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure variable has a different addresses now.
-set global_foo_addr [get_var_address global_foo]
-gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
-    "global variable foo has a different address"
+with_test_prefix "global vars, 3rd" {
+    # Make sure variable has a different addresses now.
+    set global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
+	"global variable foo has a different address"
+}
 
 # Now try loading the object as an exec-file; we should be able to print
 # the values of variables after we do this.
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index ad1dcc8e0f..ae60d9546a 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -50,7 +50,7 @@ proc return_1 { type } {
     gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
 	    "${type} value returned successfully"
     gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
-	    "validate result value not equal to program return value"
+	    "validate result value not equal to program return value (${type})"
 }
 
 proc return_void { } {
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index fb3a676bbd..bd7e1d8db9 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -138,7 +138,9 @@ proc stepi_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
@@ -212,7 +214,9 @@ proc cont_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp
index 1ce2d201c1..0ea3c2350e 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.exp
+++ b/gdb/testsuite/gdb.base/siginfo-obj.exp
@@ -45,7 +45,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 1st"
 
 # Try to generate a core file, for a later test.
 set gcorefile [standard_output_file $testfile.gcore]
@@ -86,13 +87,14 @@ gdb_test_multiple "p \$_siginfo" "$test" {
 
 set bp_location [gdb_get_line_number "set breakpoint here"]
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
-gdb_test "p ssi_errno" " = $ssi_errno"
-gdb_test "p ssi_code" " = $ssi_code"
-gdb_test "p ssi_signo" " = $ssi_signo"
+with_test_prefix "validate siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
+    gdb_test "p ssi_errno" " = $ssi_errno"
+    gdb_test "p ssi_code" " = $ssi_code"
+    gdb_test "p ssi_signo" " = $ssi_signo"
+}
 
 # Again, but this time, patch si_addr and check that the inferior sees
 # the changed value.
@@ -104,7 +106,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 2nd"
 
 set test "set si_addr"
 gdb_test "p \$_siginfo._sifields._sigfault.si_addr = 0x666" " = \\(void \\*\\) 0x666"
@@ -112,13 +115,14 @@ gdb_test "p \$_siginfo.si_errno = 666" " = 666"
 gdb_test "p \$_siginfo.si_code = 999" " = 999"
 gdb_test "p \$_siginfo.si_signo = 11" " = 11"
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
-gdb_test "p ssi_errno" " = 666"
-gdb_test "p ssi_code" " = 999"
-gdb_test "p ssi_signo" " = 11"
+with_test_prefix "validate modified siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
+    gdb_test "p ssi_errno" " = 666"
+    gdb_test "p ssi_code" " = 999"
+    gdb_test "p ssi_signo" " = 11"
+}
 
 # Test siginfo preservation in core files.
 if {$gcore_created} {
diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp
index 730c7f68df..a2b8a3f2f2 100644
--- a/gdb/testsuite/gdb.cp/converts.exp
+++ b/gdb/testsuite/gdb.cp/converts.exp
@@ -36,8 +36,10 @@ gdb_test "p foo0_3 (bppp)" "Cannot resolve.*" \
 
 gdb_test "p foo1_1 (a)"  "= 11"             "pointer to pointer"
 gdb_test "p foo1_2 (a)"  "= 12"             "pointer to array"
-gdb_test "p foo1_3 (a)"  "Cannot resolve.*" "pointer to pointer of wrong type"
-gdb_test "p foo1_3 (bp)" "Cannot resolve.*" "pointer to pointer of wrong type"
+gdb_test "p foo1_3 (a)"  "Cannot resolve.*" \
+	 "pointer to pointer of wrong type (a)"
+gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \
+	 "pointer to pointer of wrong type (bp)"
 gdb_test "p foo1_4 (bp)" "= 14"             "pointer to ancestor pointer"
 gdb_test "p foo1_5 (bp)" "= 15"             "pointer to void pointer"
 gdb_test "p foo1_6 (bp)" "Cannot resolve.*"     "pointer to void pointer pointer"
@@ -94,28 +96,36 @@ gdb_test "p foo1_7(ta)" \
 
 # Test for strict type checking
 set error_str "Cannot resolve function %s to any overloaded instance"
-gdb_test "show check type" "Strict type checking is on\."
-gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
-gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+gdb_test "show check type" "Strict type checking is on\." \
+	 "confirm check type on"
+
+with_test_prefix "Strict type checking on" {
+    gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
+    gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+}
 
 gdb_test_no_output "set check type off"
-gdb_test "show check type" "Strict type checking is off\."
-gdb_test "p foo1_type_check (123)" " = 1000"
-gdb_test "p foo2_type_check (0, 1)" " = 1001"
-gdb_test "p foo2_type_check (1, 0)" " = 1001"
-gdb_test "p foo2_type_check (1, 1)" " = 1001"
-gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
-gdb_test "p foo3_2 (1,1)" " = 32"
+gdb_test "show check type" "Strict type checking is off\." \
+	 "confirm check type off"
+
+with_test_prefix "Strict type checking off" {
+    gdb_test "p foo1_type_check (123)" " = 1000"
+    gdb_test "p foo2_type_check (0, 1)" " = 1001"
+    gdb_test "p foo2_type_check (1, 0)" " = 1001"
+    gdb_test "p foo2_type_check (1, 1)" " = 1001"
+    gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
+    gdb_test "p foo3_2 (1,1)" " = 32"
+}
diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp
index 1248987b2a..ad5f0c44bb 100644
--- a/gdb/testsuite/gdb.cp/exceptprint.exp
+++ b/gdb/testsuite/gdb.cp/exceptprint.exp
@@ -76,16 +76,20 @@ if {![runto_main]} {
     return -1
 }
 
-gdb_test "catch catch int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(catch\\)" \
-    "catch catch"
-gdb_test "catch throw int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(throw\\)" \
-    "catch throw"
-gdb_test "catch rethrow int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(rethrow\\)" \
-    "catch rethrow"
+with_test_prefix "2nd run" {
+    gdb_test "catch catch int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(catch\\)" \
+	"catch catch"
+    gdb_test "catch throw int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(throw\\)" \
+	"catch throw"
+    gdb_test "catch rethrow int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(rethrow\\)" \
+	"catch rethrow"
+}
 
 # This tests both the case where the regular expression does not
 # match, and the case where it does.
-do_exceptprint_tests int 23
+with_test_prefix "2nd run" {
+    do_exceptprint_tests int 23
+}
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 9616015709..59c72da6ae 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -693,9 +693,16 @@ proc do_tests { } {
 	return
     }
 
-    test_print_si_members
+    with_test_prefix "single inheritance" {
+	test_print_si_members
+    }
+
     test_print_si_classes
-    test_print_mi_members
+
+    with_test_prefix "multiple inheritance" {
+	test_print_mi_members
+    }
+
     test_print_mi_member_types
     test_print_mi_classes
     test_print_anon_union
diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp
index 98b4c56f4e..bbf255c3f4 100644
--- a/gdb/testsuite/gdb.cp/nsnoimports.exp
+++ b/gdb/testsuite/gdb.cp/nsnoimports.exp
@@ -25,37 +25,43 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "main scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "No symbol .* in current context."
-gdb_test "print ab" "No symbol .* in current context."
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print _a" "No symbol .* in current context."
+    gdb_test "print ab" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::first
 gdb_continue_to_breakpoint "A::B::first"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::first scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print C::abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print C::abc" "= 33"
 
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::C::second
 gdb_continue_to_breakpoint "A::B::C::second"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::C::second scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print abc" "= 33"
+}
 
diff --git a/gdb/testsuite/gdb.cp/virtbase2.exp b/gdb/testsuite/gdb.cp/virtbase2.exp
index 6e968a5552..7b5392909e 100644
--- a/gdb/testsuite/gdb.cp/virtbase2.exp
+++ b/gdb/testsuite/gdb.cp/virtbase2.exp
@@ -63,23 +63,29 @@ proc make_scope_list { scopes } {
 }
 
 proc test_variables_in_base { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}i" " = 55"
-        gdb_test "print ${scope}d" " = 6.25"
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}i" " = 55"
+	  gdb_test "print ${scope}d" " = 6.25"
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_superbase { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_super { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}w" " = 17"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}w" " = 17"
+      }
+  }
 }
 
 with_test_prefix "derived::func_d" {
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 9ce6a51072..260917a906 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -70,7 +70,9 @@ mi_gdb_test "113-var-create argc * argc" \
 	"113\\^error,msg=\"-var-create: unable to create variable object\"" \
 	"create out of scope variable"
 
-mi_runto do_locals_tests
+with_test_prefix "first run" {
+  mi_runto do_locals_tests
+}
 
 set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"]
 
@@ -253,7 +255,7 @@ mi_gdb_test "-var-assign global_simple 0" \
 
 mi_gdb_test "-var-assign linteger 3333" \
 	"\\^done,value=\"3333\"" \
-	"assign to linteger"
+	"assign to linteger, 1st"
 
 # Allow lpcharacter to update, optionally.  Because it points to a
 # char variable instead of a zero-terminated string, if linteger is
@@ -278,7 +280,7 @@ mi_gdb_test "-var-evaluate-expression linteger" \
 
 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 1st"
 
 mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
@@ -296,11 +298,11 @@ mi_gdb_test "-var-evaluate-expression lpinteger" \
 
 mi_gdb_test "-var-assign linteger 4321" \
 	"\\^done,value=\"4321\"" \
-	"assign to linteger"
+	"assign to linteger, 2nd"
 
 mi_gdb_test "-var-assign lpinteger &linteger" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 2nd"
 
 mi_gdb_test "-var-assign lcharacter 'z'" \
 	"\\^done,value=\"122 'z'\"" \
@@ -312,33 +314,33 @@ mi_gdb_test "-var-evaluate-expression lcharacter" \
 
 mi_gdb_test "-var-assign llong 1313L" \
 	"\\^done,value=\"1313\"" \
-	"assign to llong"
+	"assign to llong, 1st"
 mi_gdb_test "-var-evaluate-expression llong" \
 	"\\^done,value=\"1313\"" \
 	"eval llong"
 mi_gdb_test "-var-assign llong 1212L" \
 	"\\^done,value=\"1212\"" \
-	"assign to llong"
+	"assign to llong, 2nd"
 
 mi_gdb_test "-var-assign lplong &llong+4" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 1st"
 mi_gdb_test "-var-evaluate-expression lplong" \
 	"\\^done,value=\"$hex\"" \
 	"eval lplong"
 mi_gdb_test "-var-assign lplong &llong" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 2nd"
 
 mi_gdb_test "-var-assign lfloat 3.4567" \
 	"\\^done,value=\"3.45.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 1st"
 mi_gdb_test "-var-evaluate-expression lfloat" \
 	"\\^done,value=\"3.45.*\"" \
 	"eval lfloat"
 mi_gdb_test "-var-assign lfloat 1.2345" \
 	"\\^done,value=\"1.23.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 2nd"
 
 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
 	"\\^done,value=\"$hex\"" \
@@ -648,7 +650,9 @@ mi_gdb_test "-var-delete endvar" \
 
 mi_delete_breakpoints
 
-mi_runto do_locals_tests
+with_test_prefix "second run" {
+  mi_runto do_locals_tests
+}
 
 mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj"
 mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value"
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 39c4602a40..3b845356b8 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -379,10 +379,10 @@ void do_frozen_tests ()
         {"V1.nested.k" "k" "0" "int"}
     } "list children of v1.nested"
 
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
-    mi_check_varobj_value V2 4 "check V2: 4"
+    mi_check_varobj_value V1.i 1 "check V1.i: 1, 1st"
+    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2, 1st"
+    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 1st"
+    mi_check_varobj_value V2 4 "check V2: 4, 1st"
   :*/
   v2 = 5;
   /*: 
@@ -391,7 +391,7 @@ void do_frozen_tests ()
   :*/
   v2 = 6;
   /*: 
-    mi_varobj_update * {} "update varobjs: nothing changed"
+    mi_varobj_update * {} "update varobjs: nothing changed, 1st"
     mi_check_varobj_value V2 5 "check V2: 5"
     mi_varobj_update V2 {V2} "update V2 explicitly"
     mi_check_varobj_value V2 6 "check V2: 6"
@@ -401,25 +401,25 @@ void do_frozen_tests ()
   v1.nested.k = 9;
   /*:
     set_frozen V1 1
-    mi_varobj_update * {} "update varobjs: nothing changed"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
+    mi_varobj_update * {} "update varobjs: nothing changed, 2nd"
+    mi_check_varobj_value V1.i 1 "check V1.i: 1, 2nd"
+    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2, 2nd"
+    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 2nd"
     # Check that explicit update for elements of structures
     # works.
     # Update v1.j
     mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
+    mi_check_varobj_value V1.i 1 "check V1.i: 1, 3rd"
+    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 1st"
+    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 3rd"
     # Update v1.nested, check that children is updated.
     mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
     mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 2nd"
     mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
     # Update v1.i
     mi_varobj_update V1.i {V1.i} "update V1.i"
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    mi_check_varobj_value V1.i 7 "check V1.i: 7, 1st"
   :*/
   v1.i = 10;
   v1.nested.j = 11;
@@ -427,9 +427,9 @@ void do_frozen_tests ()
   /*:
     # Check that unfreeze itself does not updates the values.
     set_frozen V1 0
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
+    mi_check_varobj_value V1.i 7 "check V1.i: 7, 2nd"
+    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 4th"
+    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9, 2nd"
     mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
     mi_check_varobj_value V1.i 10 "check V1.i: 10"
     mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH, testsuite] Fix some duplicate test names
  2020-05-26 14:18 [PATCH, testsuite] Fix some duplicate test names Luis Machado
@ 2020-05-26 15:35 ` Pedro Alves
  2020-05-26 17:08   ` Luis Machado
  2020-05-26 17:39 ` [PATCH,v2 " Luis Machado
  2020-05-26 19:02 ` [PATCH,v3 " Luis Machado
  2 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2020-05-26 15:35 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

Thanks!

Some comments as I quickly skimmed the patch.  Some of the issues
appear more than once, but I didn't point at all instances.

On 5/26/20 3:18 PM, Luis Machado via Gdb-patches wrote:
>  # Test that GDB manages caches correctly for tagged address.
>  # Read from P2,
> -gdb_test "x p2" "$hex:\[\t \]+0x000004d2"
> +gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2"
>  gdb_test_no_output "set variable i = 5678"
>  # Test that *P2 is updated.
> -gdb_test "x p2" "$hex:\[\t \]+0x0000162e"
> +gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2 (updated)"
>  

NAK here -- these should be considered the same.  See:

 https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages

If the detection machinery does not consider them duplicates, then it
should be fixed. 

>      gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" {
>  	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
> -	    pass "break test_ldr_literal"
> +	    pass "break test_ldr_literal_16"
>  	}

Why not "break *break test_ldr_literal_16"?  I.e., the "*" is missing.

But consider $gdb_test_name, and dropping the explicit test name in
the gdb_test_multiple call too:

     gdb_test_multiple "break *test_ldr_literal_16" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
	    pass $gdb_test_name
 	}

>      gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" {
>  	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
> -	    pass "break test_ldr_literal"
> +	    pass "break test_ldr_literal in test_zero_cbnz"
>  	}

This one shows why $gdb_test_name would be better -- here a fail caught
by gdb_test_multiple's internal patterns will issue a different message
compared to a PASS:

 FAIL: break test_zero_cbnz
 PASS: break test_ldr_literal in test_zero_cbnz

> -gdb_test "print x" "$decimal = 45"
> +gdb_test "print x" "$decimal = 45" "validate setting a globa, 2nd time"
>  

Typo: "globa".

> +++ b/gdb/testsuite/gdb.base/return2.exp
> @@ -50,7 +50,7 @@ proc return_1 { type } {
>      gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
>  	    "${type} value returned successfully"
>      gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
> -	    "validate result value not equal to program return value"
> +	    "validate result value not equal to program return value (${type})"
>  }

That issue with tail parens again.

> +gdb_test "p foo1_3 (a)"  "Cannot resolve.*" \
> +	 "pointer to pointer of wrong type (a)"
> +gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \
> +	 "pointer to pointer of wrong type (bp)"
>  gdb_test "p foo1_4 (bp)" "= 14"             "pointer to ancestor pointer"

Ditto.

> +with_test_prefix "Strict type checking on" {
> +    gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
> +    gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]

Lowercase "Strict".

> @@ -401,25 +401,25 @@ void do_frozen_tests ()
>    v1.nested.k = 9;
>    /*:
>      set_frozen V1 1
> -    mi_varobj_update * {} "update varobjs: nothing changed"
> -    mi_check_varobj_value V1.i 1 "check V1.i: 1"
> -    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
> -    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
> +    mi_varobj_update * {} "update varobjs: nothing changed, 2nd"
> +    mi_check_varobj_value V1.i 1 "check V1.i: 1, 2nd"
> +    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2, 2nd"
> +    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 2nd"
>      # Check that explicit update for elements of structures
>      # works.
>      # Update v1.j
>      mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
> -    mi_check_varobj_value V1.i 1 "check V1.i: 1"
> -    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
> -    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
> +    mi_check_varobj_value V1.i 1 "check V1.i: 1, 3rd"
> +    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 1st"
> +    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 3rd"
>      # Update v1.nested, check that children is updated.
>      mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
>      mi_check_varobj_value V1.i 1 "check V1.i: 1"
> -    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
> +    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 2nd"
>      mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
>      # Update v1.i
>      mi_varobj_update V1.i {V1.i} "update V1.i"
> -    mi_check_varobj_value V1.i 7 "check V1.i: 7"
> +    mi_check_varobj_value V1.i 7 "check V1.i: 7, 1st"

Here, instead of the counting, it would seem to me better to use
with_test_prefix, like

with_test_prefix "update *" {
...
}

with_test_prefix "update v1.j" {
...
}

with_test_prefix "v1.nested" {
...
}

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH, testsuite] Fix some duplicate test names
  2020-05-26 15:35 ` Pedro Alves
@ 2020-05-26 17:08   ` Luis Machado
  0 siblings, 0 replies; 12+ messages in thread
From: Luis Machado @ 2020-05-26 17:08 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 5/26/20 12:35 PM, Pedro Alves wrote:
> Thanks!
> 
> Some comments as I quickly skimmed the patch.  Some of the issues
> appear more than once, but I didn't point at all instances.
> 
> On 5/26/20 3:18 PM, Luis Machado via Gdb-patches wrote:
>>   # Test that GDB manages caches correctly for tagged address.
>>   # Read from P2,
>> -gdb_test "x p2" "$hex:\[\t \]+0x000004d2"
>> +gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2"
>>   gdb_test_no_output "set variable i = 5678"
>>   # Test that *P2 is updated.
>> -gdb_test "x p2" "$hex:\[\t \]+0x0000162e"
>> +gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2 (updated)"
>>   
> 
> NAK here -- these should be considered the same.  See:
> 

Heh, I seem to have forgotten that particular rule, and it is tempting 
to use it. Fixed now.

>   https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages
> 
> If the detection machinery does not consider them duplicates, then it
> should be fixed.
It doesn't, but maybe it is due to the space before the parentheses?

> 
>>       gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" {
>>   	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
>> -	    pass "break test_ldr_literal"
>> +	    pass "break test_ldr_literal_16"
>>   	}
> 
> Why not "break *break test_ldr_literal_16"?  I.e., the "*" is missing.
> 
> But consider $gdb_test_name, and dropping the explicit test name in
> the gdb_test_multiple call too:
> 
>       gdb_test_multiple "break *test_ldr_literal_16" "" {
>   	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
> 	    pass $gdb_test_name
>   	}
> 
>>       gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" {
>>   	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
>> -	    pass "break test_ldr_literal"
>> +	    pass "break test_ldr_literal in test_zero_cbnz"
>>   	}
> 
> This one shows why $gdb_test_name would be better -- here a fail caught
> by gdb_test_multiple's internal patterns will issue a different message
> compared to a PASS:
> 
>   FAIL: break test_zero_cbnz
>   PASS: break test_ldr_literal in test_zero_cbnz
> 

Makes sense. I've fixed these and patched them up to use $gdb_test_name now.

>> -gdb_test "print x" "$decimal = 45"
>> +gdb_test "print x" "$decimal = 45" "validate setting a globa, 2nd time"
>>   
> 
> Typo: "globa".
> 

Fixed now.

>> +++ b/gdb/testsuite/gdb.base/return2.exp
>> @@ -50,7 +50,7 @@ proc return_1 { type } {
>>       gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
>>   	    "${type} value returned successfully"
>>       gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
>> -	    "validate result value not equal to program return value"
>> +	    "validate result value not equal to program return value (${type})"
>>   }
> 
> That issue with tail parens again.

Fixed. Though I did not try to fix the testcase itself, which allows the 
command to be output as the test name, and those contain parentheses. 
I'd need to go over it and find meaningful names for the tests.

> 
>> +gdb_test "p foo1_3 (a)"  "Cannot resolve.*" \
>> +	 "pointer to pointer of wrong type (a)"
>> +gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \
>> +	 "pointer to pointer of wrong type (bp)"
>>   gdb_test "p foo1_4 (bp)" "= 14"             "pointer to ancestor pointer"
> 
> Ditto.
> 

Fixed.

>> +with_test_prefix "Strict type checking on" {
>> +    gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
>> +    gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
> 
> Lowercase "Strict".
> 

Fixed.

>> @@ -401,25 +401,25 @@ void do_frozen_tests ()
>>     v1.nested.k = 9;
>>     /*:
>>       set_frozen V1 1
>> -    mi_varobj_update * {} "update varobjs: nothing changed"
>> -    mi_check_varobj_value V1.i 1 "check V1.i: 1"
>> -    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
>> -    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
>> +    mi_varobj_update * {} "update varobjs: nothing changed, 2nd"
>> +    mi_check_varobj_value V1.i 1 "check V1.i: 1, 2nd"
>> +    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2, 2nd"
>> +    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 2nd"
>>       # Check that explicit update for elements of structures
>>       # works.
>>       # Update v1.j
>>       mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
>> -    mi_check_varobj_value V1.i 1 "check V1.i: 1"
>> -    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
>> -    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
>> +    mi_check_varobj_value V1.i 1 "check V1.i: 1, 3rd"
>> +    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 1st"
>> +    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3, 3rd"
>>       # Update v1.nested, check that children is updated.
>>       mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
>>       mi_check_varobj_value V1.i 1 "check V1.i: 1"
>> -    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
>> +    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8, 2nd"
>>       mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
>>       # Update v1.i
>>       mi_varobj_update V1.i {V1.i} "update V1.i"
>> -    mi_check_varobj_value V1.i 7 "check V1.i: 7"
>> +    mi_check_varobj_value V1.i 7 "check V1.i: 7, 1st"
> 
> Here, instead of the counting, it would seem to me better to use
> with_test_prefix, like
> 
> with_test_prefix "update *" {
> ...
> }
> 
> with_test_prefix "update v1.j" {
> ...
> }
> 
> with_test_prefix "v1.nested" {
> ...
> }

I've switched to using with_test_prefix.

I'll send a v2 shortly.

Thanks!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH,v2 testsuite] Fix some duplicate test names
  2020-05-26 14:18 [PATCH, testsuite] Fix some duplicate test names Luis Machado
  2020-05-26 15:35 ` Pedro Alves
@ 2020-05-26 17:39 ` Luis Machado
  2020-05-26 17:50   ` Pedro Alves
  2020-05-26 19:02 ` [PATCH,v3 " Luis Machado
  2 siblings, 1 reply; 12+ messages in thread
From: Luis Machado @ 2020-05-26 17:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: palves

Updates on v2:

- Fixed use of parentheses.
- Fixed upper case in test name.
- Switched to using with_test_prefix in gdb.mi/var-cmd.c.

While doing a testsuite run on aarch64-linux, I noticed a bunch of duplicated
test name results. It annoyed me a little, so I decided to go ahead and fix the
worst offenders.

The following patch brings the duplicate test names down from 461 to 137.

The remaining ones are mostly scattered across the testsuite, with 1 to 3
duplicates per testcase. We can fix those as we go, or if I get annoyed with
them again.

It is worth mentioning that making those stand out and be annoying worked
nicely as a motivation to get them fixed.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Luis Machado  <luis.machado@linaro.org>

	* gdb.arch/aarch64-sighandler-regs.exp: Fix duplicated test names.
	* gdb.arch/aarch64-tagged-pointer.exp: Likewise.
	* gdb.arch/arm-disassembler-options.exp: Likewise.
	* gdb.arch/arm-disp-step.exp: Likewise.
	* gdb.arch/thumb-prologue.exp: Likewise.
	* gdb.base/async.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/complex-parts.exp: Likewise.
	* gdb.base/ena-dis-br.exp: Likewise.
	* gdb.base/foll-exec.exp: Likewise.
	* gdb.base/permissions.exp: Likewise.
	* gdb.base/relocate.exp: Likewise.
	* gdb.base/return2.exp: Likewise.
	* gdb.base/sigbpt.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.cp/converts.exp: Likewise.
	* gdb.cp/exceptprint.exp: Likewise.
	* gdb.cp/inherit.exp: Likewise.
	* gdb.cp/nsnoimports.exp: Likewise.
	* gdb.cp/virtbase2.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/var-cmd.c: Likewise.
---
 gdb.arch/aarch64-sighandler-regs.exp      |  67 ++++++-----
 gdb.arch/aarch64-tagged-pointer.exp       |   8 +-
 gdb.arch/arm-disassembler-options.exp     |   2 +-
 gdb/testsuite/gdb.arch/arm-disp-step.exp      |  31 +++---
 gdb/testsuite/gdb.arch/thumb-prologue.exp     |   2 +-
 gdb/testsuite/gdb.base/async.exp              |   2 +-
 gdb/testsuite/gdb.base/auxv.exp               |   4 +-
 gdb/testsuite/gdb.base/complex-parts.exp      |  36 ++++--
 gdb/testsuite/gdb.base/ena-dis-br.exp         |  27 ++++-
 gdb/testsuite/gdb.base/foll-exec.exp          |  12 +-
 gdb/testsuite/gdb.base/permissions.exp        |  59 +++++-----
 gdb/testsuite/gdb.base/relocate.exp           | 104 +++++++++++-------
 gdb/testsuite/gdb.base/return2.exp            |   2 +-
 gdb/testsuite/gdb.base/sigbpt.exp             |   8 +-
 gdb/testsuite/gdb.base/siginfo-obj.exp        |  36 +++---
 gdb/testsuite/gdb.cp/converts.exp             |  60 +++++-----
 gdb/testsuite/gdb.cp/exceptprint.exp          |  24 ++--
 gdb/testsuite/gdb.cp/inherit.exp              |  11 +-
 gdb/testsuite/gdb.cp/nsnoimports.exp          |  44 ++++----
 gdb/testsuite/gdb.cp/virtbase2.exp            |  28 +++--
 gdb/testsuite/gdb.mi/mi-var-cmd.exp           |  28 +++--
 gdb/testsuite/gdb.mi/var-cmd.c                |  98 +++++++++--------
 22 files changed, 406 insertions(+), 287 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
index 9faab7897c..1dedd336b5 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
@@ -100,16 +100,18 @@ set mainframe [expr $handlerframe + 2]
 
 # Check register values
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 1st" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+  }
 }
 
 # Switch to the frame for main(), and check register values
@@ -118,16 +120,19 @@ gdb_test "frame $mainframe" \
       "#$mainframe.*in main ().*" \
       "set to main frame"
 
-check_regs x $xreg_nums $reg_main_value_64 ""
-check_regs v $vreg_nums $reg_main_value_128 ".q.u"
-check_regs q $vreg_nums $reg_main_value_128 ".u"
-check_regs d $vreg_nums $reg_main_value_64 ".u"
-check_regs s $vreg_nums $reg_main_value_32 ".u"
-check_regs h $vreg_nums $reg_main_value_16 ".u"
-check_regs b $vreg_nums $reg_main_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_main_value ".d.u"
-  check_regs p $preg_nums $preg_main_value ""
+
+with_test_prefix "main frame" {
+  check_regs x $xreg_nums $reg_main_value_64 ""
+  check_regs v $vreg_nums $reg_main_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_main_value_128 ".u"
+  check_regs d $vreg_nums $reg_main_value_64 ".u"
+  check_regs s $vreg_nums $reg_main_value_32 ".u"
+  check_regs h $vreg_nums $reg_main_value_16 ".u"
+  check_regs b $vreg_nums $reg_main_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_main_value ".d.u"
+    check_regs p $preg_nums $preg_main_value ""
+  }
 }
 
 # Switch back to the signal handler frame, and check register values
@@ -136,14 +141,16 @@ gdb_test "frame $handlerframe" \
       "#$handlerframe.*handler \\\(sig=4\\\).*" \
       "set to signal handler frame"
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 2nd" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+}
 }
diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
index be19d8c0d7..957571fdf9 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
@@ -35,17 +35,17 @@ gdb_continue_to_breakpoint "breakpoint here"
 
 # Test that GDB manages caches correctly for tagged address.
 # Read from P2,
-gdb_test "x p2" "$hex:\[\t \]+0x000004d2"
+gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2"
 gdb_test_no_output "set variable i = 5678"
 # Test that *P2 is updated.
-gdb_test "x p2" "$hex:\[\t \]+0x0000162e"
+gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2, updated"
 
 # Read from SP1->i,
-gdb_test "print sp1->i" " = 1234"
+gdb_test "print sp1->i" " = 1234" "print SP1->i"
 # Write to SP2->i,
 gdb_test_no_output "set variable sp2->i = 5678"
 # Test that SP1->i is updated.
-gdb_test "print sp1->i" " = 5678"
+gdb_test "print sp1->i" " = 5678" "print SP1->i, updated"
 
 gdb_test "x/d &sp2->i" "$hex:\[\t \]+5678"
 gdb_test "x/d &sp1->i" "$hex:\[\t \]+5678"
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index 82ead79f25..b347cc5270 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -52,5 +52,5 @@ gdb_test "set architecture $arch2" \
 
 gdb_test "show disassembler-options" \
 	"The current disassembler options are '$option'.*" \
-	"show disassembler-options $option"
+	"show disassembler-options $option, modified architecture"
 
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp
index 034b8363b7..f3a09c0d6f 100644
--- a/gdb/testsuite/gdb.arch/arm-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp
@@ -68,9 +68,9 @@ proc test_ldr_literal {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_ldr_literal" "break test_ldr_literal" {
+    gdb_test_multiple "break *test_ldr_literal" "" {
        -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-           pass "break test_ldr_literal"
+           pass $gdb_test_name
        }
        -re "No symbol.*\r\n$gdb_prompt $" {
            return 0
@@ -101,9 +101,9 @@ proc test_ldr_literal_16 {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" {
+    gdb_test_multiple "break *test_ldr_literal_16" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -191,9 +191,9 @@ proc test_cbz_cbnz {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" {
+    gdb_test_multiple "break *test_zero_cbnz" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -226,9 +226,9 @@ proc test_adr {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_adr" "break test_adr" {
+    gdb_test_multiple "break *test_adr" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -249,9 +249,9 @@ proc test_adr_32bit {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_adr_32bit" "break test_adr_32bit" {
+    gdb_test_multiple "break *test_adr_32bit" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -309,7 +309,7 @@ proc test_pop_pc {} {
 	"break test_pop_pc_3_right"
     gdb_test "break *test_pop_pc_3_wrong" \
 	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break test_pop_pc_1_wrong"
+	"break test_pop_pc_3_wrong"
 
     gdb_continue_to_breakpoint "continue to test_pop_pc_1" \
 	".*b.*\{r1\, pc\}.*"
@@ -334,9 +334,9 @@ proc test_str_pc {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_str_pc" "break test_str_pc" {
+    gdb_test_multiple "break *test_str_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_str_pc"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    pass "break test_str_pc"
@@ -371,10 +371,9 @@ proc test_str_pc {} {
 proc test_add_rn_pc {} {
     global srcfile gdb_prompt
 
-    set test "break test_add_rn_pc"
-    gdb_test_multiple "break *test_add_rn_pc" $test {
+    gdb_test_multiple "break *test_add_rn_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass $test
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp
index b463fd7dc4..0c6de8a7ce 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.exp
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp
@@ -83,4 +83,4 @@ gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128"
 
 gdb_test "backtrace 10" \
 	"#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \
-	"backtrace in write_sp"
+	"backtrace in write_sp, 2nd stop"
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index 1a4d3fbee8..99951b9e40 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -102,7 +102,7 @@ test_background "stepi&" "" ".*$prefix x = 5; .*"
 
 # Get the next instruction address.
 set next_insn_addr ""
-set test "get next insn"
+set test "get next insn, 2nd"
 gdb_test_multiple {x/2i $pc} "$test" {
     -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
 	set next_insn_addr $expect_out(1,string)
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 9834a3564d..07c07c451e 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -126,8 +126,8 @@ set live_data [fetch_auxv "info auxv on live process"]
 set gcore_works [gdb_gcore_cmd "$gcorefile" "gcore"]
 
 # Let the program continue and die.
-gdb_test continue ".*Program received signal.*"
-gdb_test continue ".*Program terminated with signal.*"
+gdb_test continue ".*Program received signal.*" "continue until signal"
+gdb_test continue ".*Program terminated with signal.*" "continue and terminate"
 
 # Now collect the core dump it left.
 set test "generate native core dump"
diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp
index 38aad395ad..7719ff14df 100644
--- a/gdb/testsuite/gdb.base/complex-parts.exp
+++ b/gdb/testsuite/gdb.base/complex-parts.exp
@@ -35,23 +35,35 @@ gdb_test "ptype z1" " = complex double"
 gdb_test "ptype z2" " = complex float"
 gdb_test "ptype z3" " = complex long double"
 
-gdb_test "p \$_cimag (z1)" " = 4.5"
-gdb_test "ptype \$" " = double"
+with_test_prefix "double imaginary" {
+    gdb_test "p \$_cimag (z1)" " = 4.5"
+    gdb_test "ptype \$" " = double"
+}
 
-gdb_test "p \$_cimag (z2)" " = -5.5"
-gdb_test "ptype \$" " = float"
+with_test_prefix "float imaginary" {
+    gdb_test "p \$_cimag (z2)" " = -5.5"
+    gdb_test "ptype \$" " = float"
+}
 
-gdb_test "p \$_cimag (z3)" " = 6.5"
-gdb_test "ptype \$" " = long double"
+with_test_prefix "long double imaginary" {
+    gdb_test "p \$_cimag (z3)" " = 6.5"
+    gdb_test "ptype \$" " = long double"
+}
 
-gdb_test "p \$_creal (z1)" " = 1.5"
-gdb_test "ptype \$" " = double"
+with_test_prefix "double real" {
+    gdb_test "p \$_creal (z1)" " = 1.5"
+    gdb_test "ptype \$" " = double"
+}
 
-gdb_test "p \$_creal (z2)" " = 2.5"
-gdb_test "ptype \$" " = float"
+with_test_prefix "float real" {
+    gdb_test "p \$_creal (z2)" " = 2.5"
+    gdb_test "ptype \$" " = float"
+}
 
-gdb_test "p \$_creal (z3)" " = 3.5"
-gdb_test "ptype \$" " = long double"
+with_test_prefix "long double real" {
+    gdb_test "p \$_creal (z3)" " = 3.5"
+    gdb_test "ptype \$" " = long double"
+}
 
 gdb_test "p \$_cimag (d1)" "expected a complex number"
 gdb_test "p \$_cimag (f1)" "expected a complex number"
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index c338a0d51f..fd90e73a99 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -48,7 +48,7 @@ proc break_at { breakpoint where } {
     gdb_test_multiple "$test" "$test" {
 	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
 	    set bp $expect_out(1,string)
-	    pass "$test"
+	    pass "$test inserted as number $bp"
 	}
     }
     return $bp
@@ -104,7 +104,12 @@ gdb_test "info break $bp" \
 
 # Verify that we don't stop at a disabled breakpoint.
 gdb_continue_to_end "no stop"
-rerun_to_main
+
+set count 1
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 gdb_continue_to_end "no stop at auto-disabled break marker2"
 
 # Verify that we can set a breakpoint to be self-deleting after the
@@ -216,7 +221,11 @@ gdb_test "info break $bp" \
     "info ignored break marker1"
 
 gdb_continue_to_end "no stop at ignored break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 # See the comments in condbreak.exp for "run until breakpoint at marker1" 
 # for an explanation of the xfail below.
@@ -249,7 +258,11 @@ gdb_test "info break $bp" \
     "info break marker1 after hitting breakpoint"
 
 gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "continue" \
     ".*marker1 .*:$bp_location15.*" \
@@ -271,7 +284,11 @@ gdb_test "ignore $bp 10" \
 gdb_test_no_output "disable $bp" "disable break marker1"
 
 gdb_continue_to_end "no stop at ignored & disabled break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "info break $bp" \
     "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 825c7e22c1..aad8b3b44f 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -80,8 +80,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 1st"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 1st" ".*execlp \\(.*"
 
    # Verify that we can see various global and local variables
    # in this program, and that they have expected values.  Some
@@ -236,8 +236,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 2nd"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 2nd" ".*execlp \\(.*"
 
    # Verify that we can follow through follow an execl()
    # call.  (We must jump around earlier exec* calls.)
@@ -301,8 +301,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 3rd"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 3rd" ".*execlp \\(.*"
 
    # Verify that we can follow through follow an execv()
    # call.  (We must jump around earlier exec* calls.)
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 4a41f74115..6cc6f70eb9 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -34,43 +34,48 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is on."
+with_test_prefix "observer mode off" {
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is on."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is on."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is on."
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is on."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is on."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is on."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
+
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is on."
+}
 
 gdb_test "set observer on" "Observer mode is now on." "enable observer mode"
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is off."
+with_test_prefix "observer mode on" {
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is off."
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is off."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is off."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is off."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is off."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is off."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is off."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is off."
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is off."
+}
 
 gdb_test "set observer off" "Observer mode is now off." "disable observer mode"
 
@@ -87,14 +92,14 @@ if ![runto_main] then {
 
 gdb_test "print x = 45" "$decimal = 45" "set a global"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global"
 
 gdb_test "set may-write-memory off"
 
 gdb_test "print x = 92" "Writing to memory is not allowed.*" \
-    "try to set a global"
+    "set a global, 2nd time"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global, 2nd time"
 
 # FIXME Add tests for other flags when a testsuite-able target becomes
 # available.
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 68b0edeba5..906d16b4a4 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -152,9 +152,11 @@ gdb_test "add-symbol-file ${binfile} 0" \
 	"add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x0\[\r\n\]+\\(y or n\\) " \
 	"y"
 
-# Print the addresses of static variables.
-set static_foo_addr [get_var_address static_foo]
-set static_bar_addr [get_var_address static_bar]
+with_test_prefix "print addresses, static vars" {
+    # Print the addresses of static variables.
+    set static_foo_addr [get_var_address static_foo]
+    set static_bar_addr [get_var_address static_bar]
+}
 
 # Make sure they have different addresses.
 if { "${static_foo_addr}" == "${static_bar_addr}" } {
@@ -163,9 +165,11 @@ if { "${static_foo_addr}" == "${static_bar_addr}" } {
   pass "static variables have different addresses"
 }
 
-# Print the addresses of global variables.
-set global_foo_addr [get_var_address global_foo]
-set global_bar_addr [get_var_address global_bar]
+with_test_prefix "print addresses, global vars" {
+    # Print the addresses of global variables.
+    set global_foo_addr [get_var_address global_foo]
+    set global_bar_addr [get_var_address global_bar]
+}
 
 # Make sure they have different addresses.
 if { "${global_foo_addr}" == "${global_bar_addr}" } {
@@ -174,9 +178,11 @@ if { "${global_foo_addr}" == "${global_bar_addr}" } {
   pass "global variables have different addresses"
 }
 
-# Print the addresses of functions.
-set function_foo_addr [get_var_address function_foo]
-set function_bar_addr [get_var_address function_bar]
+with_test_prefix "print addresses, functions" {
+    # Print the addresses of functions.
+    set function_foo_addr [get_var_address function_foo]
+    set function_bar_addr [get_var_address function_bar]
+}
 
 # Make sure they have different addresses.
 if { "${function_foo_addr}" == "${function_bar_addr}" } {
@@ -220,20 +226,26 @@ gdb_test "symbol-file -o $offset $binfile" \
     "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with offset"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
-    "static variable foo is moved by offset"
+with_test_prefix "static vars" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
-    "function foo is moved by offset"
+with_test_prefix "functions" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
+	"function foo is moved by offset"
+}
 
 # Load the object using add-symbol-file with an offset and check that
 # all addresses are moved by that offset.
@@ -246,20 +258,26 @@ gdb_test "add-symbol-file -o $offset $binfile" \
     "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
-    "static variable foo is moved by offset"
+with_test_prefix "static scope, 2nd" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars, 2nd" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
-    "function foo is moved by offset"
+with_test_prefix "functions, 2nd" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
+	"function foo is moved by offset"
+}
 
 # Re-load the object giving an explicit address for .text
 
@@ -271,10 +289,12 @@ gdb_test "add-symbol-file $binfile -o $offset $text" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure function has a different addresses now.
-set function_foo_addr [get_var_address function_foo]
-gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
-    "function foo has a different address"
+with_test_prefix "functions, 3rd" {
+    # Make sure function has a different addresses now.
+    set function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
+	"function foo has a different address"
+}
 
 # Re-load the object giving an explicit address for .data
 
@@ -286,10 +306,12 @@ gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure variable has a different addresses now.
-set global_foo_addr [get_var_address global_foo]
-gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
-    "global variable foo has a different address"
+with_test_prefix "global vars, 3rd" {
+    # Make sure variable has a different addresses now.
+    set global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
+	"global variable foo has a different address"
+}
 
 # Now try loading the object as an exec-file; we should be able to print
 # the values of variables after we do this.
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index ad1dcc8e0f..e93f4d8530 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -50,7 +50,7 @@ proc return_1 { type } {
     gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
 	    "${type} value returned successfully"
     gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
-	    "validate result value not equal to program return value"
+	    "validate result value not equal to program return value, ${type}"
 }
 
 proc return_void { } {
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index fb3a676bbd..bd7e1d8db9 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -138,7 +138,9 @@ proc stepi_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
@@ -212,7 +214,9 @@ proc cont_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp
index 1ce2d201c1..0ea3c2350e 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.exp
+++ b/gdb/testsuite/gdb.base/siginfo-obj.exp
@@ -45,7 +45,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 1st"
 
 # Try to generate a core file, for a later test.
 set gcorefile [standard_output_file $testfile.gcore]
@@ -86,13 +87,14 @@ gdb_test_multiple "p \$_siginfo" "$test" {
 
 set bp_location [gdb_get_line_number "set breakpoint here"]
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
-gdb_test "p ssi_errno" " = $ssi_errno"
-gdb_test "p ssi_code" " = $ssi_code"
-gdb_test "p ssi_signo" " = $ssi_signo"
+with_test_prefix "validate siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
+    gdb_test "p ssi_errno" " = $ssi_errno"
+    gdb_test "p ssi_code" " = $ssi_code"
+    gdb_test "p ssi_signo" " = $ssi_signo"
+}
 
 # Again, but this time, patch si_addr and check that the inferior sees
 # the changed value.
@@ -104,7 +106,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 2nd"
 
 set test "set si_addr"
 gdb_test "p \$_siginfo._sifields._sigfault.si_addr = 0x666" " = \\(void \\*\\) 0x666"
@@ -112,13 +115,14 @@ gdb_test "p \$_siginfo.si_errno = 666" " = 666"
 gdb_test "p \$_siginfo.si_code = 999" " = 999"
 gdb_test "p \$_siginfo.si_signo = 11" " = 11"
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
-gdb_test "p ssi_errno" " = 666"
-gdb_test "p ssi_code" " = 999"
-gdb_test "p ssi_signo" " = 11"
+with_test_prefix "validate modified siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
+    gdb_test "p ssi_errno" " = 666"
+    gdb_test "p ssi_code" " = 999"
+    gdb_test "p ssi_signo" " = 11"
+}
 
 # Test siginfo preservation in core files.
 if {$gcore_created} {
diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp
index 730c7f68df..5ef57feb56 100644
--- a/gdb/testsuite/gdb.cp/converts.exp
+++ b/gdb/testsuite/gdb.cp/converts.exp
@@ -36,8 +36,10 @@ gdb_test "p foo0_3 (bppp)" "Cannot resolve.*" \
 
 gdb_test "p foo1_1 (a)"  "= 11"             "pointer to pointer"
 gdb_test "p foo1_2 (a)"  "= 12"             "pointer to array"
-gdb_test "p foo1_3 (a)"  "Cannot resolve.*" "pointer to pointer of wrong type"
-gdb_test "p foo1_3 (bp)" "Cannot resolve.*" "pointer to pointer of wrong type"
+gdb_test "p foo1_3 (a)"  "Cannot resolve.*" \
+	 "pointer to pointer of wrong type, a"
+gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \
+	 "pointer to pointer of wrong type, bp"
 gdb_test "p foo1_4 (bp)" "= 14"             "pointer to ancestor pointer"
 gdb_test "p foo1_5 (bp)" "= 15"             "pointer to void pointer"
 gdb_test "p foo1_6 (bp)" "Cannot resolve.*"     "pointer to void pointer pointer"
@@ -94,28 +96,36 @@ gdb_test "p foo1_7(ta)" \
 
 # Test for strict type checking
 set error_str "Cannot resolve function %s to any overloaded instance"
-gdb_test "show check type" "Strict type checking is on\."
-gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
-gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+gdb_test "show check type" "Strict type checking is on\." \
+	 "confirm check type on"
+
+with_test_prefix "strict type checking on" {
+    gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
+    gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+}
 
 gdb_test_no_output "set check type off"
-gdb_test "show check type" "Strict type checking is off\."
-gdb_test "p foo1_type_check (123)" " = 1000"
-gdb_test "p foo2_type_check (0, 1)" " = 1001"
-gdb_test "p foo2_type_check (1, 0)" " = 1001"
-gdb_test "p foo2_type_check (1, 1)" " = 1001"
-gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
-gdb_test "p foo3_2 (1,1)" " = 32"
+gdb_test "show check type" "Strict type checking is off\." \
+	 "confirm check type off"
+
+with_test_prefix "strict type checking off" {
+    gdb_test "p foo1_type_check (123)" " = 1000"
+    gdb_test "p foo2_type_check (0, 1)" " = 1001"
+    gdb_test "p foo2_type_check (1, 0)" " = 1001"
+    gdb_test "p foo2_type_check (1, 1)" " = 1001"
+    gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
+    gdb_test "p foo3_2 (1,1)" " = 32"
+}
diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp
index 1248987b2a..ad5f0c44bb 100644
--- a/gdb/testsuite/gdb.cp/exceptprint.exp
+++ b/gdb/testsuite/gdb.cp/exceptprint.exp
@@ -76,16 +76,20 @@ if {![runto_main]} {
     return -1
 }
 
-gdb_test "catch catch int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(catch\\)" \
-    "catch catch"
-gdb_test "catch throw int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(throw\\)" \
-    "catch throw"
-gdb_test "catch rethrow int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(rethrow\\)" \
-    "catch rethrow"
+with_test_prefix "2nd run" {
+    gdb_test "catch catch int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(catch\\)" \
+	"catch catch"
+    gdb_test "catch throw int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(throw\\)" \
+	"catch throw"
+    gdb_test "catch rethrow int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(rethrow\\)" \
+	"catch rethrow"
+}
 
 # This tests both the case where the regular expression does not
 # match, and the case where it does.
-do_exceptprint_tests int 23
+with_test_prefix "2nd run" {
+    do_exceptprint_tests int 23
+}
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 9616015709..59c72da6ae 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -693,9 +693,16 @@ proc do_tests { } {
 	return
     }
 
-    test_print_si_members
+    with_test_prefix "single inheritance" {
+	test_print_si_members
+    }
+
     test_print_si_classes
-    test_print_mi_members
+
+    with_test_prefix "multiple inheritance" {
+	test_print_mi_members
+    }
+
     test_print_mi_member_types
     test_print_mi_classes
     test_print_anon_union
diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp
index 98b4c56f4e..bbf255c3f4 100644
--- a/gdb/testsuite/gdb.cp/nsnoimports.exp
+++ b/gdb/testsuite/gdb.cp/nsnoimports.exp
@@ -25,37 +25,43 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "main scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "No symbol .* in current context."
-gdb_test "print ab" "No symbol .* in current context."
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print _a" "No symbol .* in current context."
+    gdb_test "print ab" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::first
 gdb_continue_to_breakpoint "A::B::first"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::first scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print C::abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print C::abc" "= 33"
 
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::C::second
 gdb_continue_to_breakpoint "A::B::C::second"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::C::second scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print abc" "= 33"
+}
 
diff --git a/gdb/testsuite/gdb.cp/virtbase2.exp b/gdb/testsuite/gdb.cp/virtbase2.exp
index 6e968a5552..7b5392909e 100644
--- a/gdb/testsuite/gdb.cp/virtbase2.exp
+++ b/gdb/testsuite/gdb.cp/virtbase2.exp
@@ -63,23 +63,29 @@ proc make_scope_list { scopes } {
 }
 
 proc test_variables_in_base { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}i" " = 55"
-        gdb_test "print ${scope}d" " = 6.25"
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}i" " = 55"
+	  gdb_test "print ${scope}d" " = 6.25"
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_superbase { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_super { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}w" " = 17"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}w" " = 17"
+      }
+  }
 }
 
 with_test_prefix "derived::func_d" {
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 9ce6a51072..260917a906 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -70,7 +70,9 @@ mi_gdb_test "113-var-create argc * argc" \
 	"113\\^error,msg=\"-var-create: unable to create variable object\"" \
 	"create out of scope variable"
 
-mi_runto do_locals_tests
+with_test_prefix "first run" {
+  mi_runto do_locals_tests
+}
 
 set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"]
 
@@ -253,7 +255,7 @@ mi_gdb_test "-var-assign global_simple 0" \
 
 mi_gdb_test "-var-assign linteger 3333" \
 	"\\^done,value=\"3333\"" \
-	"assign to linteger"
+	"assign to linteger, 1st"
 
 # Allow lpcharacter to update, optionally.  Because it points to a
 # char variable instead of a zero-terminated string, if linteger is
@@ -278,7 +280,7 @@ mi_gdb_test "-var-evaluate-expression linteger" \
 
 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 1st"
 
 mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
@@ -296,11 +298,11 @@ mi_gdb_test "-var-evaluate-expression lpinteger" \
 
 mi_gdb_test "-var-assign linteger 4321" \
 	"\\^done,value=\"4321\"" \
-	"assign to linteger"
+	"assign to linteger, 2nd"
 
 mi_gdb_test "-var-assign lpinteger &linteger" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 2nd"
 
 mi_gdb_test "-var-assign lcharacter 'z'" \
 	"\\^done,value=\"122 'z'\"" \
@@ -312,33 +314,33 @@ mi_gdb_test "-var-evaluate-expression lcharacter" \
 
 mi_gdb_test "-var-assign llong 1313L" \
 	"\\^done,value=\"1313\"" \
-	"assign to llong"
+	"assign to llong, 1st"
 mi_gdb_test "-var-evaluate-expression llong" \
 	"\\^done,value=\"1313\"" \
 	"eval llong"
 mi_gdb_test "-var-assign llong 1212L" \
 	"\\^done,value=\"1212\"" \
-	"assign to llong"
+	"assign to llong, 2nd"
 
 mi_gdb_test "-var-assign lplong &llong+4" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 1st"
 mi_gdb_test "-var-evaluate-expression lplong" \
 	"\\^done,value=\"$hex\"" \
 	"eval lplong"
 mi_gdb_test "-var-assign lplong &llong" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 2nd"
 
 mi_gdb_test "-var-assign lfloat 3.4567" \
 	"\\^done,value=\"3.45.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 1st"
 mi_gdb_test "-var-evaluate-expression lfloat" \
 	"\\^done,value=\"3.45.*\"" \
 	"eval lfloat"
 mi_gdb_test "-var-assign lfloat 1.2345" \
 	"\\^done,value=\"1.23.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 2nd"
 
 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
 	"\\^done,value=\"$hex\"" \
@@ -648,7 +650,9 @@ mi_gdb_test "-var-delete endvar" \
 
 mi_delete_breakpoints
 
-mi_runto do_locals_tests
+with_test_prefix "second run" {
+  mi_runto do_locals_tests
+}
 
 mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj"
 mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value"
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 39c4602a40..0529b67c7f 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -366,23 +366,25 @@ void do_frozen_tests ()
 
   int v2 = 4;
   /*: 
-    mi_create_varobj V1 v1 "create varobj for v1" 
-    mi_create_varobj V2 v2 "create varobj for v2"
-
-    mi_list_varobj_children "V1" {
-        {"V1.i" "i" "0" "int"}
-	{"V1.nested" "nested" "2" "struct {...}"}
-    } "list children of v1"
-
-    mi_list_varobj_children "V1.nested" {
-        {"V1.nested.j" "j" "0" "int"}
-        {"V1.nested.k" "k" "0" "int"}
-    } "list children of v1.nested"
-
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
-    mi_check_varobj_value V2 4 "check V2: 4"
+    with_test_prefix "create varobj V1 and V2" {
+	mi_create_varobj V1 v1 "create varobj for v1"
+	mi_create_varobj V2 v2 "create varobj for v2"
+
+	mi_list_varobj_children "V1" {
+	    {"V1.i" "i" "0" "int"}
+	    {"V1.nested" "nested" "2" "struct {...}"}
+	} "list children of v1"
+
+	mi_list_varobj_children "V1.nested" {
+	    {"V1.nested.j" "j" "0" "int"}
+	    {"V1.nested.k" "k" "0" "int"}
+	} "list children of v1.nested"
+
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+	mi_check_varobj_value V2 4 "check V2: 4"
+    }
   :*/
   v2 = 5;
   /*: 
@@ -400,40 +402,50 @@ void do_frozen_tests ()
   v1.nested.j = 8;
   v1.nested.k = 9;
   /*:
-    set_frozen V1 1
-    mi_varobj_update * {} "update varobjs: nothing changed"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
+    with_test_prefix "frozen V1" {
+	set_frozen V1 1
+	mi_varobj_update * {} "update varobjs: nothing changed"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+    }
     # Check that explicit update for elements of structures
     # works.
-    # Update v1.j
-    mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
-    # Update v1.nested, check that children is updated.
-    mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
-    # Update v1.i
-    mi_varobj_update V1.i {V1.i} "update V1.i"
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    with_test_prefix "update v1.j" {
+	# Update v1.j
+	mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+    }
+    with_test_prefix "update v1.nested" {
+	# Update v1.nested, check that children is updated.
+	mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
+    }
+    with_test_prefix "update v1.i" {
+	# Update v1.i
+	mi_varobj_update V1.i {V1.i} "update V1.i"
+	mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    }
   :*/
   v1.i = 10;
   v1.nested.j = 11;
   v1.nested.k = 12;
   /*:
     # Check that unfreeze itself does not updates the values.
-    set_frozen V1 0
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
-    mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
-    mi_check_varobj_value V1.i 10 "check V1.i: 10"
-    mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
-    mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12"    
+    with_test_prefix "unfrozen V1" {
+	set_frozen V1 0
+	mi_check_varobj_value V1.i 7 "check V1.i: 7"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
+	mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
+	mi_check_varobj_value V1.i 10 "check V1.i: 10"
+	mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
+	mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12"
+    }
   :*/    
   
   /*: END: frozen :*/
-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v2 testsuite] Fix some duplicate test names
  2020-05-26 17:39 ` [PATCH,v2 " Luis Machado
@ 2020-05-26 17:50   ` Pedro Alves
  2020-05-26 18:42     ` Luis Machado
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2020-05-26 17:50 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

Hi, spotted a couple more issues:

On 5/26/20 6:39 PM, Luis Machado wrote:
>      gdb_test_multiple "$test" "$test" {
>  	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
>  	    set bp $expect_out(1,string)
> -	    pass "$test"
> +	    pass "$test inserted as number $bp"

Same issue with FAIL vs PASS messages.  This needs to be:

 -     gdb_test_multiple "$test" "$test" {
 +     gdb_test_multiple "$test" "$test inserted as number $bp" {
  	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
  	    set bp $expect_out(1,string)
 -	    pass "$test"
 +	    pass $gdb_test_name


> -    gdb_test_multiple "break *test_str_pc" "break test_str_pc" {
> +    gdb_test_multiple "break *test_str_pc" "" {
>  	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
> -	    pass "break test_str_pc"
> +	    pass $gdb_test_name
>  	}
>  	-re "No symbol.*\r\n$gdb_prompt $" {
>  	    pass "break test_str_pc"

Please update the other "-re" cases too, so they all have the
same message.  Here the pass call in the last line shown has
a different message.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v2 testsuite] Fix some duplicate test names
  2020-05-26 17:50   ` Pedro Alves
@ 2020-05-26 18:42     ` Luis Machado
  2020-05-26 18:53       ` Pedro Alves
  0 siblings, 1 reply; 12+ messages in thread
From: Luis Machado @ 2020-05-26 18:42 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 5/26/20 2:50 PM, Pedro Alves wrote:
> Hi, spotted a couple more issues:
> 
> On 5/26/20 6:39 PM, Luis Machado wrote:
>>       gdb_test_multiple "$test" "$test" {
>>   	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
>>   	    set bp $expect_out(1,string)
>> -	    pass "$test"
>> +	    pass "$test inserted as number $bp"
> 
> Same issue with FAIL vs PASS messages.  This needs to be:
> 
>   -     gdb_test_multiple "$test" "$test" {
>   +     gdb_test_multiple "$test" "$test inserted as number $bp" {
>    	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
>    	    set bp $expect_out(1,string)
>   -	    pass "$test"
>   +	    pass $gdb_test_name
> 
> 

This one has a small problem. $bp gets calculated after parsing the 
output. We may have to pass a param to proc so we can differentiate 
between calls.

For example, we attempt to add four breakpoints at "main" later in the test.

We may have to add some prefixes to callers of this proc.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v2 testsuite] Fix some duplicate test names
  2020-05-26 18:42     ` Luis Machado
@ 2020-05-26 18:53       ` Pedro Alves
  0 siblings, 0 replies; 12+ messages in thread
From: Pedro Alves @ 2020-05-26 18:53 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 5/26/20 7:42 PM, Luis Machado wrote:
> On 5/26/20 2:50 PM, Pedro Alves wrote:
>> Hi, spotted a couple more issues:
>>
>> On 5/26/20 6:39 PM, Luis Machado wrote:
>>>       gdb_test_multiple "$test" "$test" {
>>>       -re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
>>>           set bp $expect_out(1,string)
>>> -        pass "$test"
>>> +        pass "$test inserted as number $bp"
>>
>> Same issue with FAIL vs PASS messages.  This needs to be:
>>
>>   -     gdb_test_multiple "$test" "$test" {
>>   +     gdb_test_multiple "$test" "$test inserted as number $bp" {
>>        -re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
>>            set bp $expect_out(1,string)
>>   -        pass "$test"
>>   +        pass $gdb_test_name
>>
>>
> 
> This one has a small problem. $bp gets calculated after parsing the output. We may have to pass a param to proc so we can differentiate between calls.
> 

Oh, I didn't even notice that it's the breakpoint number
that you were printing.  That doesn't seem very stable, like
it could be different on different boards.  Seems best to
avoid using that in the test name, regardless.

> For example, we attempt to add four breakpoints at "main" later in the test.
> 
> We may have to add some prefixes to callers of this proc.

Sounds good.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH,v3 testsuite] Fix some duplicate test names
  2020-05-26 14:18 [PATCH, testsuite] Fix some duplicate test names Luis Machado
  2020-05-26 15:35 ` Pedro Alves
  2020-05-26 17:39 ` [PATCH,v2 " Luis Machado
@ 2020-05-26 19:02 ` Luis Machado
  2020-05-26 19:35   ` Pedro Alves
  2 siblings, 1 reply; 12+ messages in thread
From: Luis Machado @ 2020-05-26 19:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: palves

Updates on v3:

- Fixups to gdb.arch/arm-disp-step.exp, gdb.base/ena-dis-br.exp
  and gdb.base/async.exp.

Updates on v2:

- Fixed use of parentheses.
- Fixed upper case in test name.
- Switched to using with_test_prefix in gdb.mi/var-cmd.c.

While doing a testsuite run on aarch64-linux, I noticed a bunch of duplicated
test name results. It annoyed me a little, so I decided to go ahead and fix the
worst offenders.

The following patch brings the duplicate test names down from 461 to 137.

The remaining ones are mostly scattered across the testsuite, with 1 to 3
duplicates per testcase.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Luis Machado  <luis.machado@linaro.org>

	* gdb.arch/aarch64-sighandler-regs.exp: Fix duplicated test names.
	* gdb.arch/aarch64-tagged-pointer.exp: Likewise.
	* gdb.arch/arm-disassembler-options.exp: Likewise.
	* gdb.arch/arm-disp-step.exp: Likewise.
	* gdb.arch/thumb-prologue.exp: Likewise.
	* gdb.base/async.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/complex-parts.exp: Likewise.
	* gdb.base/ena-dis-br.exp: Likewise.
	* gdb.base/foll-exec.exp: Likewise.
	* gdb.base/permissions.exp: Likewise.
	* gdb.base/relocate.exp: Likewise.
	* gdb.base/return2.exp: Likewise.
	* gdb.base/sigbpt.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.cp/converts.exp: Likewise.
	* gdb.cp/exceptprint.exp: Likewise.
	* gdb.cp/inherit.exp: Likewise.
	* gdb.cp/nsnoimports.exp: Likewise.
	* gdb.cp/virtbase2.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/var-cmd.c: Likewise.
---
 .../gdb.arch/aarch64-sighandler-regs.exp      |  67 ++++++-----
 .../gdb.arch/aarch64-tagged-pointer.exp       |   8 +-
 .../gdb.arch/arm-disassembler-options.exp     |   2 +-
 gdb/testsuite/gdb.arch/arm-disp-step.exp      |  39 ++++---
 gdb/testsuite/gdb.arch/thumb-prologue.exp     |   2 +-
 gdb/testsuite/gdb.base/async.exp              |   6 +-
 gdb/testsuite/gdb.base/auxv.exp               |   4 +-
 gdb/testsuite/gdb.base/complex-parts.exp      |  36 ++++--
 gdb/testsuite/gdb.base/ena-dis-br.exp         |  29 ++++-
 gdb/testsuite/gdb.base/foll-exec.exp          |  12 +-
 gdb/testsuite/gdb.base/permissions.exp        |  59 +++++-----
 gdb/testsuite/gdb.base/relocate.exp           | 104 +++++++++++-------
 gdb/testsuite/gdb.base/return2.exp            |   2 +-
 gdb/testsuite/gdb.base/sigbpt.exp             |   8 +-
 gdb/testsuite/gdb.base/siginfo-obj.exp        |  36 +++---
 gdb/testsuite/gdb.cp/converts.exp             |  60 +++++-----
 gdb/testsuite/gdb.cp/exceptprint.exp          |  24 ++--
 gdb/testsuite/gdb.cp/inherit.exp              |  11 +-
 gdb/testsuite/gdb.cp/nsnoimports.exp          |  44 ++++----
 gdb/testsuite/gdb.cp/virtbase2.exp            |  28 +++--
 gdb/testsuite/gdb.mi/mi-var-cmd.exp           |  28 +++--
 gdb/testsuite/gdb.mi/var-cmd.c                |  98 +++++++++--------
 22 files changed, 413 insertions(+), 294 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
index 9faab7897c..1dedd336b5 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
@@ -100,16 +100,18 @@ set mainframe [expr $handlerframe + 2]
 
 # Check register values
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 1st" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+  }
 }
 
 # Switch to the frame for main(), and check register values
@@ -118,16 +120,19 @@ gdb_test "frame $mainframe" \
       "#$mainframe.*in main ().*" \
       "set to main frame"
 
-check_regs x $xreg_nums $reg_main_value_64 ""
-check_regs v $vreg_nums $reg_main_value_128 ".q.u"
-check_regs q $vreg_nums $reg_main_value_128 ".u"
-check_regs d $vreg_nums $reg_main_value_64 ".u"
-check_regs s $vreg_nums $reg_main_value_32 ".u"
-check_regs h $vreg_nums $reg_main_value_16 ".u"
-check_regs b $vreg_nums $reg_main_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_main_value ".d.u"
-  check_regs p $preg_nums $preg_main_value ""
+
+with_test_prefix "main frame" {
+  check_regs x $xreg_nums $reg_main_value_64 ""
+  check_regs v $vreg_nums $reg_main_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_main_value_128 ".u"
+  check_regs d $vreg_nums $reg_main_value_64 ".u"
+  check_regs s $vreg_nums $reg_main_value_32 ".u"
+  check_regs h $vreg_nums $reg_main_value_16 ".u"
+  check_regs b $vreg_nums $reg_main_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_main_value ".d.u"
+    check_regs p $preg_nums $preg_main_value ""
+  }
 }
 
 # Switch back to the signal handler frame, and check register values
@@ -136,14 +141,16 @@ gdb_test "frame $handlerframe" \
       "#$handlerframe.*handler \\\(sig=4\\\).*" \
       "set to signal handler frame"
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 2nd" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+}
 }
diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
index be19d8c0d7..957571fdf9 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
@@ -35,17 +35,17 @@ gdb_continue_to_breakpoint "breakpoint here"
 
 # Test that GDB manages caches correctly for tagged address.
 # Read from P2,
-gdb_test "x p2" "$hex:\[\t \]+0x000004d2"
+gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2"
 gdb_test_no_output "set variable i = 5678"
 # Test that *P2 is updated.
-gdb_test "x p2" "$hex:\[\t \]+0x0000162e"
+gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2, updated"
 
 # Read from SP1->i,
-gdb_test "print sp1->i" " = 1234"
+gdb_test "print sp1->i" " = 1234" "print SP1->i"
 # Write to SP2->i,
 gdb_test_no_output "set variable sp2->i = 5678"
 # Test that SP1->i is updated.
-gdb_test "print sp1->i" " = 5678"
+gdb_test "print sp1->i" " = 5678" "print SP1->i, updated"
 
 gdb_test "x/d &sp2->i" "$hex:\[\t \]+5678"
 gdb_test "x/d &sp1->i" "$hex:\[\t \]+5678"
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index 82ead79f25..b347cc5270 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -52,5 +52,5 @@ gdb_test "set architecture $arch2" \
 
 gdb_test "show disassembler-options" \
 	"The current disassembler options are '$option'.*" \
-	"show disassembler-options $option"
+	"show disassembler-options $option, modified architecture"
 
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp
index 034b8363b7..29189d0f60 100644
--- a/gdb/testsuite/gdb.arch/arm-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp
@@ -37,12 +37,12 @@ proc test_ldm_stm_pc {} {
 
     # Try to set breakpoint on test_ldm_stm_pc.  If symbol 'test_ldm_stm_pc'
     # can't be resolved, test case is compiled in Thumb mode, skip it.
-    gdb_test_multiple "break *test_ldm_stm_pc" "break test_ldm_stm_pc" {
+    gdb_test_multiple "break *test_ldm_stm_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldm_stm_pc"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
-	    pass "break test_ldm_stm_pc"
+	    pass $gdb_test_name
 	    return 0
 	}
     }
@@ -68,9 +68,9 @@ proc test_ldr_literal {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_ldr_literal" "break test_ldr_literal" {
+    gdb_test_multiple "break *test_ldr_literal" "" {
        -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-           pass "break test_ldr_literal"
+           pass $gdb_test_name
        }
        -re "No symbol.*\r\n$gdb_prompt $" {
            return 0
@@ -101,9 +101,9 @@ proc test_ldr_literal_16 {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" {
+    gdb_test_multiple "break *test_ldr_literal_16" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -191,9 +191,9 @@ proc test_cbz_cbnz {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" {
+    gdb_test_multiple "break *test_zero_cbnz" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -226,9 +226,9 @@ proc test_adr {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_adr" "break test_adr" {
+    gdb_test_multiple "break *test_adr" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -249,9 +249,9 @@ proc test_adr_32bit {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_adr_32bit" "break test_adr_32bit" {
+    gdb_test_multiple "break *test_adr_32bit" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -309,7 +309,7 @@ proc test_pop_pc {} {
 	"break test_pop_pc_3_right"
     gdb_test "break *test_pop_pc_3_wrong" \
 	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break test_pop_pc_1_wrong"
+	"break test_pop_pc_3_wrong"
 
     gdb_continue_to_breakpoint "continue to test_pop_pc_1" \
 	".*b.*\{r1\, pc\}.*"
@@ -334,12 +334,12 @@ proc test_str_pc {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_str_pc" "break test_str_pc" {
+    gdb_test_multiple "break *test_str_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_str_pc"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
-	    pass "break test_str_pc"
+	    pass $gdb_test_name
 	    return
 	}
     }
@@ -371,10 +371,9 @@ proc test_str_pc {} {
 proc test_add_rn_pc {} {
     global srcfile gdb_prompt
 
-    set test "break test_add_rn_pc"
-    gdb_test_multiple "break *test_add_rn_pc" $test {
+    gdb_test_multiple "break *test_add_rn_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass $test
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp
index b463fd7dc4..0c6de8a7ce 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.exp
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp
@@ -83,4 +83,4 @@ gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128"
 
 gdb_test "backtrace 10" \
 	"#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \
-	"backtrace in write_sp"
+	"backtrace in write_sp, 2nd stop"
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index 1a4d3fbee8..32711d04ba 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -87,7 +87,7 @@ set test "get next insn"
 gdb_test_multiple {x/2i $pc} "$test" {
     -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
 	set next_insn_addr $expect_out(1,string)
-	pass "$test"
+	pass $gdb_test_name
     }
 }
 set next_insn_is_stmt [hex_in_list $next_insn_addr $is_stmt]
@@ -102,11 +102,11 @@ test_background "stepi&" "" ".*$prefix x = 5; .*"
 
 # Get the next instruction address.
 set next_insn_addr ""
-set test "get next insn"
+set test "get next insn, 2nd"
 gdb_test_multiple {x/2i $pc} "$test" {
     -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
 	set next_insn_addr $expect_out(1,string)
-	pass "$test"
+	pass $gdb_test_name
     }
 }
 set next_insn_is_stmt \
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 9834a3564d..07c07c451e 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -126,8 +126,8 @@ set live_data [fetch_auxv "info auxv on live process"]
 set gcore_works [gdb_gcore_cmd "$gcorefile" "gcore"]
 
 # Let the program continue and die.
-gdb_test continue ".*Program received signal.*"
-gdb_test continue ".*Program terminated with signal.*"
+gdb_test continue ".*Program received signal.*" "continue until signal"
+gdb_test continue ".*Program terminated with signal.*" "continue and terminate"
 
 # Now collect the core dump it left.
 set test "generate native core dump"
diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp
index 38aad395ad..7719ff14df 100644
--- a/gdb/testsuite/gdb.base/complex-parts.exp
+++ b/gdb/testsuite/gdb.base/complex-parts.exp
@@ -35,23 +35,35 @@ gdb_test "ptype z1" " = complex double"
 gdb_test "ptype z2" " = complex float"
 gdb_test "ptype z3" " = complex long double"
 
-gdb_test "p \$_cimag (z1)" " = 4.5"
-gdb_test "ptype \$" " = double"
+with_test_prefix "double imaginary" {
+    gdb_test "p \$_cimag (z1)" " = 4.5"
+    gdb_test "ptype \$" " = double"
+}
 
-gdb_test "p \$_cimag (z2)" " = -5.5"
-gdb_test "ptype \$" " = float"
+with_test_prefix "float imaginary" {
+    gdb_test "p \$_cimag (z2)" " = -5.5"
+    gdb_test "ptype \$" " = float"
+}
 
-gdb_test "p \$_cimag (z3)" " = 6.5"
-gdb_test "ptype \$" " = long double"
+with_test_prefix "long double imaginary" {
+    gdb_test "p \$_cimag (z3)" " = 6.5"
+    gdb_test "ptype \$" " = long double"
+}
 
-gdb_test "p \$_creal (z1)" " = 1.5"
-gdb_test "ptype \$" " = double"
+with_test_prefix "double real" {
+    gdb_test "p \$_creal (z1)" " = 1.5"
+    gdb_test "ptype \$" " = double"
+}
 
-gdb_test "p \$_creal (z2)" " = 2.5"
-gdb_test "ptype \$" " = float"
+with_test_prefix "float real" {
+    gdb_test "p \$_creal (z2)" " = 2.5"
+    gdb_test "ptype \$" " = float"
+}
 
-gdb_test "p \$_creal (z3)" " = 3.5"
-gdb_test "ptype \$" " = long double"
+with_test_prefix "long double real" {
+    gdb_test "p \$_creal (z3)" " = 3.5"
+    gdb_test "ptype \$" " = long double"
+}
 
 gdb_test "p \$_cimag (d1)" "expected a complex number"
 gdb_test "p \$_cimag (f1)" "expected a complex number"
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index c338a0d51f..d8a7f0798f 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -45,10 +45,10 @@ proc break_at { breakpoint where } {
 
     set test "break $breakpoint"
     set bp 0
-    gdb_test_multiple "$test" "$test" {
+    gdb_test_multiple "$test" "$test inserted as number $bp" {
 	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
 	    set bp $expect_out(1,string)
-	    pass "$test"
+	    pass $gdb_test_name
 	}
     }
     return $bp
@@ -104,7 +104,12 @@ gdb_test "info break $bp" \
 
 # Verify that we don't stop at a disabled breakpoint.
 gdb_continue_to_end "no stop"
-rerun_to_main
+
+set count 1
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 gdb_continue_to_end "no stop at auto-disabled break marker2"
 
 # Verify that we can set a breakpoint to be self-deleting after the
@@ -216,7 +221,11 @@ gdb_test "info break $bp" \
     "info ignored break marker1"
 
 gdb_continue_to_end "no stop at ignored break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 # See the comments in condbreak.exp for "run until breakpoint at marker1" 
 # for an explanation of the xfail below.
@@ -249,7 +258,11 @@ gdb_test "info break $bp" \
     "info break marker1 after hitting breakpoint"
 
 gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "continue" \
     ".*marker1 .*:$bp_location15.*" \
@@ -271,7 +284,11 @@ gdb_test "ignore $bp 10" \
 gdb_test_no_output "disable $bp" "disable break marker1"
 
 gdb_continue_to_end "no stop at ignored & disabled break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "info break $bp" \
     "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 825c7e22c1..aad8b3b44f 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -80,8 +80,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 1st"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 1st" ".*execlp \\(.*"
 
    # Verify that we can see various global and local variables
    # in this program, and that they have expected values.  Some
@@ -236,8 +236,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 2nd"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 2nd" ".*execlp \\(.*"
 
    # Verify that we can follow through follow an execl()
    # call.  (We must jump around earlier exec* calls.)
@@ -301,8 +301,8 @@ proc do_exec_tests {} {
    }
    # Execute the code setting up variable PROG.
    set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint, 3rd"
+   gdb_continue_to_breakpoint "line tbreak-execlp, 3rd" ".*execlp \\(.*"
 
    # Verify that we can follow through follow an execv()
    # call.  (We must jump around earlier exec* calls.)
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 4a41f74115..6cc6f70eb9 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -34,43 +34,48 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is on."
+with_test_prefix "observer mode off" {
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is on."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is on."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is on."
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is on."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is on."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is on."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
+
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is on."
+}
 
 gdb_test "set observer on" "Observer mode is now on." "enable observer mode"
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is off."
+with_test_prefix "observer mode on" {
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is off."
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is off."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is off."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is off."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is off."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is off."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is off."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is off."
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is off."
+}
 
 gdb_test "set observer off" "Observer mode is now off." "disable observer mode"
 
@@ -87,14 +92,14 @@ if ![runto_main] then {
 
 gdb_test "print x = 45" "$decimal = 45" "set a global"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global"
 
 gdb_test "set may-write-memory off"
 
 gdb_test "print x = 92" "Writing to memory is not allowed.*" \
-    "try to set a global"
+    "set a global, 2nd time"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global, 2nd time"
 
 # FIXME Add tests for other flags when a testsuite-able target becomes
 # available.
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 68b0edeba5..906d16b4a4 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -152,9 +152,11 @@ gdb_test "add-symbol-file ${binfile} 0" \
 	"add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x0\[\r\n\]+\\(y or n\\) " \
 	"y"
 
-# Print the addresses of static variables.
-set static_foo_addr [get_var_address static_foo]
-set static_bar_addr [get_var_address static_bar]
+with_test_prefix "print addresses, static vars" {
+    # Print the addresses of static variables.
+    set static_foo_addr [get_var_address static_foo]
+    set static_bar_addr [get_var_address static_bar]
+}
 
 # Make sure they have different addresses.
 if { "${static_foo_addr}" == "${static_bar_addr}" } {
@@ -163,9 +165,11 @@ if { "${static_foo_addr}" == "${static_bar_addr}" } {
   pass "static variables have different addresses"
 }
 
-# Print the addresses of global variables.
-set global_foo_addr [get_var_address global_foo]
-set global_bar_addr [get_var_address global_bar]
+with_test_prefix "print addresses, global vars" {
+    # Print the addresses of global variables.
+    set global_foo_addr [get_var_address global_foo]
+    set global_bar_addr [get_var_address global_bar]
+}
 
 # Make sure they have different addresses.
 if { "${global_foo_addr}" == "${global_bar_addr}" } {
@@ -174,9 +178,11 @@ if { "${global_foo_addr}" == "${global_bar_addr}" } {
   pass "global variables have different addresses"
 }
 
-# Print the addresses of functions.
-set function_foo_addr [get_var_address function_foo]
-set function_bar_addr [get_var_address function_bar]
+with_test_prefix "print addresses, functions" {
+    # Print the addresses of functions.
+    set function_foo_addr [get_var_address function_foo]
+    set function_bar_addr [get_var_address function_bar]
+}
 
 # Make sure they have different addresses.
 if { "${function_foo_addr}" == "${function_bar_addr}" } {
@@ -220,20 +226,26 @@ gdb_test "symbol-file -o $offset $binfile" \
     "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with offset"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
-    "static variable foo is moved by offset"
+with_test_prefix "static vars" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
-    "function foo is moved by offset"
+with_test_prefix "functions" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
+	"function foo is moved by offset"
+}
 
 # Load the object using add-symbol-file with an offset and check that
 # all addresses are moved by that offset.
@@ -246,20 +258,26 @@ gdb_test "add-symbol-file -o $offset $binfile" \
     "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
-    "static variable foo is moved by offset"
+with_test_prefix "static scope, 2nd" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars, 2nd" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
-    "function foo is moved by offset"
+with_test_prefix "functions, 2nd" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
+	"function foo is moved by offset"
+}
 
 # Re-load the object giving an explicit address for .text
 
@@ -271,10 +289,12 @@ gdb_test "add-symbol-file $binfile -o $offset $text" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure function has a different addresses now.
-set function_foo_addr [get_var_address function_foo]
-gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
-    "function foo has a different address"
+with_test_prefix "functions, 3rd" {
+    # Make sure function has a different addresses now.
+    set function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
+	"function foo has a different address"
+}
 
 # Re-load the object giving an explicit address for .data
 
@@ -286,10 +306,12 @@ gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure variable has a different addresses now.
-set global_foo_addr [get_var_address global_foo]
-gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
-    "global variable foo has a different address"
+with_test_prefix "global vars, 3rd" {
+    # Make sure variable has a different addresses now.
+    set global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
+	"global variable foo has a different address"
+}
 
 # Now try loading the object as an exec-file; we should be able to print
 # the values of variables after we do this.
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index ad1dcc8e0f..e93f4d8530 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -50,7 +50,7 @@ proc return_1 { type } {
     gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
 	    "${type} value returned successfully"
     gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
-	    "validate result value not equal to program return value"
+	    "validate result value not equal to program return value, ${type}"
 }
 
 proc return_void { } {
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index fb3a676bbd..bd7e1d8db9 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -138,7 +138,9 @@ proc stepi_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
@@ -212,7 +214,9 @@ proc cont_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp
index 1ce2d201c1..0ea3c2350e 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.exp
+++ b/gdb/testsuite/gdb.base/siginfo-obj.exp
@@ -45,7 +45,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 1st"
 
 # Try to generate a core file, for a later test.
 set gcorefile [standard_output_file $testfile.gcore]
@@ -86,13 +87,14 @@ gdb_test_multiple "p \$_siginfo" "$test" {
 
 set bp_location [gdb_get_line_number "set breakpoint here"]
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
-gdb_test "p ssi_errno" " = $ssi_errno"
-gdb_test "p ssi_code" " = $ssi_code"
-gdb_test "p ssi_signo" " = $ssi_signo"
+with_test_prefix "validate siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
+    gdb_test "p ssi_errno" " = $ssi_errno"
+    gdb_test "p ssi_code" " = $ssi_code"
+    gdb_test "p ssi_signo" " = $ssi_signo"
+}
 
 # Again, but this time, patch si_addr and check that the inferior sees
 # the changed value.
@@ -104,7 +106,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 2nd"
 
 set test "set si_addr"
 gdb_test "p \$_siginfo._sifields._sigfault.si_addr = 0x666" " = \\(void \\*\\) 0x666"
@@ -112,13 +115,14 @@ gdb_test "p \$_siginfo.si_errno = 666" " = 666"
 gdb_test "p \$_siginfo.si_code = 999" " = 999"
 gdb_test "p \$_siginfo.si_signo = 11" " = 11"
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
-gdb_test "p ssi_errno" " = 666"
-gdb_test "p ssi_code" " = 999"
-gdb_test "p ssi_signo" " = 11"
+with_test_prefix "validate modified siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
+    gdb_test "p ssi_errno" " = 666"
+    gdb_test "p ssi_code" " = 999"
+    gdb_test "p ssi_signo" " = 11"
+}
 
 # Test siginfo preservation in core files.
 if {$gcore_created} {
diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp
index 730c7f68df..5ef57feb56 100644
--- a/gdb/testsuite/gdb.cp/converts.exp
+++ b/gdb/testsuite/gdb.cp/converts.exp
@@ -36,8 +36,10 @@ gdb_test "p foo0_3 (bppp)" "Cannot resolve.*" \
 
 gdb_test "p foo1_1 (a)"  "= 11"             "pointer to pointer"
 gdb_test "p foo1_2 (a)"  "= 12"             "pointer to array"
-gdb_test "p foo1_3 (a)"  "Cannot resolve.*" "pointer to pointer of wrong type"
-gdb_test "p foo1_3 (bp)" "Cannot resolve.*" "pointer to pointer of wrong type"
+gdb_test "p foo1_3 (a)"  "Cannot resolve.*" \
+	 "pointer to pointer of wrong type, a"
+gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \
+	 "pointer to pointer of wrong type, bp"
 gdb_test "p foo1_4 (bp)" "= 14"             "pointer to ancestor pointer"
 gdb_test "p foo1_5 (bp)" "= 15"             "pointer to void pointer"
 gdb_test "p foo1_6 (bp)" "Cannot resolve.*"     "pointer to void pointer pointer"
@@ -94,28 +96,36 @@ gdb_test "p foo1_7(ta)" \
 
 # Test for strict type checking
 set error_str "Cannot resolve function %s to any overloaded instance"
-gdb_test "show check type" "Strict type checking is on\."
-gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
-gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+gdb_test "show check type" "Strict type checking is on\." \
+	 "confirm check type on"
+
+with_test_prefix "strict type checking on" {
+    gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
+    gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+}
 
 gdb_test_no_output "set check type off"
-gdb_test "show check type" "Strict type checking is off\."
-gdb_test "p foo1_type_check (123)" " = 1000"
-gdb_test "p foo2_type_check (0, 1)" " = 1001"
-gdb_test "p foo2_type_check (1, 0)" " = 1001"
-gdb_test "p foo2_type_check (1, 1)" " = 1001"
-gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
-gdb_test "p foo3_2 (1,1)" " = 32"
+gdb_test "show check type" "Strict type checking is off\." \
+	 "confirm check type off"
+
+with_test_prefix "strict type checking off" {
+    gdb_test "p foo1_type_check (123)" " = 1000"
+    gdb_test "p foo2_type_check (0, 1)" " = 1001"
+    gdb_test "p foo2_type_check (1, 0)" " = 1001"
+    gdb_test "p foo2_type_check (1, 1)" " = 1001"
+    gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
+    gdb_test "p foo3_2 (1,1)" " = 32"
+}
diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp
index 1248987b2a..ad5f0c44bb 100644
--- a/gdb/testsuite/gdb.cp/exceptprint.exp
+++ b/gdb/testsuite/gdb.cp/exceptprint.exp
@@ -76,16 +76,20 @@ if {![runto_main]} {
     return -1
 }
 
-gdb_test "catch catch int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(catch\\)" \
-    "catch catch"
-gdb_test "catch throw int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(throw\\)" \
-    "catch throw"
-gdb_test "catch rethrow int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(rethrow\\)" \
-    "catch rethrow"
+with_test_prefix "2nd run" {
+    gdb_test "catch catch int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(catch\\)" \
+	"catch catch"
+    gdb_test "catch throw int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(throw\\)" \
+	"catch throw"
+    gdb_test "catch rethrow int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(rethrow\\)" \
+	"catch rethrow"
+}
 
 # This tests both the case where the regular expression does not
 # match, and the case where it does.
-do_exceptprint_tests int 23
+with_test_prefix "2nd run" {
+    do_exceptprint_tests int 23
+}
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 9616015709..59c72da6ae 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -693,9 +693,16 @@ proc do_tests { } {
 	return
     }
 
-    test_print_si_members
+    with_test_prefix "single inheritance" {
+	test_print_si_members
+    }
+
     test_print_si_classes
-    test_print_mi_members
+
+    with_test_prefix "multiple inheritance" {
+	test_print_mi_members
+    }
+
     test_print_mi_member_types
     test_print_mi_classes
     test_print_anon_union
diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp
index 98b4c56f4e..bbf255c3f4 100644
--- a/gdb/testsuite/gdb.cp/nsnoimports.exp
+++ b/gdb/testsuite/gdb.cp/nsnoimports.exp
@@ -25,37 +25,43 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "main scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "No symbol .* in current context."
-gdb_test "print ab" "No symbol .* in current context."
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print _a" "No symbol .* in current context."
+    gdb_test "print ab" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::first
 gdb_continue_to_breakpoint "A::B::first"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::first scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print C::abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print C::abc" "= 33"
 
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::C::second
 gdb_continue_to_breakpoint "A::B::C::second"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::C::second scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print abc" "= 33"
+}
 
diff --git a/gdb/testsuite/gdb.cp/virtbase2.exp b/gdb/testsuite/gdb.cp/virtbase2.exp
index 6e968a5552..7b5392909e 100644
--- a/gdb/testsuite/gdb.cp/virtbase2.exp
+++ b/gdb/testsuite/gdb.cp/virtbase2.exp
@@ -63,23 +63,29 @@ proc make_scope_list { scopes } {
 }
 
 proc test_variables_in_base { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}i" " = 55"
-        gdb_test "print ${scope}d" " = 6.25"
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}i" " = 55"
+	  gdb_test "print ${scope}d" " = 6.25"
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_superbase { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_super { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}w" " = 17"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}w" " = 17"
+      }
+  }
 }
 
 with_test_prefix "derived::func_d" {
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 9ce6a51072..260917a906 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -70,7 +70,9 @@ mi_gdb_test "113-var-create argc * argc" \
 	"113\\^error,msg=\"-var-create: unable to create variable object\"" \
 	"create out of scope variable"
 
-mi_runto do_locals_tests
+with_test_prefix "first run" {
+  mi_runto do_locals_tests
+}
 
 set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"]
 
@@ -253,7 +255,7 @@ mi_gdb_test "-var-assign global_simple 0" \
 
 mi_gdb_test "-var-assign linteger 3333" \
 	"\\^done,value=\"3333\"" \
-	"assign to linteger"
+	"assign to linteger, 1st"
 
 # Allow lpcharacter to update, optionally.  Because it points to a
 # char variable instead of a zero-terminated string, if linteger is
@@ -278,7 +280,7 @@ mi_gdb_test "-var-evaluate-expression linteger" \
 
 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 1st"
 
 mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
@@ -296,11 +298,11 @@ mi_gdb_test "-var-evaluate-expression lpinteger" \
 
 mi_gdb_test "-var-assign linteger 4321" \
 	"\\^done,value=\"4321\"" \
-	"assign to linteger"
+	"assign to linteger, 2nd"
 
 mi_gdb_test "-var-assign lpinteger &linteger" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 2nd"
 
 mi_gdb_test "-var-assign lcharacter 'z'" \
 	"\\^done,value=\"122 'z'\"" \
@@ -312,33 +314,33 @@ mi_gdb_test "-var-evaluate-expression lcharacter" \
 
 mi_gdb_test "-var-assign llong 1313L" \
 	"\\^done,value=\"1313\"" \
-	"assign to llong"
+	"assign to llong, 1st"
 mi_gdb_test "-var-evaluate-expression llong" \
 	"\\^done,value=\"1313\"" \
 	"eval llong"
 mi_gdb_test "-var-assign llong 1212L" \
 	"\\^done,value=\"1212\"" \
-	"assign to llong"
+	"assign to llong, 2nd"
 
 mi_gdb_test "-var-assign lplong &llong+4" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 1st"
 mi_gdb_test "-var-evaluate-expression lplong" \
 	"\\^done,value=\"$hex\"" \
 	"eval lplong"
 mi_gdb_test "-var-assign lplong &llong" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 2nd"
 
 mi_gdb_test "-var-assign lfloat 3.4567" \
 	"\\^done,value=\"3.45.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 1st"
 mi_gdb_test "-var-evaluate-expression lfloat" \
 	"\\^done,value=\"3.45.*\"" \
 	"eval lfloat"
 mi_gdb_test "-var-assign lfloat 1.2345" \
 	"\\^done,value=\"1.23.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 2nd"
 
 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
 	"\\^done,value=\"$hex\"" \
@@ -648,7 +650,9 @@ mi_gdb_test "-var-delete endvar" \
 
 mi_delete_breakpoints
 
-mi_runto do_locals_tests
+with_test_prefix "second run" {
+  mi_runto do_locals_tests
+}
 
 mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj"
 mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value"
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 39c4602a40..0529b67c7f 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -366,23 +366,25 @@ void do_frozen_tests ()
 
   int v2 = 4;
   /*: 
-    mi_create_varobj V1 v1 "create varobj for v1" 
-    mi_create_varobj V2 v2 "create varobj for v2"
-
-    mi_list_varobj_children "V1" {
-        {"V1.i" "i" "0" "int"}
-	{"V1.nested" "nested" "2" "struct {...}"}
-    } "list children of v1"
-
-    mi_list_varobj_children "V1.nested" {
-        {"V1.nested.j" "j" "0" "int"}
-        {"V1.nested.k" "k" "0" "int"}
-    } "list children of v1.nested"
-
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
-    mi_check_varobj_value V2 4 "check V2: 4"
+    with_test_prefix "create varobj V1 and V2" {
+	mi_create_varobj V1 v1 "create varobj for v1"
+	mi_create_varobj V2 v2 "create varobj for v2"
+
+	mi_list_varobj_children "V1" {
+	    {"V1.i" "i" "0" "int"}
+	    {"V1.nested" "nested" "2" "struct {...}"}
+	} "list children of v1"
+
+	mi_list_varobj_children "V1.nested" {
+	    {"V1.nested.j" "j" "0" "int"}
+	    {"V1.nested.k" "k" "0" "int"}
+	} "list children of v1.nested"
+
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+	mi_check_varobj_value V2 4 "check V2: 4"
+    }
   :*/
   v2 = 5;
   /*: 
@@ -400,40 +402,50 @@ void do_frozen_tests ()
   v1.nested.j = 8;
   v1.nested.k = 9;
   /*:
-    set_frozen V1 1
-    mi_varobj_update * {} "update varobjs: nothing changed"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
+    with_test_prefix "frozen V1" {
+	set_frozen V1 1
+	mi_varobj_update * {} "update varobjs: nothing changed"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+    }
     # Check that explicit update for elements of structures
     # works.
-    # Update v1.j
-    mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
-    # Update v1.nested, check that children is updated.
-    mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
-    # Update v1.i
-    mi_varobj_update V1.i {V1.i} "update V1.i"
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    with_test_prefix "update v1.j" {
+	# Update v1.j
+	mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+    }
+    with_test_prefix "update v1.nested" {
+	# Update v1.nested, check that children is updated.
+	mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
+    }
+    with_test_prefix "update v1.i" {
+	# Update v1.i
+	mi_varobj_update V1.i {V1.i} "update V1.i"
+	mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    }
   :*/
   v1.i = 10;
   v1.nested.j = 11;
   v1.nested.k = 12;
   /*:
     # Check that unfreeze itself does not updates the values.
-    set_frozen V1 0
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
-    mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
-    mi_check_varobj_value V1.i 10 "check V1.i: 10"
-    mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
-    mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12"    
+    with_test_prefix "unfrozen V1" {
+	set_frozen V1 0
+	mi_check_varobj_value V1.i 7 "check V1.i: 7"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
+	mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
+	mi_check_varobj_value V1.i 10 "check V1.i: 10"
+	mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
+	mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12"
+    }
   :*/    
   
   /*: END: frozen :*/
-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v3 testsuite] Fix some duplicate test names
  2020-05-26 19:02 ` [PATCH,v3 " Luis Machado
@ 2020-05-26 19:35   ` Pedro Alves
  2020-05-26 20:23     ` Luis Machado
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2020-05-26 19:35 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 5/26/20 8:02 PM, Luis Machado via Gdb-patches wrote:

> @@ -45,10 +45,10 @@ proc break_at { breakpoint where } {
>  
>      set test "break $breakpoint"
>      set bp 0
> -    gdb_test_multiple "$test" "$test" {
> +    gdb_test_multiple "$test" "$test inserted as number $bp" {

As discussed, this change should be backed out, and replaced with
with_test_prefix, right?  $bp is always zero here.

>  	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
>  	    set bp $expect_out(1,string)
> -	    pass "$test"
> +	    pass $gdb_test_name
>  	}
>      }
>      return $bp


Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v3 testsuite] Fix some duplicate test names
  2020-05-26 19:35   ` Pedro Alves
@ 2020-05-26 20:23     ` Luis Machado
  2020-05-26 20:52       ` Pedro Alves
  0 siblings, 1 reply; 12+ messages in thread
From: Luis Machado @ 2020-05-26 20:23 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

On 5/26/20 4:35 PM, Pedro Alves wrote:
> On 5/26/20 8:02 PM, Luis Machado via Gdb-patches wrote:
> 
>> @@ -45,10 +45,10 @@ proc break_at { breakpoint where } {
>>   
>>       set test "break $breakpoint"
>>       set bp 0
>> -    gdb_test_multiple "$test" "$test" {
>> +    gdb_test_multiple "$test" "$test inserted as number $bp" {
> 
> As discussed, this change should be backed out, and replaced with
> with_test_prefix, right?  $bp is always zero here.

Ugh... EWRONGPATCH, apologies. I must have mixed up the files when 
sending. This was already fixed.

Follows the updated one (for sure).

[-- Attachment #2: 0001-Fix-some-duplicate-test-names.patch --]
[-- Type: text/x-patch, Size: 55432 bytes --]

From d92af2fb352160111e1bac2f06cff6327eb95165 Mon Sep 17 00:00:00 2001
From: Luis Machado <luis.machado@linaro.org>
Date: Mon, 25 May 2020 13:25:50 -0300
Subject: [PATCH,v3 testsuite] Fix some duplicate test names

Updates on v3:

- Fixups to gdb.arch/arm-disp-step.exp, gdb.base/ena-dis-br.exp
  and gdb.base/async.exp.
- Used with_test_prefix for gdb.base/foll-exec.exp.

Updates on v2:

- Fixed use of parentheses.
- Fixed upper case in test name.
- Switched to using with_test_prefix in gdb.mi/var-cmd.c.

While doing a testsuite run on aarch64-linux, I noticed a bunch of duplicated
test name results. It annoyed me a little, so I decided to go ahead and fix the
worst offenders.

The following patch brings the duplicate test names down from 461 to 137.

The remaining ones are mostly scattered across the testsuite, with 1 to 3
duplicates per testcase. We can fix those as we go, or if I get annoyed with
them again.

It is worth mentioning that making those stand out and be annoying worked
nicely as a motivation to get them fixed.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Luis Machado  <luis.machado@linaro.org>

	* gdb.arch/aarch64-sighandler-regs.exp: Fix duplicated test names.
	* gdb.arch/aarch64-tagged-pointer.exp: Likewise.
	* gdb.arch/arm-disassembler-options.exp: Likewise.
	* gdb.arch/arm-disp-step.exp: Likewise.
	* gdb.arch/thumb-prologue.exp: Likewise.
	* gdb.base/async.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/complex-parts.exp: Likewise.
	* gdb.base/ena-dis-br.exp: Likewise.
	* gdb.base/foll-exec.exp: Likewise.
	* gdb.base/permissions.exp: Likewise.
	* gdb.base/relocate.exp: Likewise.
	* gdb.base/return2.exp: Likewise.
	* gdb.base/sigbpt.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.cp/converts.exp: Likewise.
	* gdb.cp/exceptprint.exp: Likewise.
	* gdb.cp/inherit.exp: Likewise.
	* gdb.cp/nsnoimports.exp: Likewise.
	* gdb.cp/virtbase2.exp: Likewise.
	* gdb.mi/mi-var-cmd.exp: Likewise.
	* gdb.mi/var-cmd.c: Likewise.
---
 .../gdb.arch/aarch64-sighandler-regs.exp      |  67 ++++++-----
 .../gdb.arch/aarch64-tagged-pointer.exp       |   8 +-
 .../gdb.arch/arm-disassembler-options.exp     |   2 +-
 gdb/testsuite/gdb.arch/arm-disp-step.exp      |  39 ++++---
 gdb/testsuite/gdb.arch/thumb-prologue.exp     |   2 +-
 gdb/testsuite/gdb.base/async.exp              |   6 +-
 gdb/testsuite/gdb.base/auxv.exp               |   4 +-
 gdb/testsuite/gdb.base/complex-parts.exp      |  36 ++++--
 gdb/testsuite/gdb.base/ena-dis-br.exp         |  57 ++++++++--
 gdb/testsuite/gdb.base/foll-exec.exp          |  33 ++++--
 gdb/testsuite/gdb.base/permissions.exp        |  59 +++++-----
 gdb/testsuite/gdb.base/relocate.exp           | 104 +++++++++++-------
 gdb/testsuite/gdb.base/return2.exp            |   2 +-
 gdb/testsuite/gdb.base/sigbpt.exp             |   8 +-
 gdb/testsuite/gdb.base/siginfo-obj.exp        |  36 +++---
 gdb/testsuite/gdb.cp/converts.exp             |  60 +++++-----
 gdb/testsuite/gdb.cp/exceptprint.exp          |  24 ++--
 gdb/testsuite/gdb.cp/inherit.exp              |  11 +-
 gdb/testsuite/gdb.cp/nsnoimports.exp          |  44 ++++----
 gdb/testsuite/gdb.cp/virtbase2.exp            |  28 +++--
 gdb/testsuite/gdb.mi/mi-var-cmd.exp           |  28 +++--
 gdb/testsuite/gdb.mi/var-cmd.c                |  98 +++++++++--------
 22 files changed, 450 insertions(+), 306 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
index 9faab7897c..1dedd336b5 100644
--- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp
@@ -100,16 +100,18 @@ set mainframe [expr $handlerframe + 2]
 
 # Check register values
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 1st" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+  }
 }
 
 # Switch to the frame for main(), and check register values
@@ -118,16 +120,19 @@ gdb_test "frame $mainframe" \
       "#$mainframe.*in main ().*" \
       "set to main frame"
 
-check_regs x $xreg_nums $reg_main_value_64 ""
-check_regs v $vreg_nums $reg_main_value_128 ".q.u"
-check_regs q $vreg_nums $reg_main_value_128 ".u"
-check_regs d $vreg_nums $reg_main_value_64 ".u"
-check_regs s $vreg_nums $reg_main_value_32 ".u"
-check_regs h $vreg_nums $reg_main_value_16 ".u"
-check_regs b $vreg_nums $reg_main_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_main_value ".d.u"
-  check_regs p $preg_nums $preg_main_value ""
+
+with_test_prefix "main frame" {
+  check_regs x $xreg_nums $reg_main_value_64 ""
+  check_regs v $vreg_nums $reg_main_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_main_value_128 ".u"
+  check_regs d $vreg_nums $reg_main_value_64 ".u"
+  check_regs s $vreg_nums $reg_main_value_32 ".u"
+  check_regs h $vreg_nums $reg_main_value_16 ".u"
+  check_regs b $vreg_nums $reg_main_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_main_value ".d.u"
+    check_regs p $preg_nums $preg_main_value ""
+  }
 }
 
 # Switch back to the signal handler frame, and check register values
@@ -136,14 +141,16 @@ gdb_test "frame $handlerframe" \
       "#$handlerframe.*handler \\\(sig=4\\\).*" \
       "set to signal handler frame"
 
-check_regs x $xreg_nums $reg_handler_value_64 ""
-check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
-check_regs q $vreg_nums $reg_handler_value_128 ".u"
-check_regs d $vreg_nums $reg_handler_value_64 ".u"
-check_regs s $vreg_nums $reg_handler_value_32 ".u"
-check_regs h $vreg_nums $reg_handler_value_16 ".u"
-check_regs b $vreg_nums $reg_handler_value_8 ".u"
-if { $sve_hw } {
-  check_regs z $vreg_nums $zreg_handler_value ".d.u"
-  check_regs p $preg_nums $preg_handler_value ""
+with_test_prefix "handler frame 2nd" {
+  check_regs x $xreg_nums $reg_handler_value_64 ""
+  check_regs v $vreg_nums $reg_handler_value_128 ".q.u"
+  check_regs q $vreg_nums $reg_handler_value_128 ".u"
+  check_regs d $vreg_nums $reg_handler_value_64 ".u"
+  check_regs s $vreg_nums $reg_handler_value_32 ".u"
+  check_regs h $vreg_nums $reg_handler_value_16 ".u"
+  check_regs b $vreg_nums $reg_handler_value_8 ".u"
+  if { $sve_hw } {
+    check_regs z $vreg_nums $zreg_handler_value ".d.u"
+    check_regs p $preg_nums $preg_handler_value ""
+}
 }
diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
index be19d8c0d7..957571fdf9 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp
@@ -35,17 +35,17 @@ gdb_continue_to_breakpoint "breakpoint here"
 
 # Test that GDB manages caches correctly for tagged address.
 # Read from P2,
-gdb_test "x p2" "$hex:\[\t \]+0x000004d2"
+gdb_test "x p2" "$hex:\[\t \]+0x000004d2" "x p2"
 gdb_test_no_output "set variable i = 5678"
 # Test that *P2 is updated.
-gdb_test "x p2" "$hex:\[\t \]+0x0000162e"
+gdb_test "x p2" "$hex:\[\t \]+0x0000162e" "x p2, updated"
 
 # Read from SP1->i,
-gdb_test "print sp1->i" " = 1234"
+gdb_test "print sp1->i" " = 1234" "print SP1->i"
 # Write to SP2->i,
 gdb_test_no_output "set variable sp2->i = 5678"
 # Test that SP1->i is updated.
-gdb_test "print sp1->i" " = 5678"
+gdb_test "print sp1->i" " = 5678" "print SP1->i, updated"
 
 gdb_test "x/d &sp2->i" "$hex:\[\t \]+5678"
 gdb_test "x/d &sp1->i" "$hex:\[\t \]+5678"
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index 82ead79f25..b347cc5270 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -52,5 +52,5 @@ gdb_test "set architecture $arch2" \
 
 gdb_test "show disassembler-options" \
 	"The current disassembler options are '$option'.*" \
-	"show disassembler-options $option"
+	"show disassembler-options $option, modified architecture"
 
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp
index 034b8363b7..29189d0f60 100644
--- a/gdb/testsuite/gdb.arch/arm-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp
@@ -37,12 +37,12 @@ proc test_ldm_stm_pc {} {
 
     # Try to set breakpoint on test_ldm_stm_pc.  If symbol 'test_ldm_stm_pc'
     # can't be resolved, test case is compiled in Thumb mode, skip it.
-    gdb_test_multiple "break *test_ldm_stm_pc" "break test_ldm_stm_pc" {
+    gdb_test_multiple "break *test_ldm_stm_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldm_stm_pc"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
-	    pass "break test_ldm_stm_pc"
+	    pass $gdb_test_name
 	    return 0
 	}
     }
@@ -68,9 +68,9 @@ proc test_ldr_literal {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_ldr_literal" "break test_ldr_literal" {
+    gdb_test_multiple "break *test_ldr_literal" "" {
        -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-           pass "break test_ldr_literal"
+           pass $gdb_test_name
        }
        -re "No symbol.*\r\n$gdb_prompt $" {
            return 0
@@ -101,9 +101,9 @@ proc test_ldr_literal_16 {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_ldr_literal_16" "break test_ldr_literal_16" {
+    gdb_test_multiple "break *test_ldr_literal_16" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -191,9 +191,9 @@ proc test_cbz_cbnz {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_zero_cbnz" "break test_zero_cbnz" {
+    gdb_test_multiple "break *test_zero_cbnz" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_ldr_literal"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -226,9 +226,9 @@ proc test_adr {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_adr" "break test_adr" {
+    gdb_test_multiple "break *test_adr" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -249,9 +249,9 @@ proc test_adr_32bit {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_adr_32bit" "break test_adr_32bit" {
+    gdb_test_multiple "break *test_adr_32bit" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_adr"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return 0
@@ -309,7 +309,7 @@ proc test_pop_pc {} {
 	"break test_pop_pc_3_right"
     gdb_test "break *test_pop_pc_3_wrong" \
 	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break test_pop_pc_1_wrong"
+	"break test_pop_pc_3_wrong"
 
     gdb_continue_to_breakpoint "continue to test_pop_pc_1" \
 	".*b.*\{r1\, pc\}.*"
@@ -334,12 +334,12 @@ proc test_str_pc {} {
     global srcfile
     global gdb_prompt
 
-    gdb_test_multiple "break *test_str_pc" "break test_str_pc" {
+    gdb_test_multiple "break *test_str_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass "break test_str_pc"
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
-	    pass "break test_str_pc"
+	    pass $gdb_test_name
 	    return
 	}
     }
@@ -371,10 +371,9 @@ proc test_str_pc {} {
 proc test_add_rn_pc {} {
     global srcfile gdb_prompt
 
-    set test "break test_add_rn_pc"
-    gdb_test_multiple "break *test_add_rn_pc" $test {
+    gdb_test_multiple "break *test_add_rn_pc" "" {
 	-re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
-	    pass $test
+	    pass $gdb_test_name
 	}
 	-re "No symbol.*\r\n$gdb_prompt $" {
 	    return
diff --git a/gdb/testsuite/gdb.arch/thumb-prologue.exp b/gdb/testsuite/gdb.arch/thumb-prologue.exp
index b463fd7dc4..0c6de8a7ce 100644
--- a/gdb/testsuite/gdb.arch/thumb-prologue.exp
+++ b/gdb/testsuite/gdb.arch/thumb-prologue.exp
@@ -83,4 +83,4 @@ gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128"
 
 gdb_test "backtrace 10" \
 	"#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \
-	"backtrace in write_sp"
+	"backtrace in write_sp, 2nd stop"
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index 1a4d3fbee8..32711d04ba 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -87,7 +87,7 @@ set test "get next insn"
 gdb_test_multiple {x/2i $pc} "$test" {
     -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
 	set next_insn_addr $expect_out(1,string)
-	pass "$test"
+	pass $gdb_test_name
     }
 }
 set next_insn_is_stmt [hex_in_list $next_insn_addr $is_stmt]
@@ -102,11 +102,11 @@ test_background "stepi&" "" ".*$prefix x = 5; .*"
 
 # Get the next instruction address.
 set next_insn_addr ""
-set test "get next insn"
+set test "get next insn, 2nd"
 gdb_test_multiple {x/2i $pc} "$test" {
     -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
 	set next_insn_addr $expect_out(1,string)
-	pass "$test"
+	pass $gdb_test_name
     }
 }
 set next_insn_is_stmt \
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 9834a3564d..07c07c451e 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -126,8 +126,8 @@ set live_data [fetch_auxv "info auxv on live process"]
 set gcore_works [gdb_gcore_cmd "$gcorefile" "gcore"]
 
 # Let the program continue and die.
-gdb_test continue ".*Program received signal.*"
-gdb_test continue ".*Program terminated with signal.*"
+gdb_test continue ".*Program received signal.*" "continue until signal"
+gdb_test continue ".*Program terminated with signal.*" "continue and terminate"
 
 # Now collect the core dump it left.
 set test "generate native core dump"
diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp
index 38aad395ad..7719ff14df 100644
--- a/gdb/testsuite/gdb.base/complex-parts.exp
+++ b/gdb/testsuite/gdb.base/complex-parts.exp
@@ -35,23 +35,35 @@ gdb_test "ptype z1" " = complex double"
 gdb_test "ptype z2" " = complex float"
 gdb_test "ptype z3" " = complex long double"
 
-gdb_test "p \$_cimag (z1)" " = 4.5"
-gdb_test "ptype \$" " = double"
+with_test_prefix "double imaginary" {
+    gdb_test "p \$_cimag (z1)" " = 4.5"
+    gdb_test "ptype \$" " = double"
+}
 
-gdb_test "p \$_cimag (z2)" " = -5.5"
-gdb_test "ptype \$" " = float"
+with_test_prefix "float imaginary" {
+    gdb_test "p \$_cimag (z2)" " = -5.5"
+    gdb_test "ptype \$" " = float"
+}
 
-gdb_test "p \$_cimag (z3)" " = 6.5"
-gdb_test "ptype \$" " = long double"
+with_test_prefix "long double imaginary" {
+    gdb_test "p \$_cimag (z3)" " = 6.5"
+    gdb_test "ptype \$" " = long double"
+}
 
-gdb_test "p \$_creal (z1)" " = 1.5"
-gdb_test "ptype \$" " = double"
+with_test_prefix "double real" {
+    gdb_test "p \$_creal (z1)" " = 1.5"
+    gdb_test "ptype \$" " = double"
+}
 
-gdb_test "p \$_creal (z2)" " = 2.5"
-gdb_test "ptype \$" " = float"
+with_test_prefix "float real" {
+    gdb_test "p \$_creal (z2)" " = 2.5"
+    gdb_test "ptype \$" " = float"
+}
 
-gdb_test "p \$_creal (z3)" " = 3.5"
-gdb_test "ptype \$" " = long double"
+with_test_prefix "long double real" {
+    gdb_test "p \$_creal (z3)" " = 3.5"
+    gdb_test "ptype \$" " = long double"
+}
 
 gdb_test "p \$_cimag (d1)" "expected a complex number"
 gdb_test "p \$_cimag (f1)" "expected a complex number"
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index c338a0d51f..d43e47efa0 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -48,7 +48,7 @@ proc break_at { breakpoint where } {
     gdb_test_multiple "$test" "$test" {
 	-re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
 	    set bp $expect_out(1,string)
-	    pass "$test"
+	    pass $gdb_test_name
 	}
     }
     return $bp
@@ -104,7 +104,12 @@ gdb_test "info break $bp" \
 
 # Verify that we don't stop at a disabled breakpoint.
 gdb_continue_to_end "no stop"
-rerun_to_main
+
+set count 1
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 gdb_continue_to_end "no stop at auto-disabled break marker2"
 
 # Verify that we can set a breakpoint to be self-deleting after the
@@ -149,7 +154,9 @@ if ![runto_main] then {
 
 set bp [break_at $bp_location7 "line $bp_location7"]
 
-set bp2 [break_at marker1 " line $bp_location15"]
+with_test_prefix "enable count" {
+  set bp2 [break_at marker1 " line $bp_location15"]
+}
 
 gdb_test "enable count" \
     "Argument required \\(hit count\\)\\." \
@@ -181,7 +188,9 @@ if ![runto_main] then {
     fail "enable/disable break tests suppressed"
 }
 
-set bp [break_at "marker1" " line $bp_location15.*"]
+with_test_prefix "ignore count" {
+    set bp [break_at "marker1" " line $bp_location15.*"]
+}
 
 # Verify that an ignore of a non-existent breakpoint is gracefully
 # handled.
@@ -216,7 +225,11 @@ gdb_test "info break $bp" \
     "info ignored break marker1"
 
 gdb_continue_to_end "no stop at ignored break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 # See the comments in condbreak.exp for "run until breakpoint at marker1" 
 # for an explanation of the xfail below.
@@ -236,7 +249,9 @@ if ![runto_main] then {
     fail "enable/disable break tests suppressed"
 }
 
-set bp [break_at marker1 " line $bp_location15.*"]
+with_test_prefix "ignore count and auto-delete" {
+    set bp [break_at marker1 " line $bp_location15.*"]
+}
 
 gdb_test "ignore $bp 1" \
     "Will ignore next crossing of breakpoint \[0-9\]*.*" \
@@ -249,7 +264,11 @@ gdb_test "info break $bp" \
     "info break marker1 after hitting breakpoint"
 
 gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+    incr count
+}
 
 gdb_test "continue" \
     ".*marker1 .*:$bp_location15.*" \
@@ -262,7 +281,9 @@ if ![runto_main] then {
     fail "enable/disable break tests suppressed"
 }
 
-set bp [break_at marker1 " line $bp_location15"]
+with_test_prefix "disabled breakpoint ignore count" {
+    set bp [break_at marker1 " line $bp_location15"]
+}
 
 gdb_test "ignore $bp 10" \
     "Will ignore next 10 crossings of breakpoint \[0-9\]*.*" \
@@ -271,7 +292,10 @@ gdb_test "ignore $bp 10" \
 gdb_test_no_output "disable $bp" "disable break marker1"
 
 gdb_continue_to_end "no stop at ignored & disabled break marker1"
-rerun_to_main
+
+with_test_prefix "run $count" {
+    rerun_to_main
+}
 
 gdb_test "info break $bp" \
     "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
@@ -315,9 +339,18 @@ set b2 0
 set b3 0
 set b4 0
 set b1 [break_at main ""]
-set b2 [break_at main ""]
-set b3 [break_at main ""]
-set b4 [break_at main ""]
+
+with_test_prefix "2nd breakpoint" {
+    set b2 [break_at main ""]
+}
+
+with_test_prefix "3rd breakpoint" {
+    set b3 [break_at main ""]
+}
+
+with_test_prefix "4th breakpoint" {
+    set b4 [break_at main ""]
+}
 
 # Perform tests for disable/enable commands on multiple
 # locations and breakpoints.
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 825c7e22c1..b0e155dd37 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -78,10 +78,13 @@ proc do_exec_tests {} {
      fail "couldn't run ${testfile}"
      return
    }
-   # Execute the code setting up variable PROG.
-   set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+
+   with_test_prefix "1st run" {
+       # Execute the code setting up variable PROG.
+       set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
+       gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint"
+       gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   }
 
    # Verify that we can see various global and local variables
    # in this program, and that they have expected values.  Some
@@ -234,10 +237,13 @@ proc do_exec_tests {} {
      fail "couldn't run ${testfile} (3rd try)"
      return
    }
-   # Execute the code setting up variable PROG.
-   set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+
+   with_test_prefix "2nd run" {
+       # Execute the code setting up variable PROG.
+       set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
+       gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint"
+       gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   }
 
    # Verify that we can follow through follow an execl()
    # call.  (We must jump around earlier exec* calls.)
@@ -299,10 +305,13 @@ proc do_exec_tests {} {
      fail "couldn't run ${testfile} (4th try)"
      return
    }
-   # Execute the code setting up variable PROG.
-   set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
-   gdb_test "tbreak ${tbreak_line}"
-   gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+
+   with_test_prefix "3rd run" {
+       # Execute the code setting up variable PROG.
+       set tbreak_line [gdb_get_line_number " tbreak-execlp " $srcfile]
+       gdb_test "tbreak ${tbreak_line}" "" "insert breakpoint"
+       gdb_continue_to_breakpoint "line tbreak-execlp" ".*execlp \\(.*"
+   }
 
    # Verify that we can follow through follow an execv()
    # call.  (We must jump around earlier exec* calls.)
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 4a41f74115..6cc6f70eb9 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -34,43 +34,48 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is on."
+with_test_prefix "observer mode off" {
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is on."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is on."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is on."
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is on."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is on."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is on."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
+
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is on."
+}
 
 gdb_test "set observer on" "Observer mode is now on." "enable observer mode"
 
-gdb_test "show may-write-memory" \
-    "Permission to write into target memory is off."
+with_test_prefix "observer mode on" {
+    gdb_test "show may-write-memory" \
+	"Permission to write into target memory is off."
 
-gdb_test "show may-write-registers" \
-    "Permission to write into registers is off."
+    gdb_test "show may-write-registers" \
+	"Permission to write into registers is off."
 
-gdb_test "show may-insert-breakpoints" \
-    "Permission to insert breakpoints in the target is off."
+    gdb_test "show may-insert-breakpoints" \
+	"Permission to insert breakpoints in the target is off."
 
-gdb_test "show may-insert-tracepoints" \
-    "Permission to insert tracepoints in the target is off."
+    gdb_test "show may-insert-tracepoints" \
+	"Permission to insert tracepoints in the target is off."
 
-gdb_test "show may-insert-fast-tracepoints" \
-    "Permission to insert fast tracepoints in the target is on."
+    gdb_test "show may-insert-fast-tracepoints" \
+	"Permission to insert fast tracepoints in the target is on."
 
-gdb_test "show may-interrupt" \
-    "Permission to interrupt or signal the target is off."
+    gdb_test "show may-interrupt" \
+	"Permission to interrupt or signal the target is off."
+}
 
 gdb_test "set observer off" "Observer mode is now off." "disable observer mode"
 
@@ -87,14 +92,14 @@ if ![runto_main] then {
 
 gdb_test "print x = 45" "$decimal = 45" "set a global"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global"
 
 gdb_test "set may-write-memory off"
 
 gdb_test "print x = 92" "Writing to memory is not allowed.*" \
-    "try to set a global"
+    "set a global, 2nd time"
 
-gdb_test "print x" "$decimal = 45"
+gdb_test "print x" "$decimal = 45" "validate setting a global, 2nd time"
 
 # FIXME Add tests for other flags when a testsuite-able target becomes
 # available.
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 68b0edeba5..906d16b4a4 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -152,9 +152,11 @@ gdb_test "add-symbol-file ${binfile} 0" \
 	"add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = 0x0\[\r\n\]+\\(y or n\\) " \
 	"y"
 
-# Print the addresses of static variables.
-set static_foo_addr [get_var_address static_foo]
-set static_bar_addr [get_var_address static_bar]
+with_test_prefix "print addresses, static vars" {
+    # Print the addresses of static variables.
+    set static_foo_addr [get_var_address static_foo]
+    set static_bar_addr [get_var_address static_bar]
+}
 
 # Make sure they have different addresses.
 if { "${static_foo_addr}" == "${static_bar_addr}" } {
@@ -163,9 +165,11 @@ if { "${static_foo_addr}" == "${static_bar_addr}" } {
   pass "static variables have different addresses"
 }
 
-# Print the addresses of global variables.
-set global_foo_addr [get_var_address global_foo]
-set global_bar_addr [get_var_address global_bar]
+with_test_prefix "print addresses, global vars" {
+    # Print the addresses of global variables.
+    set global_foo_addr [get_var_address global_foo]
+    set global_bar_addr [get_var_address global_bar]
+}
 
 # Make sure they have different addresses.
 if { "${global_foo_addr}" == "${global_bar_addr}" } {
@@ -174,9 +178,11 @@ if { "${global_foo_addr}" == "${global_bar_addr}" } {
   pass "global variables have different addresses"
 }
 
-# Print the addresses of functions.
-set function_foo_addr [get_var_address function_foo]
-set function_bar_addr [get_var_address function_bar]
+with_test_prefix "print addresses, functions" {
+    # Print the addresses of functions.
+    set function_foo_addr [get_var_address function_foo]
+    set function_bar_addr [get_var_address function_bar]
+}
 
 # Make sure they have different addresses.
 if { "${function_foo_addr}" == "${function_bar_addr}" } {
@@ -220,20 +226,26 @@ gdb_test "symbol-file -o $offset $binfile" \
     "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with offset"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
-    "static variable foo is moved by offset"
+with_test_prefix "static vars" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert {${new_static_foo_addr} == ${static_foo_addr} + $offset} \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert {${new_global_foo_addr} == ${global_foo_addr} + $offset} \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
-    "function foo is moved by offset"
+with_test_prefix "functions" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert {${new_function_foo_addr} == ${function_foo_addr} + $offset} \
+	"function foo is moved by offset"
+}
 
 # Load the object using add-symbol-file with an offset and check that
 # all addresses are moved by that offset.
@@ -246,20 +258,26 @@ gdb_test "add-symbol-file -o $offset $binfile" \
     "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure the address of a static variable is moved by offset.
-set new_static_foo_addr [get_var_address static_foo]
-gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
-    "static variable foo is moved by offset"
+with_test_prefix "static scope, 2nd" {
+    # Make sure the address of a static variable is moved by offset.
+    set new_static_foo_addr [get_var_address static_foo]
+    gdb_assert { ${new_static_foo_addr} == ${static_foo_addr} + $offset } \
+	"static variable foo is moved by offset"
+}
 
-# Make sure the address of a global variable is moved by offset.
-set new_global_foo_addr [get_var_address global_foo]
-gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
-    "global variable foo is moved by offset"
+with_test_prefix "global vars, 2nd" {
+    # Make sure the address of a global variable is moved by offset.
+    set new_global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${new_global_foo_addr} == ${global_foo_addr} + $offset } \
+	"global variable foo is moved by offset"
+}
 
-# Make sure the address of a function is moved by offset.
-set new_function_foo_addr [get_var_address function_foo]
-gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
-    "function foo is moved by offset"
+with_test_prefix "functions, 2nd" {
+    # Make sure the address of a function is moved by offset.
+    set new_function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${new_function_foo_addr} == ${function_foo_addr} + $offset } \
+	"function foo is moved by offset"
+}
 
 # Re-load the object giving an explicit address for .text
 
@@ -271,10 +289,12 @@ gdb_test "add-symbol-file $binfile -o $offset $text" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure function has a different addresses now.
-set function_foo_addr [get_var_address function_foo]
-gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
-    "function foo has a different address"
+with_test_prefix "functions, 3rd" {
+    # Make sure function has a different addresses now.
+    set function_foo_addr [get_var_address function_foo]
+    gdb_assert { ${function_foo_addr} != ${new_function_foo_addr} } \
+	"function foo has a different address"
+}
 
 # Re-load the object giving an explicit address for .data
 
@@ -286,10 +306,12 @@ gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
 
-# Make sure variable has a different addresses now.
-set global_foo_addr [get_var_address global_foo]
-gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
-    "global variable foo has a different address"
+with_test_prefix "global vars, 3rd" {
+    # Make sure variable has a different addresses now.
+    set global_foo_addr [get_var_address global_foo]
+    gdb_assert { ${global_foo_addr} != ${new_global_foo_addr} } \
+	"global variable foo has a different address"
+}
 
 # Now try loading the object as an exec-file; we should be able to print
 # the values of variables after we do this.
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index ad1dcc8e0f..e93f4d8530 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -50,7 +50,7 @@ proc return_1 { type } {
     gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
 	    "${type} value returned successfully"
     gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
-	    "validate result value not equal to program return value"
+	    "validate result value not equal to program return value, ${type}"
 }
 
 proc return_void { } {
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index fb3a676bbd..bd7e1d8db9 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -138,7 +138,9 @@ proc stepi_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
@@ -212,7 +214,9 @@ proc cont_out { name args } {
     # disable SIGSEGV, ensuring that further signals stop the
     # inferior.  Stops a SIGSEGV infinite loop when a broke system
     # keeps re-executing the faulting instruction.
-    rerun_to_main
+    with_test_prefix $name {
+	rerun_to_main
+    }
     gdb_test "handle ${signame} nostop print pass" ".*" "${name}; pass ${signame}"
     gdb_test "continue" "keeper.*" "${name}; continue to keeper"
     gdb_test "handle ${signame} stop print nopass" ".*" "${name}; nopass ${signame}"
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp
index 1ce2d201c1..0ea3c2350e 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.exp
+++ b/gdb/testsuite/gdb.base/siginfo-obj.exp
@@ -45,7 +45,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 1st"
 
 # Try to generate a core file, for a later test.
 set gcorefile [standard_output_file $testfile.gcore]
@@ -86,13 +87,14 @@ gdb_test_multiple "p \$_siginfo" "$test" {
 
 set bp_location [gdb_get_line_number "set breakpoint here"]
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
-gdb_test "p ssi_errno" " = $ssi_errno"
-gdb_test "p ssi_code" " = $ssi_code"
-gdb_test "p ssi_signo" " = $ssi_signo"
+with_test_prefix "validate siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) $ssi_addr"
+    gdb_test "p ssi_errno" " = $ssi_errno"
+    gdb_test "p ssi_code" " = $ssi_code"
+    gdb_test "p ssi_signo" " = $ssi_signo"
+}
 
 # Again, but this time, patch si_addr and check that the inferior sees
 # the changed value.
@@ -104,7 +106,8 @@ if ![runto_main] then {
 }
 
 # Run to the signal.
-gdb_test "continue" ".*Program received signal SIGSEGV.*" "continue to signal"
+gdb_test "continue" ".*Program received signal SIGSEGV.*" \
+	 "continue to signal, 2nd"
 
 set test "set si_addr"
 gdb_test "p \$_siginfo._sifields._sigfault.si_addr = 0x666" " = \\(void \\*\\) 0x666"
@@ -112,13 +115,14 @@ gdb_test "p \$_siginfo.si_errno = 666" " = 666"
 gdb_test "p \$_siginfo.si_code = 999" " = 999"
 gdb_test "p \$_siginfo.si_signo = 11" " = 11"
 
-gdb_test "break $bp_location"
-gdb_test "continue" ".* handler .*" "continue to handler"
-
-gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
-gdb_test "p ssi_errno" " = 666"
-gdb_test "p ssi_code" " = 999"
-gdb_test "p ssi_signo" " = 11"
+with_test_prefix "validate modified siginfo fields" {
+    gdb_test "break $bp_location"
+    gdb_test "continue" ".* handler .*" "continue to handler"
+    gdb_test "p ssi_addr" " = \\(void \\*\\) 0x666"
+    gdb_test "p ssi_errno" " = 666"
+    gdb_test "p ssi_code" " = 999"
+    gdb_test "p ssi_signo" " = 11"
+}
 
 # Test siginfo preservation in core files.
 if {$gcore_created} {
diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp
index 730c7f68df..5ef57feb56 100644
--- a/gdb/testsuite/gdb.cp/converts.exp
+++ b/gdb/testsuite/gdb.cp/converts.exp
@@ -36,8 +36,10 @@ gdb_test "p foo0_3 (bppp)" "Cannot resolve.*" \
 
 gdb_test "p foo1_1 (a)"  "= 11"             "pointer to pointer"
 gdb_test "p foo1_2 (a)"  "= 12"             "pointer to array"
-gdb_test "p foo1_3 (a)"  "Cannot resolve.*" "pointer to pointer of wrong type"
-gdb_test "p foo1_3 (bp)" "Cannot resolve.*" "pointer to pointer of wrong type"
+gdb_test "p foo1_3 (a)"  "Cannot resolve.*" \
+	 "pointer to pointer of wrong type, a"
+gdb_test "p foo1_3 (bp)" "Cannot resolve.*" \
+	 "pointer to pointer of wrong type, bp"
 gdb_test "p foo1_4 (bp)" "= 14"             "pointer to ancestor pointer"
 gdb_test "p foo1_5 (bp)" "= 15"             "pointer to void pointer"
 gdb_test "p foo1_6 (bp)" "Cannot resolve.*"     "pointer to void pointer pointer"
@@ -94,28 +96,36 @@ gdb_test "p foo1_7(ta)" \
 
 # Test for strict type checking
 set error_str "Cannot resolve function %s to any overloaded instance"
-gdb_test "show check type" "Strict type checking is on\."
-gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
-gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
-gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
-gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
-gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+gdb_test "show check type" "Strict type checking is on\." \
+	 "confirm check type on"
+
+with_test_prefix "strict type checking on" {
+    gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
+    gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
+    gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
+    gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
+}
 
 gdb_test_no_output "set check type off"
-gdb_test "show check type" "Strict type checking is off\."
-gdb_test "p foo1_type_check (123)" " = 1000"
-gdb_test "p foo2_type_check (0, 1)" " = 1001"
-gdb_test "p foo2_type_check (1, 0)" " = 1001"
-gdb_test "p foo2_type_check (1, 1)" " = 1001"
-gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
-gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
-gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
-gdb_test "p foo3_2 (1,1)" " = 32"
+gdb_test "show check type" "Strict type checking is off\." \
+	 "confirm check type off"
+
+with_test_prefix "strict type checking off" {
+    gdb_test "p foo1_type_check (123)" " = 1000"
+    gdb_test "p foo2_type_check (0, 1)" " = 1001"
+    gdb_test "p foo2_type_check (1, 0)" " = 1001"
+    gdb_test "p foo2_type_check (1, 1)" " = 1001"
+    gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
+    gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
+    gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
+    gdb_test "p foo3_2 (1,1)" " = 32"
+}
diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp
index 1248987b2a..ad5f0c44bb 100644
--- a/gdb/testsuite/gdb.cp/exceptprint.exp
+++ b/gdb/testsuite/gdb.cp/exceptprint.exp
@@ -76,16 +76,20 @@ if {![runto_main]} {
     return -1
 }
 
-gdb_test "catch catch int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(catch\\)" \
-    "catch catch"
-gdb_test "catch throw int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(throw\\)" \
-    "catch throw"
-gdb_test "catch rethrow int if \$_exception == 23" \
-    "Catchpoint \[0-9\]+ \\(rethrow\\)" \
-    "catch rethrow"
+with_test_prefix "2nd run" {
+    gdb_test "catch catch int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(catch\\)" \
+	"catch catch"
+    gdb_test "catch throw int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(throw\\)" \
+	"catch throw"
+    gdb_test "catch rethrow int if \$_exception == 23" \
+	"Catchpoint \[0-9\]+ \\(rethrow\\)" \
+	"catch rethrow"
+}
 
 # This tests both the case where the regular expression does not
 # match, and the case where it does.
-do_exceptprint_tests int 23
+with_test_prefix "2nd run" {
+    do_exceptprint_tests int 23
+}
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 9616015709..59c72da6ae 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -693,9 +693,16 @@ proc do_tests { } {
 	return
     }
 
-    test_print_si_members
+    with_test_prefix "single inheritance" {
+	test_print_si_members
+    }
+
     test_print_si_classes
-    test_print_mi_members
+
+    with_test_prefix "multiple inheritance" {
+	test_print_mi_members
+    }
+
     test_print_mi_member_types
     test_print_mi_classes
     test_print_anon_union
diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp
index 98b4c56f4e..bbf255c3f4 100644
--- a/gdb/testsuite/gdb.cp/nsnoimports.exp
+++ b/gdb/testsuite/gdb.cp/nsnoimports.exp
@@ -25,37 +25,43 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "main scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "No symbol .* in current context."
-gdb_test "print ab" "No symbol .* in current context."
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print _a" "No symbol .* in current context."
+    gdb_test "print ab" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::first
 gdb_continue_to_breakpoint "A::B::first"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::first scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print C::abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print C::abc" "= 33"
 
-gdb_test "print abc" "No symbol .* in current context."
+    gdb_test "print abc" "No symbol .* in current context."
+}
 
 ############################################
 gdb_breakpoint A::B::C::second
 gdb_continue_to_breakpoint "A::B::C::second"
 
-gdb_test "print A::_a" "= 11"
-gdb_test "print A::B::ab" "= 22"
-gdb_test "print A::B::C::abc" "= 33"
+with_test_prefix "A::B::C::second scope" {
+    gdb_test "print A::_a" "= 11"
+    gdb_test "print A::B::ab" "= 22"
+    gdb_test "print A::B::C::abc" "= 33"
 
-gdb_test "print _a" "= 11"
-gdb_test "print ab" "= 22"
-gdb_test "print abc" "= 33"
+    gdb_test "print _a" "= 11"
+    gdb_test "print ab" "= 22"
+    gdb_test "print abc" "= 33"
+}
 
diff --git a/gdb/testsuite/gdb.cp/virtbase2.exp b/gdb/testsuite/gdb.cp/virtbase2.exp
index 6e968a5552..7b5392909e 100644
--- a/gdb/testsuite/gdb.cp/virtbase2.exp
+++ b/gdb/testsuite/gdb.cp/virtbase2.exp
@@ -63,23 +63,29 @@ proc make_scope_list { scopes } {
 }
 
 proc test_variables_in_base { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}i" " = 55"
-        gdb_test "print ${scope}d" " = 6.25"
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}i" " = 55"
+	  gdb_test "print ${scope}d" " = 6.25"
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_superbase { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}x" " = 22"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}x" " = 22"
+      }
+  }
 }
 
 proc test_variables_in_super { scopes } {
-    foreach scope [make_scope_list $scopes] {
-        gdb_test "print ${scope}w" " = 17"
-    }
+  with_test_prefix "$scopes" {
+      foreach scope [make_scope_list $scopes] {
+	  gdb_test "print ${scope}w" " = 17"
+      }
+  }
 }
 
 with_test_prefix "derived::func_d" {
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 9ce6a51072..260917a906 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -70,7 +70,9 @@ mi_gdb_test "113-var-create argc * argc" \
 	"113\\^error,msg=\"-var-create: unable to create variable object\"" \
 	"create out of scope variable"
 
-mi_runto do_locals_tests
+with_test_prefix "first run" {
+  mi_runto do_locals_tests
+}
 
 set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"]
 
@@ -253,7 +255,7 @@ mi_gdb_test "-var-assign global_simple 0" \
 
 mi_gdb_test "-var-assign linteger 3333" \
 	"\\^done,value=\"3333\"" \
-	"assign to linteger"
+	"assign to linteger, 1st"
 
 # Allow lpcharacter to update, optionally.  Because it points to a
 # char variable instead of a zero-terminated string, if linteger is
@@ -278,7 +280,7 @@ mi_gdb_test "-var-evaluate-expression linteger" \
 
 mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 1st"
 
 mi_gdb_test "-var-update *" \
 	"\\^done,changelist=\\\[\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
@@ -296,11 +298,11 @@ mi_gdb_test "-var-evaluate-expression lpinteger" \
 
 mi_gdb_test "-var-assign linteger 4321" \
 	"\\^done,value=\"4321\"" \
-	"assign to linteger"
+	"assign to linteger, 2nd"
 
 mi_gdb_test "-var-assign lpinteger &linteger" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lpinteger"
+	"assign to lpinteger, 2nd"
 
 mi_gdb_test "-var-assign lcharacter 'z'" \
 	"\\^done,value=\"122 'z'\"" \
@@ -312,33 +314,33 @@ mi_gdb_test "-var-evaluate-expression lcharacter" \
 
 mi_gdb_test "-var-assign llong 1313L" \
 	"\\^done,value=\"1313\"" \
-	"assign to llong"
+	"assign to llong, 1st"
 mi_gdb_test "-var-evaluate-expression llong" \
 	"\\^done,value=\"1313\"" \
 	"eval llong"
 mi_gdb_test "-var-assign llong 1212L" \
 	"\\^done,value=\"1212\"" \
-	"assign to llong"
+	"assign to llong, 2nd"
 
 mi_gdb_test "-var-assign lplong &llong+4" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 1st"
 mi_gdb_test "-var-evaluate-expression lplong" \
 	"\\^done,value=\"$hex\"" \
 	"eval lplong"
 mi_gdb_test "-var-assign lplong &llong" \
 	"\\^done,value=\"$hex\"" \
-	"assign to lplong"
+	"assign to lplong, 2nd"
 
 mi_gdb_test "-var-assign lfloat 3.4567" \
 	"\\^done,value=\"3.45.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 1st"
 mi_gdb_test "-var-evaluate-expression lfloat" \
 	"\\^done,value=\"3.45.*\"" \
 	"eval lfloat"
 mi_gdb_test "-var-assign lfloat 1.2345" \
 	"\\^done,value=\"1.23.*\"" \
-	"assign to lfloat"
+	"assign to lfloat, 2nd"
 
 mi_gdb_test "-var-assign lpfloat &lfloat+4" \
 	"\\^done,value=\"$hex\"" \
@@ -648,7 +650,9 @@ mi_gdb_test "-var-delete endvar" \
 
 mi_delete_breakpoints
 
-mi_runto do_locals_tests
+with_test_prefix "second run" {
+  mi_runto do_locals_tests
+}
 
 mi_create_varobj "L" "lsimple" "in-and-out-of-scope: create varobj"
 mi_check_varobj_value "L" "{...}" "in-and-out-of-scope: check initial value"
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 39c4602a40..0529b67c7f 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -366,23 +366,25 @@ void do_frozen_tests ()
 
   int v2 = 4;
   /*: 
-    mi_create_varobj V1 v1 "create varobj for v1" 
-    mi_create_varobj V2 v2 "create varobj for v2"
-
-    mi_list_varobj_children "V1" {
-        {"V1.i" "i" "0" "int"}
-	{"V1.nested" "nested" "2" "struct {...}"}
-    } "list children of v1"
-
-    mi_list_varobj_children "V1.nested" {
-        {"V1.nested.j" "j" "0" "int"}
-        {"V1.nested.k" "k" "0" "int"}
-    } "list children of v1.nested"
-
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
-    mi_check_varobj_value V2 4 "check V2: 4"
+    with_test_prefix "create varobj V1 and V2" {
+	mi_create_varobj V1 v1 "create varobj for v1"
+	mi_create_varobj V2 v2 "create varobj for v2"
+
+	mi_list_varobj_children "V1" {
+	    {"V1.i" "i" "0" "int"}
+	    {"V1.nested" "nested" "2" "struct {...}"}
+	} "list children of v1"
+
+	mi_list_varobj_children "V1.nested" {
+	    {"V1.nested.j" "j" "0" "int"}
+	    {"V1.nested.k" "k" "0" "int"}
+	} "list children of v1.nested"
+
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+	mi_check_varobj_value V2 4 "check V2: 4"
+    }
   :*/
   v2 = 5;
   /*: 
@@ -400,40 +402,50 @@ void do_frozen_tests ()
   v1.nested.j = 8;
   v1.nested.k = 9;
   /*:
-    set_frozen V1 1
-    mi_varobj_update * {} "update varobjs: nothing changed"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
+    with_test_prefix "frozen V1" {
+	set_frozen V1 1
+	mi_varobj_update * {} "update varobjs: nothing changed"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 2 "check V1.nested.j: 2"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+    }
     # Check that explicit update for elements of structures
     # works.
-    # Update v1.j
-    mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"    
-    # Update v1.nested, check that children is updated.
-    mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
-    mi_check_varobj_value V1.i 1 "check V1.i: 1"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
-    # Update v1.i
-    mi_varobj_update V1.i {V1.i} "update V1.i"
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    with_test_prefix "update v1.j" {
+	# Update v1.j
+	mi_varobj_update V1.nested.j {V1.nested.j} "update V1.nested.j"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 3 "check V1.nested.k: 3"
+    }
+    with_test_prefix "update v1.nested" {
+	# Update v1.nested, check that children is updated.
+	mi_varobj_update V1.nested {V1.nested.k} "update V1.nested"
+	mi_check_varobj_value V1.i 1 "check V1.i: 1"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
+    }
+    with_test_prefix "update v1.i" {
+	# Update v1.i
+	mi_varobj_update V1.i {V1.i} "update V1.i"
+	mi_check_varobj_value V1.i 7 "check V1.i: 7"
+    }
   :*/
   v1.i = 10;
   v1.nested.j = 11;
   v1.nested.k = 12;
   /*:
     # Check that unfreeze itself does not updates the values.
-    set_frozen V1 0
-    mi_check_varobj_value V1.i 7 "check V1.i: 7"
-    mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
-    mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"    
-    mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
-    mi_check_varobj_value V1.i 10 "check V1.i: 10"
-    mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
-    mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12"    
+    with_test_prefix "unfrozen V1" {
+	set_frozen V1 0
+	mi_check_varobj_value V1.i 7 "check V1.i: 7"
+	mi_check_varobj_value V1.nested.j 8 "check V1.nested.j: 8"
+	mi_check_varobj_value V1.nested.k 9 "check V1.nested.k: 9"
+	mi_varobj_update V1 {V1.i V1.nested.j V1.nested.k} "update V1"
+	mi_check_varobj_value V1.i 10 "check V1.i: 10"
+	mi_check_varobj_value V1.nested.j 11 "check V1.nested.j: 11"
+	mi_check_varobj_value V1.nested.k 12 "check V1.nested.k: 12"
+    }
   :*/    
   
   /*: END: frozen :*/
-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v3 testsuite] Fix some duplicate test names
  2020-05-26 20:23     ` Luis Machado
@ 2020-05-26 20:52       ` Pedro Alves
  2020-05-27 12:39         ` Luis Machado
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2020-05-26 20:52 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 5/26/20 9:23 PM, Luis Machado wrote:
> On 5/26/20 4:35 PM, Pedro Alves wrote:
>> On 5/26/20 8:02 PM, Luis Machado via Gdb-patches wrote:
>>
>>> @@ -45,10 +45,10 @@ proc break_at { breakpoint where } {
>>>         set test "break $breakpoint"
>>>       set bp 0
>>> -    gdb_test_multiple "$test" "$test" {
>>> +    gdb_test_multiple "$test" "$test inserted as number $bp" {
>>
>> As discussed, this change should be backed out, and replaced with
>> with_test_prefix, right?  $bp is always zero here.
> 
> Ugh... EWRONGPATCH, apologies. I must have mixed up the files when sending. This was already fixed.
> 
> Follows the updated one (for sure).

OK.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH,v3 testsuite] Fix some duplicate test names
  2020-05-26 20:52       ` Pedro Alves
@ 2020-05-27 12:39         ` Luis Machado
  0 siblings, 0 replies; 12+ messages in thread
From: Luis Machado @ 2020-05-27 12:39 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 5/26/20 5:52 PM, Pedro Alves wrote:
> On 5/26/20 9:23 PM, Luis Machado wrote:
>> On 5/26/20 4:35 PM, Pedro Alves wrote:
>>> On 5/26/20 8:02 PM, Luis Machado via Gdb-patches wrote:
>>>
>>>> @@ -45,10 +45,10 @@ proc break_at { breakpoint where } {
>>>>          set test "break $breakpoint"
>>>>        set bp 0
>>>> -    gdb_test_multiple "$test" "$test" {
>>>> +    gdb_test_multiple "$test" "$test inserted as number $bp" {
>>>
>>> As discussed, this change should be backed out, and replaced with
>>> with_test_prefix, right?  $bp is always zero here.
>>
>> Ugh... EWRONGPATCH, apologies. I must have mixed up the files when sending. This was already fixed.
>>
>> Follows the updated one (for sure).
> 
> OK.
> 
> Thanks,
> Pedro Alves
> 

Thanks for the review. I've pushed this now.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-05-27 12:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 14:18 [PATCH, testsuite] Fix some duplicate test names Luis Machado
2020-05-26 15:35 ` Pedro Alves
2020-05-26 17:08   ` Luis Machado
2020-05-26 17:39 ` [PATCH,v2 " Luis Machado
2020-05-26 17:50   ` Pedro Alves
2020-05-26 18:42     ` Luis Machado
2020-05-26 18:53       ` Pedro Alves
2020-05-26 19:02 ` [PATCH,v3 " Luis Machado
2020-05-26 19:35   ` Pedro Alves
2020-05-26 20:23     ` Luis Machado
2020-05-26 20:52       ` Pedro Alves
2020-05-27 12:39         ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).