public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: make test names unique in gdb.arch/*.exp
@ 2020-08-26 13:09 Andrew Burgess
  2020-08-26 15:39 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2020-08-26 13:09 UTC (permalink / raw)
  To: gdb-patches

Use with_test_prefix to make test names unique in gdb.arch/*.exp.

gdb/testsuite/ChangeLog:

	* gdb.arch/amd64-byte.exp: Make test names unique.
	* gdb.arch/amd64-dword.exp: Likewise.
	* gdb.arch/amd64-stap-special-operands.exp: Likewise.
	* gdb.arch/amd64-tailcall-ret.exp: Likewise.
	* gdb.arch/amd64-word.exp: Likewise.
	* gdb.arch/i386-byte.exp: Likewise.
	* gdb.arch/i386-word.exp: Likewise.
---
 gdb/testsuite/ChangeLog                       | 10 ++
 gdb/testsuite/gdb.arch/amd64-byte.exp         | 94 ++++++++++---------
 gdb/testsuite/gdb.arch/amd64-dword.exp        | 58 +++++++-----
 .../gdb.arch/amd64-stap-special-operands.exp  | 14 +--
 gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp |  4 +-
 gdb/testsuite/gdb.arch/amd64-word.exp         | 58 +++++++-----
 gdb/testsuite/gdb.arch/i386-byte.exp          | 48 +++++-----
 gdb/testsuite/gdb.arch/i386-word.exp          | 28 +++---
 8 files changed, 179 insertions(+), 135 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp
index 0b46d6f9f8b..6b6ef82ec8f 100644
--- a/gdb/testsuite/gdb.arch/amd64-byte.exp
+++ b/gdb/testsuite/gdb.arch/amd64-byte.exp
@@ -66,17 +66,19 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
          "set first breakpoint in main"
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print/x \$$byte_regs($r)" \
-        ".. = 0x[format %x $r]1" \
-        "check contents of %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-    set h [expr $r + 14]
-    gdb_test "print/x \$$byte_regs($h)" \
-        ".. = 0x[format %x $r]2" \
-        "check contents of %$byte_regs($h)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print/x \$$byte_regs($r)" \
+	    ".. = 0x[format %x $r]1" \
+	    "check contents of %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	set h [expr $r + 14]
+	gdb_test "print/x \$$byte_regs($h)" \
+	    ".. = 0x[format %x $r]2" \
+	    "check contents of %$byte_regs($h)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
@@ -84,19 +86,21 @@ gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
          "set second breakpoint in main"
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= 14  } { incr r } {
-    gdb_test "print/x \$$byte_regs($r)" \
-        ".. = 0x[format %x $r]1" \
-        "check contents of %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 6  } { incr r } {
-  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-  set h [expr $r + 14]
-  gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+with_test_prefix "at second bp" {
+    for { set r 7 } { $r <= 14  } { incr r } {
+	gdb_test "print/x \$$byte_regs($r)" \
+	    ".. = 0x[format %x $r]1" \
+	    "check contents of %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	set h [expr $r + 14]
+	gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
@@ -104,21 +108,23 @@ gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
          "set third breakpoint in main"
 gdb_continue_to_breakpoint "continue to third breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print \$$byte_regs($r)" \
-        ".. = $r" \
-        "check contents of %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-    set h [expr $r + 14]
-    gdb_test "print \$$byte_regs($h)" \
-        ".. = $h" \
-        "check contents of %$byte_regs($h)"
-}
-
-for { set r 7 } { $r <= 14  } { incr r } {
-  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+with_test_prefix "at third bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print \$$byte_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	set h [expr $r + 14]
+	gdb_test "print \$$byte_regs($h)" \
+	    ".. = $h" \
+	    "check contents of %$byte_regs($h)"
+    }
+
+    for { set r 7 } { $r <= 14  } { incr r } {
+	gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
@@ -126,8 +132,10 @@ gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
          "set forth breakpoint in main"
 gdb_continue_to_breakpoint "continue to forth breakpoint in main"
 
-for { set r 7 } { $r <= 14  } { incr r } {
-    gdb_test "print \$$byte_regs($r)" \
-        ".. = $r" \
-        "check contents of %$byte_regs($r)"
+with_test_prefix "at forth bp" {
+    for { set r 7 } { $r <= 14  } { incr r } {
+	gdb_test "print \$$byte_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$byte_regs($r)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp
index bce411db261..765a3e35c68 100644
--- a/gdb/testsuite/gdb.arch/amd64-dword.exp
+++ b/gdb/testsuite/gdb.arch/amd64-dword.exp
@@ -63,11 +63,13 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
          "set first breakpoint in main"
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$dword_regs($r)" \
-	".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
-        "check contents of %$dword_regs($r)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$dword_regs($r)" \
+	    ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
+	    "check contents of %$dword_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
@@ -75,15 +77,17 @@ gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
          "set second breakpoint in main"
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$dword_regs($r)" \
-	".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
-        "check contents of %$dword_regs($r)"
-}
-
-for { set r 1 } { $r <= 6  } { incr r } {
-  gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+with_test_prefix "at second bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$dword_regs($r)" \
+	    ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
+	    "check contents of %$dword_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
@@ -91,14 +95,16 @@ gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
          "set third breakpoint in main"
 gdb_continue_to_breakpoint "continue to third breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print \$$dword_regs($r)" \
-        ".. = $r" \
-        "check contents of %$dword_regs($r)"
-}
+with_test_prefix "at third bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print \$$dword_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$dword_regs($r)"
+    }
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-  gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
@@ -106,8 +112,10 @@ gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
          "set forth breakpoint in main"
 gdb_continue_to_breakpoint "continue to forth breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    gdb_test "print \$$dword_regs($r)" \
-        ".. = $r" \
-        "check contents of %$dword_regs($r)"
+with_test_prefix "at forth bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "print \$$dword_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$dword_regs($r)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
index 0dbcb4d6b9d..1e2ce1959f9 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
@@ -19,13 +19,15 @@ if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
 }
 
 proc test_probe { probe_name } {
-    if { ![runto "-pstap $probe_name"] } {
-	fail "run to probe $probe_name"
-	return
+    with_test_prefix "probe: ${probe_name}" {
+	if { ![runto "-pstap $probe_name"] } {
+	    fail "run to probe $probe_name"
+	    return
+	}
+
+	gdb_test "print \$_probe_argc" " = 1"
+	gdb_test "print \$_probe_arg0" " = 10"
     }
-
-    gdb_test "print \$_probe_argc" " = 1"
-    gdb_test "print \$_probe_arg0" " = 10"
 }
 
 standard_testfile amd64-stap-triplet.S
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
index 4dc5cd815f6..60c9a504176 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
@@ -34,11 +34,11 @@ if ![runto_main] {
 }
 
 gdb_breakpoint "g"
-gdb_continue_to_breakpoint "g" ".* v = 2;"
+gdb_continue_to_breakpoint "first time in g" ".* v = 2;"
 
 gdb_test "return" { f \(\); /\* second \*/} "return" \
          {Make g return now\? \(y or n\) } "y"
 
