[committed,gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2)

Message ID 20191031220446.GA30046@delia
State New, archived
Headers

Commit Message

Tom de Vries Oct. 31, 2019, 10:04 p.m. UTC
  Hi,

There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
        set message [lindex $args 2]
+       if { $message == [lindex $args 0] && [llength $args] == 3 } {
+           error "HERE"
+       }
     } else {
         set message [lindex $args 0]
     }
...
and fix all occurrences in some gdb testsuite subdirs.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2)

gdb/testsuite/ChangeLog:

2019-10-31  Tom de Vries  <tdevries@suse.de>

	* gdb.arch/amd64-disp-step-avx.exp: Drop superfluous 3rd argument to
	gdb_test.
	* gdb.arch/amd64-disp-step.exp: Same.
	* gdb.asm/asm-source.exp: Same.
	* gdb.btrace/buffer-size.exp: Same.
	* gdb.btrace/cpu.exp: Same.
	* gdb.btrace/enable.exp: Same.
	* gdb.dwarf2/count.exp: Same.
	* gdb.dwarf2/dw2-ranges-func.exp: Same.
	* gdb.dwarf2/dw2-ranges-psym.exp: Same.
	* gdb.fortran/vla-datatypes.exp: Same.
	* gdb.fortran/vla-history.exp: Same.
	* gdb.fortran/vla-ptype.exp: Same.
	* gdb.fortran/vla-value.exp: Same.
	* gdb.fortran/whatis_type.exp: Same.
	* gdb.guile/guile.exp: Same.
	* gdb.multi/tids.exp: Same.
	* gdb.python/py-finish-breakpoint.exp: Same.
	* gdb.python/py-framefilter.exp: Same.
	* gdb.python/py-pp-registration.exp: Same.
	* gdb.python/py-xmethods.exp: Same.
	* gdb.python/python.exp: Same.
	* gdb.server/connect-with-no-symbol-file.exp: Same.
	* gdb.server/no-thread-db.exp: Same.
	* gdb.server/run-without-local-binary.exp: Same.
	* gdb.stabs/weird.exp: Same.
	* gdb.threads/attach-many-short-lived-threads.exp: Same.
	* gdb.threads/thread-find.exp: Same.
	* gdb.threads/tls-shared.exp: Same.
	* gdb.threads/tls.exp: Same.
	* gdb.threads/wp-replication.exp: Same.
	* gdb.trace/ax.exp: Same.
	* lib/gdb.exp (gdb_test_exact, help_test_raw): Same.

Change-Id: I2fa544c68f8c0099a77e03ff04ddc010eb2b6c7c

---
 gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp     |  6 +-
 gdb/testsuite/gdb.arch/amd64-disp-step.exp         | 42 ++++------
 gdb/testsuite/gdb.asm/asm-source.exp               |  3 +-
 gdb/testsuite/gdb.btrace/buffer-size.exp           |  2 +-
 gdb/testsuite/gdb.btrace/cpu.exp                   |  6 +-
 gdb/testsuite/gdb.btrace/enable.exp                |  2 +-
 gdb/testsuite/gdb.dwarf2/count.exp                 | 28 +++----
 gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp       |  6 +-
 gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp       |  3 +-
 gdb/testsuite/gdb.fortran/vla-datatypes.exp        | 15 ++--
 gdb/testsuite/gdb.fortran/vla-history.exp          | 10 +--
 gdb/testsuite/gdb.fortran/vla-ptype.exp            |  6 +-
 gdb/testsuite/gdb.fortran/vla-value.exp            |  4 +-
 gdb/testsuite/gdb.fortran/whatis_type.exp          |  6 +-
 gdb/testsuite/gdb.guile/guile.exp                  |  2 +-
 gdb/testsuite/gdb.multi/tids.exp                   | 18 +++--
 gdb/testsuite/gdb.python/py-finish-breakpoint.exp  |  2 +-
 gdb/testsuite/gdb.python/py-framefilter.exp        |  6 +-
 gdb/testsuite/gdb.python/py-pp-registration.exp    |  6 +-
 gdb/testsuite/gdb.python/py-xmethods.exp           |  3 +-
 gdb/testsuite/gdb.python/python.exp                |  2 +-
 .../gdb.server/connect-with-no-symbol-file.exp     |  2 +-
 gdb/testsuite/gdb.server/no-thread-db.exp          |  3 +-
 .../gdb.server/run-without-local-binary.exp        |  2 +-
 gdb/testsuite/gdb.stabs/weird.exp                  |  8 +-
 .../attach-many-short-lived-threads.exp            |  2 +-
 gdb/testsuite/gdb.threads/thread-find.exp          |  6 +-
 gdb/testsuite/gdb.threads/tls-shared.exp           |  4 +-
 gdb/testsuite/gdb.threads/tls.exp                  |  5 +-
 gdb/testsuite/gdb.threads/wp-replication.exp       |  3 +-
 gdb/testsuite/gdb.trace/ax.exp                     | 94 +++++++++++-----------
 gdb/testsuite/lib/gdb.exp                          | 17 ++--
 32 files changed, 141 insertions(+), 183 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