-gdb_continue_to_breakpoint "g" ".* v = 2;"
+gdb_continue_to_breakpoint "second time in g" ".* v = 2;"
 
 gdb_test "finish" " v = 3;"
diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp
index 4ede5482f13..3a1337b22ed 100644
--- a/gdb/testsuite/gdb.arch/amd64-word.exp
+++ b/gdb/testsuite/gdb.arch/amd64-word.exp
@@ -63,11 +63,13 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
          "set first breakpoint in main"
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$word_regs($r)" \
-        ".. = 0x${hexr}2${hexr}1" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$word_regs($r)" \
+	    ".. = 0x${hexr}2${hexr}1" \
+	    "check contents of %$word_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
@@ -75,15 +77,17 @@ gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
          "set second breakpoint in main"
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$word_regs($r)" \
-        ".. = 0x${hexr}2${hexr}1" \
-        "check contents of %$word_regs($r)"
-}
-
-for { set r 1 } { $r <= 6  } { incr r } {
-  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+with_test_prefix "at second bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$word_regs($r)" \
+	    ".. = 0x${hexr}2${hexr}1" \
+	    "check contents of %$word_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
@@ -91,14 +95,16 @@ gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
          "set third breakpoint in main"
 gdb_continue_to_breakpoint "continue to third breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print \$$word_regs($r)" \
-        ".. = $r" \
-        "check contents of %$word_regs($r)"
-}
+with_test_prefix "at third bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print \$$word_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$word_regs($r)"
+    }
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
@@ -106,8 +112,10 @@ gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
          "set forth breakpoint in main"
 gdb_continue_to_breakpoint "continue to forth breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    gdb_test "print \$$word_regs($r)" \
-        ".. = $r" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at forth bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "print \$$word_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$word_regs($r)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
index aa5b8d7bea0..a5a49e01db5 100644
--- a/gdb/testsuite/gdb.arch/i386-byte.exp
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -56,20 +56,22 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
          "set first breakpoint in main"
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print/x \$$byte_regs($r)" \
-        ".. = 0x[format %x $r]1" \
-        "check contents of %$byte_regs($r)"
-    set h [expr $r + 4]
-    gdb_test "print/x \$$byte_regs($h)" \
-        ".. = 0x[format %x $r]2" \
-        "check contents of %$byte_regs($h)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
-  set h [expr $r + 4]
-  gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print/x \$$byte_regs($r)" \
+	    ".. = 0x[format %x $r]1" \
+	    "check contents of %$byte_regs($r)"
+	set h [expr $r + 4]
+	gdb_test "print/x \$$byte_regs($h)" \
+	    ".. = 0x[format %x $r]2" \
+	    "check contents of %$byte_regs($h)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+	set h [expr $r + 4]
+	gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
@@ -77,12 +79,14 @@ gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
          "set second breakpoint in main"
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print \$$byte_regs($r)" \
-        ".. = $r" \
-        "check contents of %$byte_regs($r)"
-    set h [expr $r + 4]
-    gdb_test "print \$$byte_regs($h)" \
-        ".. = $h" \
-        "check contents of %$byte_regs($h)"
+with_test_prefix "at second bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print \$$byte_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$byte_regs($r)"
+	set h [expr $r + 4]
+	gdb_test "print \$$byte_regs($h)" \
+	    ".. = $h" \
+	    "check contents of %$byte_regs($h)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp
index 336ea27a1f6..d3972d65a66 100644
--- a/gdb/testsuite/gdb.arch/i386-word.exp
+++ b/gdb/testsuite/gdb.arch/i386-word.exp
@@ -52,14 +52,16 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
          "set first breakpoint in main"
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print/x \$$word_regs($r)" \
-        ".. = 0x[format %x $r]2[format %x $r]1" \
-        "check contents of %$word_regs($r)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print/x \$$word_regs($r)" \
+	    ".. = 0x[format %x $r]2[format %x $r]1" \
+	    "check contents of %$word_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    }
 }
 
 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
@@ -67,8 +69,10 @@ gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
          "set second breakpoint in main"
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print \$$word_regs($r)" \
-        ".. = $r" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at second bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print \$$word_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$word_regs($r)"
+    }
 }
-- 
2.25.4


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

* Re: [PATCH] gdb/testsuite: make test names unique in gdb.arch/*.exp
  2020-08-26 13:09 [PATCH] gdb/testsuite: make test names unique in gdb.arch/*.exp Andrew Burgess
@ 2020-08-26 15:39 ` Tom Tromey
  2020-08-27 16:34   ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2020-08-26 15:39 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> Use with_test_prefix to make test names unique in gdb.arch/*.exp.
Andrew> gdb/testsuite/ChangeLog:

Looks good.  I found one nit, though it's questionable whether you want
to change it.

Andrew>  gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \

This is pre-existing code, but "forth" is misspelled, should be
"fourth".

Andrew> +with_test_prefix "at forth bp" {

The patch is consistent with the existing code.  Normally I'd say fix
the typo, but given that there is existing code using it, maybe not.

Thanks for doing this.

Tom

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

* Re: [PATCH] gdb/testsuite: make test names unique in gdb.arch/*.exp
  2020-08-26 15:39 ` Tom Tromey
@ 2020-08-27 16:34   ` Andrew Burgess
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2020-08-27 16:34 UTC (permalink / raw)
  To: gdb-patches

* Tom Tromey <tom@tromey.com> [2020-08-26 09:39:36 -0600]:

> >>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
> 
> Andrew> Use with_test_prefix to make test names unique in gdb.arch/*.exp.
> Andrew> gdb/testsuite/ChangeLog:
> 
> Looks good.  I found one nit, though it's questionable whether you want
> to change it.
> 
> Andrew>  gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
> 
> This is pre-existing code, but "forth" is misspelled, should be
> "fourth".
> 
> Andrew> +with_test_prefix "at forth bp" {
> 
> The patch is consistent with the existing code.  Normally I'd say fix
> the typo, but given that there is existing code using it, maybe not.

I fixed the typo.

Below is the patch I actually pushed.

Thanks,
Andrew

---

commit c2015ce4a4019ab9b026f13c33a7f55e8e0d77a0
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Wed Aug 26 14:05:45 2020 +0100

    gdb/testsuite: make test names unique in gdb.arch/*.exp
    
    Make the test names unique in gdb.arch/*.exp by either modifying the
    test names or using with_test_prefix.
    
    I have also fixed a typo 'forth' -> 'fourth' throughout gdb.arch/*.
    
    Finally, I replaced code like this:
    
      gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
               "Breakpoint .* at .*${srcfile}.*" \
               "set first breakpoint in main"
    
    With this:
    
      gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
    
    In those files that I was already modifying for the other reasons
    given above.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.arch/amd64-byte.exp: Make test names unique, use
            gdb_breakpoint, and fix typo 'forth' -> 'fourth'.
            * gdb.arch/amd64-dword.exp: Likewise.
            * gdb.arch/amd64-pseudo.c: Fix typo 'forth' -> 'fourth'.
            * gdb.arch/amd64-stap-special-operands.exp: Make test names
            unique.
            * gdb.arch/amd64-tailcall-ret.exp: Likewise.
            * gdb.arch/amd64-word.exp: Make test names unique, use
            gdb_breakpoint, and fix typo 'forth' -> 'fourth'.
            * gdb.arch/i386-byte.exp: Make test names unique, use
            gdb_breakpoint.
            * gdb.arch/i386-word.exp: Likewise.

diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp
index 0b46d6f9f8b..19cf5ff1a89 100644
--- a/gdb/testsuite/gdb.arch/amd64-byte.exp
+++ b/gdb/testsuite/gdb.arch/amd64-byte.exp
@@ -61,73 +61,73 @@ set byte_regs(16) bh
 set byte_regs(17) ch
 set byte_regs(18) dh
 
-gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set first breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print/x \$$byte_regs($r)" \
-        ".. = 0x[format %x $r]1" \
-        "check contents of %$byte_regs($r)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print/x \$$byte_regs($r)" \
+	    ".. = 0x[format %x $r]1" \
+	    "check contents of %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	set h [expr $r + 14]
+	gdb_test "print/x \$$byte_regs($h)" \
+	    ".. = 0x[format %x $r]2" \
+	    "check contents of %$byte_regs($h)"
+    }
 }
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    set h [expr $r + 14]
-    gdb_test "print/x \$$byte_regs($h)" \
-        ".. = 0x[format %x $r]2" \
-        "check contents of %$byte_regs($h)"
-}
-
-gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set second breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "second breakpoint here"]
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= 14  } { incr r } {
-    gdb_test "print/x \$$byte_regs($r)" \
-        ".. = 0x[format %x $r]1" \
-        "check contents of %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 6  } { incr r } {
-  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-  set h [expr $r + 14]
-  gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+with_test_prefix "at second bp" {
+    for { set r 7 } { $r <= 14  } { incr r } {
+	gdb_test "print/x \$$byte_regs($r)" \
+	    ".. = 0x[format %x $r]1" \
+	    "check contents of %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	set h [expr $r + 14]
+	gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set third breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "third breakpoint here"]
 gdb_continue_to_breakpoint "continue to third breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print \$$byte_regs($r)" \
-        ".. = $r" \
-        "check contents of %$byte_regs($r)"
-}
-
-for { set r 1 } { $r <= 4  } { incr r } {
-    set h [expr $r + 14]
-    gdb_test "print \$$byte_regs($h)" \
-        ".. = $h" \
-        "check contents of %$byte_regs($h)"
-}
-
-for { set r 7 } { $r <= 14  } { incr r } {
-  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+with_test_prefix "at third bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print \$$byte_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$byte_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	set h [expr $r + 14]
+	gdb_test "print \$$byte_regs($h)" \
+	    ".. = $h" \
+	    "check contents of %$byte_regs($h)"
+    }
+
+    for { set r 7 } { $r <= 14  } { incr r } {
+	gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set forth breakpoint in main"
-gdb_continue_to_breakpoint "continue to forth breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "fourth breakpoint here"]
+gdb_continue_to_breakpoint "continue to fourth breakpoint in main"
 
-for { set r 7 } { $r <= 14  } { incr r } {
-    gdb_test "print \$$byte_regs($r)" \
-        ".. = $r" \
-        "check contents of %$byte_regs($r)"
+with_test_prefix "at fourth bp" {
+    for { set r 7 } { $r <= 14  } { incr r } {
+	gdb_test "print \$$byte_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$byte_regs($r)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp
index bce411db261..f2841aafafa 100644
--- a/gdb/testsuite/gdb.arch/amd64-dword.exp
+++ b/gdb/testsuite/gdb.arch/amd64-dword.exp
@@ -58,56 +58,56 @@ set dword_regs(12) r13d
 set dword_regs(13) r14d
 set dword_regs(14) r15d
 
-gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set first breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$dword_regs($r)" \
-	".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
-        "check contents of %$dword_regs($r)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$dword_regs($r)" \
+	    ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
+	    "check contents of %$dword_regs($r)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set second breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "second breakpoint here"]
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$dword_regs($r)" \
-	".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
-        "check contents of %$dword_regs($r)"
+with_test_prefix "at second bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$dword_regs($r)" \
+	    ".. = 0x${hexr}4${hexr}3${hexr}2${hexr}1" \
+	    "check contents of %$dword_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+    }
 }
 
-for { set r 1 } { $r <= 6  } { incr r } {
-  gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
-}
-
-gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set third breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "third breakpoint here"]
 gdb_continue_to_breakpoint "continue to third breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print \$$dword_regs($r)" \
-        ".. = $r" \
-        "check contents of %$dword_regs($r)"
-}
+with_test_prefix "at third bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print \$$dword_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$dword_regs($r)"
+    }
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-  gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set forth breakpoint in main"
-gdb_continue_to_breakpoint "continue to forth breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "fourth breakpoint here"]
+gdb_continue_to_breakpoint "continue to fourth breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    gdb_test "print \$$dword_regs($r)" \
-        ".. = $r" \
-        "check contents of %$dword_regs($r)"
+with_test_prefix "at fourth bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "print \$$dword_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$dword_regs($r)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo.c b/gdb/testsuite/gdb.arch/amd64-pseudo.c
index 4c3d3cc5b1b..50bb15eaa30 100644
--- a/gdb/testsuite/gdb.arch/amd64-pseudo.c
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo.c
@@ -118,7 +118,7 @@ main (int argc, char **argv)
 	    a temp to build %0.  */
 	 "r" (r8), "r" (r9), "r" (r10), "r" (r11),
 	 "r" (r12), "r" (r13), "r" (r14), "r" (r15));