index 27e4bc06044..f652fd834e6 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
@@ -78,11 +78,9 @@  proc disp_step_func { func } {
     set test_end_label "${func}_end"
 
     gdb_test "break ${test_start_label}" \
-	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break ${test_start_label}"
+	"Breakpoint.*at.* file .*$srcfile, line.*"
     gdb_test "break ${test_end_label}" \
-	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break ${test_end_label}"
+	"Breakpoint.*at.* file .*$srcfile, line.*"
 
     gdb_test "continue" \
 	"Continuing.*Breakpoint.*, ${test_start_label} ().*" \
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
index 75e8bf6d6de..6f493923b0d 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
@@ -45,18 +45,14 @@  if ![runto_main] then {
 # Test call/ret.
 
 gdb_test "break test_call" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_call"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 gdb_test "break test_call_end" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_call_end"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 
 gdb_test "break test_ret" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_ret"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 gdb_test "break test_ret_end" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_ret_end"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 
 gdb_test "continue" \
     "Continuing.*Breakpoint.*, test_call ().*" \
@@ -77,18 +73,14 @@  gdb_test "continue" \
 # Test abs-jmp/rep-ret.
 
 gdb_test "break test_abs_jmp" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_abs_jmp"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 gdb_test "break test_abs_jmp_end" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_abs_jmp_end"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 
 gdb_test "break test_rep_ret" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_rep_ret"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 gdb_test "break test_rep_ret_end" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_rep_ret_end"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 
 gdb_test "continue" \
     "Continuing.*Breakpoint.*, test_abs_jmp ().*" \
@@ -109,11 +101,9 @@  gdb_test "continue" \
 # Test syscall.
 
 gdb_test "break test_syscall" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_syscall"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 gdb_test "break test_syscall_end" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_syscall_end"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 
 gdb_test "continue" \
     "Continuing.*Breakpoint.*, test_syscall ().*" \
@@ -128,11 +118,9 @@  gdb_test "continue" \
 # These don't occur in normal code, but gdb should still DTRT.
 
 gdb_test "break test_int3" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_int3"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 gdb_test "break test_int3_end" \
-    "Breakpoint.*at.* file .*$srcfile, line.*" \
-    "break test_int3_end"
+    "Breakpoint.*at.* file .*$srcfile, line.*"
 
 gdb_test "continue" \
     "Continuing.*Breakpoint.*, test_int3 ().*" \
@@ -192,11 +180,9 @@  proc rip_test { reg } {
     set test_end_label "test_rip_${reg}_end"
 
     gdb_test "break ${test_start_label}" \
-	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break ${test_start_label}"
+	"Breakpoint.*at.* file .*$srcfile, line.*"
     gdb_test "break ${test_end_label}" \
-	"Breakpoint.*at.* file .*$srcfile, line.*" \
-	"break ${test_end_label}"
+	"Breakpoint.*at.* file .*$srcfile, line.*"
 
     gdb_test "continue" \
 	"Continuing.*Breakpoint.*, ${test_start_label} ().*" \
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index b10ee1702fc..5904cb18bcb 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -421,8 +421,7 @@  gdb_test_multiple "info sources" "info sources" {
 
 # Try 'info line'
 gdb_test "info line" \
-	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<\\.?foo2+.*> and ends at.*<\\.?foo2+.*>." \
-	"info line"
+	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<\\.?foo2+.*> and ends at.*<\\.?foo2+.*>."
 
 # Try 'nexting' over next call to foo3
 gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3"
diff --git a/gdb/testsuite/gdb.btrace/buffer-size.exp b/gdb/testsuite/gdb.btrace/buffer-size.exp
index b46e0775d22..a52458b1325 100644
--- a/gdb/testsuite/gdb.btrace/buffer-size.exp
+++ b/gdb/testsuite/gdb.btrace/buffer-size.exp
@@ -43,4 +43,4 @@  gdb_test "info record" [multi_line \
   "Recording format: \[^\\\r\\\n\]*" \
   "Buffer size: 4kB\." \
   "Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \
-  ] "info record"
+  ]
diff --git a/gdb/testsuite/gdb.btrace/cpu.exp b/gdb/testsuite/gdb.btrace/cpu.exp
index 28f8c687701..93ed0c62303 100644
--- a/gdb/testsuite/gdb.btrace/cpu.exp
+++ b/gdb/testsuite/gdb.btrace/cpu.exp
@@ -42,11 +42,9 @@  proc test_junk { arg junk current } {
 gdb_test "show record btrace cpu" "btrace cpu is 'auto'\." "default cpu"
 
 gdb_test "set record" \
-    "\"set record\" must be followed by an appropriate subcommand.*" \
-    "set record"
+    "\"set record\" must be followed by an appropriate subcommand.*"
 gdb_test "set record btrace" \
-    "\"set record btrace\" must be followed by an appropriate subcommand.*" \
-    "set record btrace"
+    "\"set record btrace\" must be followed by an appropriate subcommand.*"
 test_bad "" "auto"
 
 test_good "intel: 0/0"
diff --git a/gdb/testsuite/gdb.btrace/enable.exp b/gdb/testsuite/gdb.btrace/enable.exp
index 4bc034cb3b2..6b74d1d6bf2 100644
--- a/gdb/testsuite/gdb.btrace/enable.exp
+++ b/gdb/testsuite/gdb.btrace/enable.exp
@@ -64,7 +64,7 @@  gdb_test "info record" "Active record target: record-btrace\r
 Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for thread 1.*\\." "info record without trace"
 
 # stop btrace record
-gdb_test "record stop" "Process record is stopped and all execution logs are deleted\\." "record stop"
+gdb_test "record stop" "Process record is stopped and all execution logs are deleted\\."
 gdb_test "record stop" "No record target is currently active\\..*" "record stop the second time"
 
 # enable btrace again
diff --git a/gdb/testsuite/gdb.dwarf2/count.exp b/gdb/testsuite/gdb.dwarf2/count.exp
index d2bde31e7d9..5c8f0f10846 100644
--- a/gdb/testsuite/gdb.dwarf2/count.exp
+++ b/gdb/testsuite/gdb.dwarf2/count.exp
@@ -109,17 +109,17 @@  if ![runto_main] {
     return -1
 }
 
-gdb_test "ptype array" "type = char \\\[5\\\]" "ptype array"
-gdb_test "whatis array" "type = char \\\[5\\\]" "whatis array"
-gdb_test "print array" " = \"hello\"" "print array"
-gdb_test "print sizeof array" " = 5" "print sizeof array"
-
-gdb_test "ptype array2" "type = char \\\[1\\\]" "ptype array"
-gdb_test "whatis array2" "type = char \\\[1\\\]" "whatis array"
-gdb_test "print array2" " = \"A\"" "print array"
-gdb_test "print sizeof array2" " = 1" "print sizeof array"
-
-gdb_test "ptype static_array" "type = char \\\[5\\\]" "ptype static_array"
-gdb_test "whatis static_array" "type = char \\\[5\\\]" "whatis static_array"
-gdb_test "print static_array" " = \"world\"" "print static_array"
-gdb_test "print sizeof static_array" " = 5" "print sizeof static_array"
+gdb_test "ptype array" "type = char \\\[5\\\]"
+gdb_test "whatis array" "type = char \\\[5\\\]"
+gdb_test "print array" " = \"hello\""
+gdb_test "print sizeof array" " = 5"
+
+gdb_test "ptype array2" "type = char \\\[1\\\]"
+gdb_test "whatis array2" "type = char \\\[1\\\]"
+gdb_test "print array2" " = \"A\""
+gdb_test "print sizeof array2" " = 1"
+
+gdb_test "ptype static_array" "type = char \\\[5\\\]"
+gdb_test "whatis static_array" "type = char \\\[5\\\]"
+gdb_test "print static_array" " = \"world\""
+gdb_test "print sizeof static_array" " = 5"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
index bd0564f1886..214dcdf379f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
@@ -257,8 +257,7 @@  proc do_test {suffix} {
 	# This is intentional since that behavior is one of the bugs that
 	# this test case tests for.
 	gdb_test "break foo" \
-	    "Breakpoint.*at.* file .*$srcfile, line \\d+\\." \
-	    "break foo"
+	    "Breakpoint.*at.* file .*$srcfile, line \\d+\\."
 
 	# Continue to foo.  Allow execution to stop either on the prologue
 	# or on the call to bar since either behavior is acceptable though
@@ -323,8 +322,7 @@  proc do_test {suffix} {
     # This more permissive RE for "break foo" will allow a breakpoint on
     # multiple locations to PASS.  */
     gdb_test "break foo" \
-	"Breakpoint.*at.*" \
-	"break foo"
+	"Breakpoint.*at.*"
 
     gdb_test "break baz" \
 	"Breakpoint.*at.* file .*$srcfile, line \\d+\\."
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
index 0e9acbfad52..333577eb5e7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
@@ -134,5 +134,4 @@  if ![runto_main] {
 # Note we use a name that is very different from the linkage name, in
 # order to not set the breakpoint via minsyms.
 gdb_test "break someothername" \
-    "Breakpoint.*at.*" \
-    "break someothername"
+    "Breakpoint.*at.*"
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
index bb5ed276c22..c8025c7698f 100644
--- a/gdb/testsuite/gdb.fortran/vla-datatypes.exp
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
@@ -55,16 +55,11 @@  gdb_test "print l" " = \\.TRUE\\." "charactervla allocated"
 
 gdb_breakpoint [gdb_get_line_number "vlas-initialized"]
 gdb_continue_to_breakpoint "vlas-initialized"
-gdb_test "ptype intvla" "type = $int, allocatable \\\(11,22,33\\\)" \
-  "ptype intvla"
-gdb_test "ptype realvla" "type = $real, allocatable \\\(11,22,33\\\)" \
-  "ptype realvla"
-gdb_test "ptype complexvla" "type = $complex, allocatable \\\(11,22,33\\\)" \
-  "ptype complexvla"
-gdb_test "ptype logicalvla" "type = $logical, allocatable \\\(11,22,33\\\)" \
-  "ptype logicalvla"
-gdb_test "ptype charactervla" "type = character\\\*1, allocatable \\\(11,22,33\\\)" \
-  "ptype charactervla"
+gdb_test "ptype intvla" "type = $int, allocatable \\\(11,22,33\\\)"
+gdb_test "ptype realvla" "type = $real, allocatable \\\(11,22,33\\\)"
+gdb_test "ptype complexvla" "type = $complex, allocatable \\\(11,22,33\\\)"
+gdb_test "ptype logicalvla" "type = $logical, allocatable \\\(11,22,33\\\)"
+gdb_test "ptype charactervla" "type = character\\\*1, allocatable \\\(11,22,33\\\)"
 
 gdb_test "print intvla(5,5,5)" " = 1" "print intvla(5,5,5) (1st)"
 gdb_test "print realvla(5,5,5)" " = 3.14\\d+" \
diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp
index 8737beb4218..b7ce366e797 100644
--- a/gdb/testsuite/gdb.fortran/vla-history.exp
+++ b/gdb/testsuite/gdb.fortran/vla-history.exp
@@ -39,7 +39,7 @@  with_timeout_factor 2 {
 }
 
 # Try to access history values for full vla prints.
-gdb_test "print \$1" " = <not allocated>" "print \$1"
+gdb_test "print \$1" " = <not allocated>"
 with_timeout_factor 2 {
     gdb_test "print \$2" \
       " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" "print \$4"
@@ -47,9 +47,9 @@  with_timeout_factor 2 {
 
 gdb_breakpoint [gdb_get_line_number "vla2-filled"]
 gdb_continue_to_breakpoint "vla2-filled"
-gdb_test "print vla2(1,43,20)" " = 1311" "print vla2(1,43,20)"
-gdb_test "print vla1(1,3,8)" " = 1001" "print vla2(1,3,8)"
+gdb_test "print vla2(1,43,20)" " = 1311"
+gdb_test "print vla1(1,3,8)" " = 1001"
 
 # Try to access history values for vla values.
-gdb_test "print \$5" " = 1311" "print \$5"
-gdb_test "print \$6" " = 1001" "print \$6"
+gdb_test "print \$5" " = 1311"
+gdb_test "print \$6" " = 1001"
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
index 7f8268bd335..918ed072b9e 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -55,8 +55,7 @@  gdb_breakpoint [gdb_get_line_number "vla1-filled"]
 gdb_continue_to_breakpoint "vla1-filled"
 gdb_test "ptype vla1" "type = $real, allocatable \\\(10,10,10\\\)" \
   "ptype vla1 filled"
-gdb_test "ptype vla1(3, 6, 9)" "type = $real" \
-  "ptype vla1(3, 6, 9)"
+gdb_test "ptype vla1(3, 6, 9)" "type = $real"
 
 gdb_breakpoint [gdb_get_line_number "vla2-filled"]
 gdb_continue_to_breakpoint "vla2-filled"
@@ -69,8 +68,7 @@  gdb_breakpoint [gdb_get_line_number "pvla-associated"]
 gdb_continue_to_breakpoint "pvla-associated"
 gdb_test "ptype pvla" "type = $real \\\(10,10,10\\\)" \
   "ptype pvla associated"
-gdb_test "ptype pvla(3, 6, 9)" "type = $real" \
-  "ptype pvla(3, 6, 9)"
+gdb_test "ptype pvla(3, 6, 9)" "type = $real"
 
 gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
 gdb_continue_to_breakpoint "pvla-re-associated"
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
index ed0cace9f48..5b6ad5df72c 100644
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -148,12 +148,12 @@  gdb_test "print \$myvar" \
   "print \$myvar set to vla1"
 
 gdb_test "next" "\\d+.*vla1\\(1, 3, 8\\) = 1001" "next (2)"
-gdb_test "print \$myvar(3,6,9)" " = 1311" "print \$myvar(3,6,9)"
+gdb_test "print \$myvar(3,6,9)" " = 1311"
 
 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
 gdb_continue_to_breakpoint "pvla-associated, second time"
 gdb_test_no_output "set \$mypvar = pvla" "set \$mypvar = pvla"
-gdb_test "print \$mypvar(1,3,8)" " = 1001" "print \$mypvar(1,3,8)"
+gdb_test "print \$mypvar(1,3,8)" " = 1001"
 
 # deallocate pointer and make sure user defined variable still has the
 # right value.
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index e2ce63a62a0..15306d7920f 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -50,14 +50,12 @@  gdb_test "ptype t1" \
   [multi_line "type = Type t1" \
 	          "    $t1_i" \
 	          "    $t1_r" \
-	          "End Type t1"] \
-  "ptype t1"
+	          "End Type t1"]
 gdb_test "ptype t1v" \
   [multi_line "type = Type t1" \
 	          "    $t1_i" \
 	          "    $t1_r" \
-	          "End Type t1"] \
-  "ptype t1v"
+	          "End Type t1"]
 
 gdb_test "ptype t2v" \
   [multi_line "type = Type t2" \
diff --git a/gdb/testsuite/gdb.guile/guile.exp b/gdb/testsuite/gdb.guile/guile.exp
index 61e82aec31b..0d37514de5a 100644
--- a/gdb/testsuite/gdb.guile/guile.exp
+++ b/gdb/testsuite/gdb.guile/guile.exp
@@ -68,7 +68,7 @@  gdb_test_multiline "show guile command" \
 
 gdb_test "source $srcdir/$subdir/source2.scm" "yes" "source source2.scm"
 
-gdb_test "source -s source2.scm" "yes" "source -s source2.scm"
+gdb_test "source -s source2.scm" "yes"
 
 gdb_test "guile (print (current-objfile))" "= #f"
 gdb_test "guile (print (objfiles))" "= \\(\\)"
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index 477806bdadd..e5113f1d0eb 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -52,10 +52,12 @@  proc thread_apply {tid_list exp_tid_list {message ""}} {
     }
 
     set cmd "thread apply $tid_list"
-    if {$message == ""} {
-	set message $cmd
+    if {$message != ""} {
+	gdb_test "$cmd p 1234" $r $message
+	return
     }
-    gdb_test "$cmd p 1234" $r $message
+
+    gdb_test "$cmd p 1234" $r
 }
 
 # Issue "info threads TID_LIST" and expect EXP_TID_LIST (a list of
@@ -66,10 +68,11 @@  proc info_threads {tid_list exp_tid_list {message ""}} {
     set r [join $expected " ${any}\r\n${any} "]
     set r "${any} $r ${any}"
     set cmd "info threads $tid_list"
-    if {$message == ""} {
-	set message $cmd
+    if {$message != ""} {
+	gdb_test $cmd $r $message
+	return
     }
-    gdb_test $cmd $r $message
+    gdb_test $cmd $r
 }
 
 # Issue "info threads TID_LIST" and expect INFO_THR output.  Then
@@ -96,8 +99,7 @@  proc thr_apply_info_thr_error {tid_list exp_error_apply {exp_error_info ""}} {
 	$exp_error_info
 
     gdb_test "thread apply $tid_list" \
-	$exp_error_apply \
-	"thread apply $tid_list"
+	$exp_error_apply
 }
 
 # Issue both "info threads TID_LIST" and "thread apply TID_LIST" and
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 6ffa17a3577..fda32a23589 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -255,5 +255,5 @@  if ![runto "test_exec_exit"] then {
 }     
 
 gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exec"
-gdb_test "catch exec" "Catchpoint.*\(exec\).*" "catch exec"
+gdb_test "catch exec" "Catchpoint.*\(exec\).*"
 gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exec"
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index 336c88597a9..e04080621bd 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -85,8 +85,7 @@  gdb_continue_to_breakpoint "Inner test breakpoint"
 
 # Test multiple local blocks.
 gdb_test "bt full no-filters" \
-    ".*#0.*end_func.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \
-    "bt full no-filters"
+    ".*#0.*end_func.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*"
 gdb_test "bt full" \
     ".*#0.*cnuf_dne.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \
     "bt full with filters"
@@ -145,8 +144,7 @@  gdb_test "disable frame-filter global NoSuchFilter" \
 
 # Test no-filters
 gdb_test "bt no-filters" \
-    ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*" \
-    "bt no-filters"
+    ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*"
 
 # Test reverse
 gdb_test "bt" \
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp
index fa9458fa241..0eb7f8b2bf5 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.exp
+++ b/gdb/testsuite/gdb.python/py-pp-registration.exp
@@ -58,10 +58,8 @@  proc prepare_test { } {
 proc test_printers { s_prefix } {
     global hex
 
-    gdb_test "print flt" " = x=<42> y=<43>" \
-	"print flt"
-    gdb_test "print s" " = ${s_prefix} a=<1> b=<$hex>" \
-	"print s"
+    gdb_test "print flt" " = x=<42> y=<43>"
+    gdb_test "print s" " = ${s_prefix} a=<1> b=<$hex>"
 }
 
 # Test registration with verbose off.
diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp
index d7ba8f2dc9b..0b4096747f0 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.exp
+++ b/gdb/testsuite/gdb.python/py-xmethods.exp
@@ -159,8 +159,7 @@  gdb_test_no_output "disable xmethod progspace E_methods;method_int" \
 gdb_test "info xmethod progspace E_methods;method_int" ".* \\\[disabled\\\]" \
   "info xmethod xmethods E_methods;method_int"
 gdb_test_no_output "disable xmethod progspace G_methods" "disable G_methods 2"
-gdb_test "info xmethod progspace" ".*G_methods \\\[disabled\\\].*" \
-  "info xmethod progspace"
+gdb_test "info xmethod progspace" ".*G_methods \\\[disabled\\\].*"
 
 # PR 18285
 # First make sure both are enabled.
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index c795814a658..bbcec850e41 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -94,7 +94,7 @@  gdb_py_test_multiple "indented multi-line python command" \
 
 gdb_test "source $remote_source2_py" "yes" "source source2.py"
 
-gdb_test "source -s source2.py" "yes" "source -s source2.py"
+gdb_test "source -s source2.py" "yes"
 
 set remote_source2_symlink_notpy \
     [gdb_remote_download host ${srcdir}/${subdir}/source2.py \
diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
index 4a3b59f6321..79a24a5fe4d 100644
--- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
+++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
@@ -50,7 +50,7 @@  proc connect_no_symbol_file { sysroot action } {
 
 	# Make sure we're disconnected, in case we're testing with an
 	# extended-remote board, therefore already connected.
-	gdb_test "disconnect" ".*" "disconnect"
+	gdb_test "disconnect" ".*"
 
 	# Discard any symbol files that we have opened.
 	gdb_test "file" ".*" "discard symbol table" \
diff --git a/gdb/testsuite/gdb.server/no-thread-db.exp b/gdb/testsuite/gdb.server/no-thread-db.exp
index 34dc22973fe..501cb2a79ca 100644
--- a/gdb/testsuite/gdb.server/no-thread-db.exp
+++ b/gdb/testsuite/gdb.server/no-thread-db.exp
@@ -52,5 +52,4 @@  gdb_continue_to_breakpoint "after tls assignment"
 
 # Printing a tls variable should fail gracefully without a libthread_db.
 gdb_test "print foo" \
-    "Cannot find thread-local storage for Thread \[^,\]+, executable file ${binfile}:\[\r\n\]+Remote target failed to process qGetTLSAddr request" \
-    "print foo"
+    "Cannot find thread-local storage for Thread \[^,\]+, executable file ${binfile}:\[\r\n\]+Remote target failed to process qGetTLSAddr request"
diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp
index 6ec0d1e03b1..b4d5fda7a69 100644
--- a/gdb/testsuite/gdb.server/run-without-local-binary.exp
+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp
@@ -39,7 +39,7 @@  save_vars { GDBFLAGS } {
 
     # Make sure we're disconnected, in case we're testing with an
     # extended-remote board, therefore already connected.
-    gdb_test "disconnect" ".*" "disconnect"
+    gdb_test "disconnect" ".*"
 
     # Let's start gdbserver in extended-remote mode now.  We cannot
     # use gdbserver_start_extended here because it starts gdbserver,
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index 001f97bdee7..56a26bb0e1b 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -137,7 +137,7 @@  proc do_tests {} {
 	print_weird_var attr126
 
 	gdb_test "p const69" " = 69" "'e' constant on non-enum type"
-	gdb_test "whatis const69" "type = (unsigned int|inttype)" "whatis const69"
+	gdb_test "whatis const69" "type = (unsigned int|inttype)"
 
 	gdb_test "p sizeof (const70)" " = 2" "'e' constant with embedded type"
 
@@ -147,7 +147,7 @@  proc do_tests {} {
 
         gdb_test "p constString3" " = \"String3 with embedded quote ' in the middle\"" "string constant 3"
         gdb_test "p constString4" { = "String4 with embedded quote \\" in the middle"} "string constant 4"
-	gdb_test "p bad_neg0" " = \{field0 = 42, field2 =.*field3 = 45\}" "p bad_neg0"
+	gdb_test "p bad_neg0" " = \{field0 = 42, field2 =.*field3 = 45\}"
 
 	gdb_test "ptype inttype" "type = (unsigned int|inttype)" "ptype on inttype"
 	gdb_test "p sizeof (float72type)" " = 9" "unrecognized floating point type"
@@ -155,8 +155,8 @@  proc do_tests {} {
 	# This big number needs to be kept as one piece
 	gdb_test "p/x int256var" " = 0x0*2a0000002b0000002c0000002d0000002d0000002c0000002b0000002a" "print very big integer"
 
-	gdb_test "whatis consth" "type = inttype" "whatis consth"
-	gdb_test "whatis consth2" "type = inttype" "whatis consth2"
+	gdb_test "whatis consth" "type = inttype"
+	gdb_test "whatis consth2" "type = inttype"
 
 	# GDB does not yet understand S constants
 	setup_xfail "*-*-*"
diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index 41d65094b2a..06d8a295b76 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -128,7 +128,7 @@  proc test {} {
 	    # detaching from the program and reattaching, we check that
 	    # the program doesn't die due to gdb leaving a pending
 	    # breakpoint hit on a new thread unprocessed.
-	    gdb_test "break break_fn" "Breakpoint.*" "break break_fn"
+	    gdb_test "break break_fn" "Breakpoint.*"
 
 	    # Wait a bit, to give time for most threads to hit the
 	    # breakpoint, including threads we might have failed to
diff --git a/gdb/testsuite/gdb.threads/thread-find.exp b/gdb/testsuite/gdb.threads/thread-find.exp
index 6f58674450f..97d7637d7a3 100644
--- a/gdb/testsuite/gdb.threads/thread-find.exp
+++ b/gdb/testsuite/gdb.threads/thread-find.exp
@@ -276,9 +276,7 @@  gdb_test_multiple "info threads 3-3" "info threads 3-3" {
 # Test bad input
 
 gdb_test "info thread foo" \
-    "Invalid thread ID: foo" \
-    "info thread foo"
+    "Invalid thread ID: foo"
 
 gdb_test "info thread foo -1" \
-    "Invalid thread ID: foo -1" \
-    "info thread foo -1"
+    "Invalid thread ID: foo -1"
diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp
index 5a4b9b6f8d8..9d46a70df0b 100644
--- a/gdb/testsuite/gdb.threads/tls-shared.exp
+++ b/gdb/testsuite/gdb.threads/tls-shared.exp
@@ -61,6 +61,4 @@  gdb_test "continue" \
         "continue to break"
 # This is more of a gcc/glibc test, really. 
 #
-gdb_test "print result" "3" "print result"
-
-
+gdb_test "print result" "3"
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index eb571dc12ed..eaa8391f9f6 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -290,10 +290,9 @@  gdb_expect {
 runto spin
 
 gdb_test "info address a_global" \
-	".*a_global.*static storage at address.*" "info address a_global"
+	".*a_global.*static storage at address.*"
 
-gdb_test "info address me" ".*me.*is a (complex DWARF expression:|variable).*" \
-    "info address me"
+gdb_test "info address me" ".*me.*is a (complex DWARF expression:|variable).*"
 
 
 # Test LOC_UNRESOLVED references resolving for `extern' TLS variables.
diff --git a/gdb/testsuite/gdb.threads/wp-replication.exp b/gdb/testsuite/gdb.threads/wp-replication.exp
index 390d37f9e16..35a351ce8f4 100644
--- a/gdb/testsuite/gdb.threads/wp-replication.exp
+++ b/gdb/testsuite/gdb.threads/wp-replication.exp
@@ -114,8 +114,7 @@  for { set i 0 } { $i < $NR_THREADS } { incr i } {
     # in the background for a specific thread.
     if {$i < $hwatch_count} {
       gdb_test "watch watched_data\[$i\]" \
-	"Hardware watchpoint .*" \
-	"watch watched_data\[$i\]"
+	"Hardware watchpoint .*"
     } else {
       verbose -log "Not setting watchpoint for watched_data\[$i\]\n"
     }
diff --git a/gdb/testsuite/gdb.trace/ax.exp b/gdb/testsuite/gdb.trace/ax.exp
index f05689f169e..f0ff1f1c913 100644
--- a/gdb/testsuite/gdb.trace/ax.exp
+++ b/gdb/testsuite/gdb.trace/ax.exp
@@ -40,99 +40,99 @@  gdb_load $binfile
 runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test "maint agent 12" ".*const8 12.*pop.*end.*" "maint agent 12"
+gdb_test "maint agent 12" ".*const8 12.*pop.*end.*"
 
-gdb_test "maint agent gdb_char_test" "" "maint agent gdb_char_test"
+gdb_test "maint agent gdb_char_test" ""
 
-gdb_test "maint agent gdb_arr_test\[12\]" "" "maint agent gdb_arr_test\[12\]"
+gdb_test "maint agent gdb_arr_test\[12\]" ""
 
-gdb_test "maint agent gdb_arr_test\[gdb_short_test\]" "" "maint agent gdb_arr_test\[gdb_short_test\]"
+gdb_test "maint agent gdb_arr_test\[gdb_short_test\]" ""
 
-gdb_test "maint agent gdb_struct1_test" "" "maint agent gdb_struct1_test"
+gdb_test "maint agent gdb_struct1_test" ""
 
-gdb_test "maint agent gdb_struct1_test.s" "" "maint agent gdb_struct1_test.s"
+gdb_test "maint agent gdb_struct1_test.s" ""
 
-gdb_test "maint agent gdb_struct1_test.arr\[gdb_struct1_test.c\]" "" "maint agent gdb_struct1_test.arr\[gdb_struct1_test.c\]"
+gdb_test "maint agent gdb_struct1_test.arr\[gdb_struct1_test.c\]" ""
 
-gdb_test "maint agent gdb_structp_test" "" "maint agent gdb_structp_test"
+gdb_test "maint agent gdb_structp_test" ""
 
-gdb_test "maint agent gdb_structp_test->l" "" "maint agent gdb_structp_test->l"
+gdb_test "maint agent gdb_structp_test->l" ""
 
-gdb_test "maint agent gdb_structp_test->bfield" "" "maint agent gdb_structp_test->bfield"
+gdb_test "maint agent gdb_structp_test->bfield" ""
 
-gdb_test "maint agent gdb_long_test + gdb_short_test" "" "maint agent gdb_long_test + gdb_short_test"
+gdb_test "maint agent gdb_long_test + gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test - gdb_short_test" "" "maint agent gdb_long_test - gdb_short_test"
+gdb_test "maint agent gdb_long_test - gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test * gdb_short_test" "" "maint agent gdb_long_test * gdb_short_test"
+gdb_test "maint agent gdb_long_test * gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test / gdb_short_test" "" "maint agent gdb_long_test / gdb_short_test"
+gdb_test "maint agent gdb_long_test / gdb_short_test" ""
 
-gdb_test "maint agent gdb_structp_test + 1" "" "maint agent gdb_structp_test + 1"
+gdb_test "maint agent gdb_structp_test + 1" ""
 
-gdb_test "maint agent gdb_long_test == gdb_short_test" "" "maint agent gdb_long_test == gdb_short_test"
+gdb_test "maint agent gdb_long_test == gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test != gdb_short_test" "" "maint agent gdb_long_test != gdb_short_test"
+gdb_test "maint agent gdb_long_test != gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test < gdb_short_test" "" "maint agent gdb_long_test < gdb_short_test"
+gdb_test "maint agent gdb_long_test < gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test <= gdb_short_test" "" "maint agent gdb_long_test <= gdb_short_test"
+gdb_test "maint agent gdb_long_test <= gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test > gdb_short_test" "" "maint agent gdb_long_test > gdb_short_test"
+gdb_test "maint agent gdb_long_test > gdb_short_test" ""
 
-gdb_test "maint agent gdb_long_test >= gdb_short_test" "" "maint agent gdb_long_test >= gdb_short_test"
+gdb_test "maint agent gdb_long_test >= gdb_short_test" ""
 
-gdb_test "maint agent &gdb_long_test == &gdb_short_test" "" "maint agent &gdb_long_test == &gdb_short_test"
+gdb_test "maint agent &gdb_long_test == &gdb_short_test" ""
 
-gdb_test "maint agent &gdb_long_test < &gdb_short_test" "" "maint agent &gdb_long_test < &gdb_short_test"
+gdb_test "maint agent &gdb_long_test < &gdb_short_test" ""
 
-gdb_test "maint agent (unsigned char)1L" ".*ext 8.*" "maint agent (unsigned char)1L"
+gdb_test "maint agent (unsigned char)1L" ".*ext 8.*"
 
 # Now test eval version of agent expressions.
 
-gdb_test "maint agent-eval 12" ".*const8 12.*end.*" "maint agent-eval 12"
+gdb_test "maint agent-eval 12" ".*const8 12.*end.*"
 
-gdb_test "maint agent-eval gdb_char_test" "" "maint agent-eval gdb_char_test"
+gdb_test "maint agent-eval gdb_char_test" ""
 
-gdb_test "maint agent-eval gdb_arr_test\[12\]" "" "maint agent-eval gdb_arr_test\[12\]"
+gdb_test "maint agent-eval gdb_arr_test\[12\]" ""
 
-gdb_test "maint agent-eval gdb_arr_test\[gdb_short_test\]" "" "maint agent-eval gdb_arr_test\[gdb_short_test\]"
+gdb_test "maint agent-eval gdb_arr_test\[gdb_short_test\]" ""
 
-gdb_test "maint agent-eval gdb_struct1_test" "" "maint agent-eval gdb_struct1_test"
+gdb_test "maint agent-eval gdb_struct1_test" ""
 
-gdb_test "maint agent-eval gdb_struct1_test.s" "" "maint agent-eval gdb_struct1_test.s"
+gdb_test "maint agent-eval gdb_struct1_test.s" ""
 
-gdb_test "maint agent-eval gdb_struct1_test.arr\[gdb_struct1_test.c\]" "" "maint agent-eval gdb_struct1_test.arr\[gdb_struct1_test.c\]"
+gdb_test "maint agent-eval gdb_struct1_test.arr\[gdb_struct1_test.c\]" ""
 
-gdb_test "maint agent-eval gdb_structp_test" "" "maint agent-eval gdb_structp_test"
+gdb_test "maint agent-eval gdb_structp_test" ""
 
-gdb_test "maint agent-eval gdb_structp_test->l" "" "maint agent-eval gdb_structp_test->l"
+gdb_test "maint agent-eval gdb_structp_test->l" ""
 
-gdb_test "maint agent-eval gdb_structp_test->bfield" "" "maint agent-eval gdb_structp_test->bfield"
+gdb_test "maint agent-eval gdb_structp_test->bfield" ""
 
-gdb_test "maint agent-eval gdb_long_test + gdb_short_test" "" "maint agent-eval gdb_long_test + gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test + gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test - gdb_short_test" "" "maint agent-eval gdb_long_test - gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test - gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test * gdb_short_test" "" "maint agent-eval gdb_long_test * gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test * gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test / gdb_short_test" "" "maint agent-eval gdb_long_test / gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test / gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_structp_test + 1" "" "maint agent-eval gdb_structp_test + 1"
+gdb_test "maint agent-eval gdb_structp_test + 1" ""
 
-gdb_test "maint agent-eval gdb_long_test == gdb_short_test" "" "maint agent-eval gdb_long_test == gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test == gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test != gdb_short_test" "" "maint agent-eval gdb_long_test != gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test != gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test < gdb_short_test" "" "maint agent-eval gdb_long_test < gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test < gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test <= gdb_short_test" "" "maint agent-eval gdb_long_test <= gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test <= gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test > gdb_short_test" "" "maint agent-eval gdb_long_test > gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test > gdb_short_test" ""
 
-gdb_test "maint agent-eval gdb_long_test >= gdb_short_test" "" "maint agent-eval gdb_long_test >= gdb_short_test"
+gdb_test "maint agent-eval gdb_long_test >= gdb_short_test" ""
 
-gdb_test "maint agent-eval &gdb_long_test == &gdb_short_test" ".*equal.*end.*" "maint agent-eval &gdb_long_test == &gdb_short_test"
+gdb_test "maint agent-eval &gdb_long_test == &gdb_short_test" ".*equal.*end.*"
 
-gdb_test "maint agent-eval &gdb_long_test < &gdb_short_test" "" "maint agent-eval &gdb_long_test < &gdb_short_test"
+gdb_test "maint agent-eval &gdb_long_test < &gdb_short_test" ""
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 599bf0f0c3c..2d395efb565 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1401,11 +1401,10 @@  proc gdb_test_exact { args } {
     regsub -all "\n" $pattern "\r\n" pattern
     if [llength $args]==3 then {
 	set message [lindex $args 2]
-    } else {
-	set message $command
+	return [gdb_test $command $pattern $message]
     }
 
-    return [gdb_test $command $pattern $message]
+    return [gdb_test $command $pattern]
 }
 
 # Wrapper around gdb_test_multiple that looks for a list of expected
@@ -5783,13 +5782,13 @@  proc gdb_gnu_strip_debug { dest args } {
 # If third argument TESTNAME is not empty, it's used as the name of the
 # test to be printed on pass/fail.
 proc help_test_raw { gdb_command expected_lines {testname {}} } {
-    if {$testname == {}} {
-	set message $gdb_command
-    } else {
-	set message $testname
-    }
     set expected_output [join $expected_lines ""]
-    gdb_test "${gdb_command}" "${expected_output}" $message
+    if {$testname != {}} {
+	gdb_test "${gdb_command}" "${expected_output}" $testname
+	return
+    }
+
+    gdb_test "${gdb_command}" "${expected_output}"
 }
 
 # A regexp that matches the end of help CLASS|PREFIX_COMMAND