-  puts ("Bye!"); /* forth breakpoint here */
+  puts ("Bye!"); /* fourth breakpoint here */
 
   return 0;
 }
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
index 0dbcb4d6b9d..1e2ce1959f9 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
@@ -19,13 +19,15 @@ if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
 }
 
 proc test_probe { probe_name } {
-    if { ![runto "-pstap $probe_name"] } {
-	fail "run to probe $probe_name"
-	return
+    with_test_prefix "probe: ${probe_name}" {
+	if { ![runto "-pstap $probe_name"] } {
+	    fail "run to probe $probe_name"
+	    return
+	}
+
+	gdb_test "print \$_probe_argc" " = 1"
+	gdb_test "print \$_probe_arg0" " = 10"
     }
-
-    gdb_test "print \$_probe_argc" " = 1"
-    gdb_test "print \$_probe_arg0" " = 10"
 }
 
 standard_testfile amd64-stap-triplet.S
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
index 4dc5cd815f6..60c9a504176 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
@@ -34,11 +34,11 @@ if ![runto_main] {
 }
 
 gdb_breakpoint "g"
-gdb_continue_to_breakpoint "g" ".* v = 2;"
+gdb_continue_to_breakpoint "first time in g" ".* v = 2;"
 
 gdb_test "return" { f \(\); /\* second \*/} "return" \
          {Make g return now\? \(y or n\) } "y"
 
-gdb_continue_to_breakpoint "g" ".* v = 2;"
+gdb_continue_to_breakpoint "second time in g" ".* v = 2;"
 
 gdb_test "finish" " v = 3;"
diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp
index 4ede5482f13..9f5e5d7e9cc 100644
--- a/gdb/testsuite/gdb.arch/amd64-word.exp
+++ b/gdb/testsuite/gdb.arch/amd64-word.exp
@@ -58,56 +58,56 @@ set word_regs(12) r13w
 set word_regs(13) r14w
 set word_regs(14) r15w
 
-gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set first breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$word_regs($r)" \
-        ".. = 0x${hexr}2${hexr}1" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$word_regs($r)" \
+	    ".. = 0x${hexr}2${hexr}1" \
+	    "check contents of %$word_regs($r)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set second breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "second breakpoint here"]
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    set hexr [format %x $r]
-    gdb_test "print/x \$$word_regs($r)" \
-        ".. = 0x${hexr}2${hexr}1" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at second bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	set hexr [format %x $r]
+	gdb_test "print/x \$$word_regs($r)" \
+	    ".. = 0x${hexr}2${hexr}1" \
+	    "check contents of %$word_regs($r)"
+    }
+
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    }
 }
 
-for { set r 1 } { $r <= 6  } { incr r } {
-  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
-}
-
-gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set third breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "third breakpoint here"]
 gdb_continue_to_breakpoint "continue to third breakpoint in main"
 
-for { set r 1 } { $r <= 6  } { incr r } {
-    gdb_test "print \$$word_regs($r)" \
-        ".. = $r" \
-        "check contents of %$word_regs($r)"
-}
+with_test_prefix "at third bp" {
+    for { set r 1 } { $r <= 6  } { incr r } {
+	gdb_test "print \$$word_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$word_regs($r)"
+    }
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set forth breakpoint in main"
-gdb_continue_to_breakpoint "continue to forth breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "fourth breakpoint here"]
+gdb_continue_to_breakpoint "continue to fourth breakpoint in main"
 
-for { set r 7 } { $r <= $nr_regs  } { incr r } {
-    gdb_test "print \$$word_regs($r)" \
-        ".. = $r" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at fourth bp" {
+    for { set r 7 } { $r <= $nr_regs  } { incr r } {
+	gdb_test "print \$$word_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$word_regs($r)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
index aa5b8d7bea0..8903346158f 100644
--- a/gdb/testsuite/gdb.arch/i386-byte.exp
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -51,38 +51,38 @@ set byte_regs(6) bh
 set byte_regs(7) ch
 set byte_regs(8) dh
 
-gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set first breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print/x \$$byte_regs($r)" \
-        ".. = 0x[format %x $r]1" \
-        "check contents of %$byte_regs($r)"
-    set h [expr $r + 4]
-    gdb_test "print/x \$$byte_regs($h)" \
-        ".. = 0x[format %x $r]2" \
-        "check contents of %$byte_regs($h)"
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print/x \$$byte_regs($r)" \
+	    ".. = 0x[format %x $r]1" \
+	    "check contents of %$byte_regs($r)"
+	set h [expr $r + 4]
+	gdb_test "print/x \$$byte_regs($h)" \
+	    ".. = 0x[format %x $r]2" \
+	    "check contents of %$byte_regs($h)"
+    }
+
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
+	set h [expr $r + 4]
+	gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+    }
 }
 
-for { set r 1 } { $r <= 4  } { incr r } {
-  gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
-  set h [expr $r + 4]
-  gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
-}
-
-gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set second breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "second breakpoint here"]
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print \$$byte_regs($r)" \
-        ".. = $r" \
-        "check contents of %$byte_regs($r)"
-    set h [expr $r + 4]
-    gdb_test "print \$$byte_regs($h)" \
-        ".. = $h" \
-        "check contents of %$byte_regs($h)"
+with_test_prefix "at second bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print \$$byte_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$byte_regs($r)"
+	set h [expr $r + 4]
+	gdb_test "print \$$byte_regs($h)" \
+	    ".. = $h" \
+	    "check contents of %$byte_regs($h)"
+    }
 }
diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp
index 336ea27a1f6..55c2ea62af0 100644
--- a/gdb/testsuite/gdb.arch/i386-word.exp
+++ b/gdb/testsuite/gdb.arch/i386-word.exp
@@ -47,28 +47,28 @@ set word_regs(2) bx
 set word_regs(3) cx
 set word_regs(4) dx
 
-gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set first breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "first breakpoint here"]
 gdb_continue_to_breakpoint "continue to first breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print/x \$$word_regs($r)" \
-        ".. = 0x[format %x $r]2[format %x $r]1" \
-        "check contents of %$word_regs($r)"
-}
+with_test_prefix "at first bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print/x \$$word_regs($r)" \
+	    ".. = 0x[format %x $r]2[format %x $r]1" \
+	    "check contents of %$word_regs($r)"
+    }
 
-for { set r 1 } { $r <= 4  } { incr r } {
-  gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)"
+    }
 }
 
-gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
-         "Breakpoint .* at .*${srcfile}.*" \
-         "set second breakpoint in main"
+gdb_breakpoint [gdb_get_line_number "second breakpoint here"]
 gdb_continue_to_breakpoint "continue to second breakpoint in main"
 
-for { set r 1 } { $r <= 4  } { incr r } {
-    gdb_test "print \$$word_regs($r)" \
-        ".. = $r" \
-        "check contents of %$word_regs($r)"
+with_test_prefix "at second bp" {
+    for { set r 1 } { $r <= 4  } { incr r } {
+	gdb_test "print \$$word_regs($r)" \
+	    ".. = $r" \
+	    "check contents of %$word_regs($r)"
+    }
 }

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

end of thread, other threads:[~2020-08-27 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 13:09 [PATCH] gdb/testsuite: make test names unique in gdb.arch/*.exp Andrew Burgess
2020-08-26 15:39 ` Tom Tromey
2020-08-27 16:34   ` Andrew Burgess

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).