[RFAv2] Make test names unique in python.exp and guile.exp

Message ID 20200624212518.31929-1-philippe.waroquiers@skynet.be
State New
Headers show
Series
  • [RFAv2] Make test names unique in python.exp and guile.exp
Related show

Commit Message

Jose E. Marchesi via Gdb-patches June 24, 2020, 9:25 p.m.
Version 2, handles the comments of Simon and Pedro.

Note that gdb_test_multiline and gdb_py_test_multiple are using
the "input line" as the test name, and so when there is a duplicated
input line (such as a line containing "end"), we have duplicated test
names => as gdb_test_multiline and gdb_py_test_multiple are identical,
as indicated in FIXME, move this to gdb.exp, and make the test name unique
by adding the inputnr to the pass message for each input.

YYYY-MM-DD  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* lib/gdb.exp (gdb_test_multiline): New, moved from gdb-guile.exp,
	have a input seq nr in each pass message.
        * lib/gdb-guile.exp (gdb_test_multiline): Move to gdb.exp.
	* lib/gdb-python.exp (gdb_py_test_multiple): Remove.
	* gdb.python/python.exp: Make test names unique,
	use gdb_test_multiline instead of gdb_py_test_multiple,
	use $gdb_test_name.
	* gdb.guile/guile.exp: Make test names unique, use $gdb_test_name
---
 gdb/testsuite/gdb.python/python.exp | 118 +++++++++++++++-------------
 gdb/testsuite/lib/gdb-guile.exp     |  20 -----
 gdb/testsuite/lib/gdb-python.exp    |  19 -----
 gdb/testsuite/lib/gdb.exp           |  22 ++++++
 4 files changed, 84 insertions(+), 95 deletions(-)

-- 
2.20.1

Comments

Jose E. Marchesi via Gdb-patches June 24, 2020, 10:36 p.m. | #1
On 6/24/20 10:25 PM, Philippe Waroquiers via Gdb-patches wrote:
> -gdb_test_multiple "python" "test we ignore substituion for seconday prompts" {

> +gdb_test_multiple "python" "test we ignore substitution for seconday prompts" {


Another typo you could fix: seconday -> secondary.

Otherwise LGTM.  Please let's also give Simon a chance to take
a second look, though.

Thanks for fixing all those gdb_test_multiple mismatches!

Pedro Alves
Simon Marchi June 25, 2020, 2:27 p.m. | #2
On 2020-06-24 6:36 p.m., Pedro Alves via Gdb-patches wrote:
> On 6/24/20 10:25 PM, Philippe Waroquiers via Gdb-patches wrote:

>> -gdb_test_multiple "python" "test we ignore substituion for seconday prompts" {

>> +gdb_test_multiple "python" "test we ignore substitution for seconday prompts" {

> 

> Another typo you could fix: seconday -> secondary.

> 

> Otherwise LGTM.  Please let's also give Simon a chance to take

> a second look, though.

> 

> Thanks for fixing all those gdb_test_multiple mismatches!

> 

> Pedro Alves

> 


It LGTM too!

Simon
Tom de Vries June 29, 2020, 9:58 a.m. | #3
On 6/24/20 11:25 PM, Philippe Waroquiers via Gdb-patches wrote:
> 	* lib/gdb-python.exp (gdb_py_test_multiple): Remove.


Hi,

this proc seems to have been removed, but there are still uses left, so
I'm running into:
...
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-breakpoint.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {Sub-class a breakpoint} python
{} {class bp_eval (gdb.Breakpoint):} {} {   inf_i = 0} {} {   count = 0}
{} {  ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "Sub-class a breakpoint"  "python" ""  "class
bp_eval (gdb.Breakpoint):" ""  "   inf_i = 0" ""  "   count = 0" ""  "
 def stop (..."
    ("uplevel" body line 17)
    invoked from within
"uplevel 1 $body"
    invoked from within
"with_test_prefix test_bkpt_eval_funcs {
    global srcfile testfile hex decimal

    # Start with a fresh gdb.
    clean_restart ${testfile}

    # Di..."
    (procedure "test_bkpt_eval_funcs" line 1)
    invoked from within
"test_bkpt_eval_funcs"
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-breakpoint.exp"
line 723)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-breakpoint.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-breakpoint.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-cmd.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {input simple command} python {}
{class test_cmd (gdb.Command):} {} {  def __init__ (self):} {} {
super (tes..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "input simple command" \
  "python" "" \
  "class test_cmd (gdb.Command):" "" \
  "  def __init__ (self):" "" \
  "    super (tes..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-cmd.exp"
line 37)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-cmd.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-cmd.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-events.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {define new user command}
{define xxz} {End with a line saying just .end..} {set variable $x = 72}
{} {set vari..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "define new user command" \
    "define xxz" "End with a line saying just .end.." \
    "set variable \$x = 72" "" \
    "set var..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-events.exp"
line 216)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-events.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-events.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-function.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {input convenience function}
python {} {class test_func (gdb.Function):} {} {  def __init__ (self):}
{} {    su..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "input convenience function" \
  "python" "" \
  "class test_func (gdb.Function):" "" \
  "  def __init__ (self):" "" \
  "    su..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-function.exp"
line 30)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-function.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-function.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-inferior.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {install new inferior event
handler} python {} {my_inferior_count = 1} {} {def
new_inf_handler(evt):} {} {  glo..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "install new inferior event handler"  "python" ""
 "my_inferior_count = 1" ""  "def new_inf_handler(evt):" ""  "  global
my_infer..."
    ("uplevel" body line 6)
    invoked from within
"uplevel 1 $body"
    invoked from within
"with_test_prefix "is_valid" {
    gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get
initial list" 1
    gdb_test "python print (len(inf_..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-inferior.exp"
line 215)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-inferior.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-inferior.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-infthread.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {install new_thread event
handler} python {} {seen_a_thread = False} {} {def thread_handler(evt):}
{} {  if evt..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "install new_thread event handler" \
    "python" "" \
    "seen_a_thread = False" "" \
    "def thread_handler(evt):" "" \
    "..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-infthread.exp"
line 33)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-infthread.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-infthread.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-linetable.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {input simple command} python {}
{def list_lines():} {} {   for l in lt:} {} {     print ('L' +
str(l.line) + '..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "input simple command" \
  "python" "" \
  "def list_lines():" "" \
  "   for l in lt:" "" \
  "     print ('L' + str(l.line) + '..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-linetable.exp"
line 43)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-linetable.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-linetable.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-parameter.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {Simple gdb booleanparameter}
python {} {class TestParam (gdb.Parameter):} {} {   """When enabled,
test param d..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "Simple gdb booleanparameter"  "python" ""  "class
TestParam (gdb.Parameter):" ""  "   \"\"\"When enabled, test param does
someth..."
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $body"
    invoked from within
"with_test_prefix "boolean parameter" {
    gdb_py_test_multiple "Simple gdb booleanparameter" \
        "python" "" \
        "class TestParam (gdb.Parameter):" "" ..."
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-parameter.exp"
line 41)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-parameter.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-parameter.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
ERROR: tcl error sourcing
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-value.exp.
ERROR: invalid command name "gdb_py_test_multiple"
    while executing
"::gdb_tcl_unknown gdb_py_test_multiple {define function to test
booleans} python {} {def test_bool (val):} {} {  if val:} {} {    print
('yay')} {} { ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::gdb_tcl_unknown $args"
    (procedure "::unknown" line 3)
    invoked from within
"gdb_py_test_multiple "define function to test booleans"  "python" ""
"def test_bool (val):" ""  "  if val:" ""  "    print ('yay')" ""  "
else:" "" ..."
    (procedure "test_value_boolean" line 3)
    invoked from within
"test_value_boolean"
    (file
"/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-value.exp"
line 591)
    invoked from within
"source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-value.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-value.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
...

Thanks,
- Tom
Jose E. Marchesi via Gdb-patches June 30, 2020, 4:20 p.m. | #4
On Mon, 2020-06-29 at 11:58 +0200, Tom de Vries wrote:
> On 6/24/20 11:25 PM, Philippe Waroquiers via Gdb-patches wrote:

> > 	* lib/gdb-python.exp (gdb_py_test_multiple): Remove.

> 

> Hi,

> 

> this proc seems to have been removed, but there are still uses left, so

> I'm running into:

> ...

> ERROR: tcl error sourcing

> /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-breakpoint.exp.

> ERROR: invalid command name "gdb_py_test_multiple"

Sorry for the breakage.  I did not notice the problem, I guess because I only
looked at an increase of the failures, and as I understand, such tcl errors are
not counted as increased failures.

I will push a fix asap, under the obvious rule, as the change should be mechanical.

Thanks

Philippe

Patch

diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index a751787b26..a031ea5a18 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -46,7 +46,7 @@  gdb_test_multiple "python print (23)" "verify python support" {
 	  "source source2.py when python disabled"
 
       # Verify multi-line python commands cause an error.
-      gdb_py_test_multiple "multi-line python command" \
+      gdb_test_multiline "multi-line python command" \
 	  "python" "" \
 	  "print (23)" "" \
 	  "end" "not supported.*"
@@ -56,7 +56,7 @@  gdb_test_multiple "python print (23)" "verify python support" {
     -re "$gdb_prompt $"	{}
 }
 
-gdb_py_test_multiple "multi-line python command" \
+gdb_test_multiline "multi-line python command" \
   "python" "" \
   "print (23)" "" \
   "end" "23"
@@ -77,7 +77,7 @@  with_test_prefix "python interactive help" {
     }
 }
 
-gdb_py_test_multiple "show python command" \
+gdb_test_multiline "show python command" \
   "define zzq" "Type commands for definition of .* just \"end\"\\.*" \
   "python" "" \
   "print (23)" "" \
@@ -85,7 +85,7 @@  gdb_py_test_multiple "show python command" \
   "end" "" \
   "show user zzq" "User command \"zzq\":.*  python.*print \\(23\\).*  end"
 
-gdb_py_test_multiple "indented multi-line python command" \
+gdb_test_multiline "indented multi-line python command" \
   "python" "" \
   "def foo ():" "" \
   "  print ('hello, world!')" "" \
@@ -124,7 +124,7 @@  gdb_test "python gdb.execute('echo 2\\necho 3\\\\n\\n')" "23" \
 gdb_test " " "23" "gdb.execute does not affect repeat history"
 
 # Test post_event.
-gdb_py_test_multiple "post event insertion" \
+gdb_test_multiline "post event insertion" \
   "python" "" \
   "someVal = 0" "" \
   "class Foo(object):" "" \
@@ -194,7 +194,7 @@  gdb_test "python print (a)" ".*aliases -- User-defined aliases of other commands
 gdb_py_test_silent_cmd "python nothread = gdb.selected_thread()" "Attempt to aquire thread with no inferior" 1
 gdb_test "python print (nothread == None)" "True" "ensure that no threads are returned"
 
-gdb_py_test_multiple "register atexit function" \
+gdb_test_multiline "register atexit function" \
     "python" "" \
     "import atexit" "" \
     "def printit(arg):" "" \
@@ -229,10 +229,12 @@  runto $lineno
 gdb_test "python gdb.decode_line(\"main.c:43\")" \
     "gdb.error: No source file named main.c.*" "test decode_line no source named main"
 
-gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "test decode_line current location" 1
-gdb_test "python print (len(symtab))" "2" "test decode_line current location"
-gdb_test "python print (symtab\[0\])" "None" "test decode_line expression parse"
-gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line current location"
+with_test_prefix "test decode_line current location" {
+    gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "decode current line" 1
+    gdb_test "python print (len(symtab))" "2" "length of result"
+    gdb_test "python print (symtab\[0\])" "None" "no unparsed text"
+    gdb_test "python print (len(symtab\[1\]))" "1" "length of result locations"
+}
 
 # Test that decode_line with an empty string argument does not crash.
 gdb_py_test_silent_cmd "python symtab2 = gdb.decode_line('')" \
@@ -243,21 +245,23 @@  if { [is_remote host] } {
 } else {
     set python_c [string_to_regexp "gdb.python/python.c"]
 }
-gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "test decode_line current location filename"
-gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "test decode_line current location line number"
-
-gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "test decode_line python.c:26" 1
-gdb_test "python print (len(symtab))" "2" "test decode_line python.c:26 length"
-gdb_test "python print (symtab\[0\])" "if foo" "test decode_line expression parse"
-gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line python.c:26 length"
-gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "test decode_line python.c:26 filename"
-gdb_test "python print (symtab\[1\]\[0\].line)" "26" "test decode_line python.c:26 line number"
-
-gdb_test "python gdb.decode_line(\"randomfunc\")" \
-    "gdb.error: Function \"randomfunc\" not defined.*" "test decode_line randomfunc"
-gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode_line func1()" 1
-gdb_test "python print (len(symtab))" "2" "test decode_line func1 length"
-gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line func1 length"
+with_test_prefix "test decode_line" {
+    gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "current location filename"
+    gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "current location line number"
+
+    gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "python.c:26 decode" 1
+    gdb_test "python print (len(symtab))" "2" "python.c:26 length 2"
+    gdb_test "python print (symtab\[0\])" "if foo" "expression parse"
+    gdb_test "python print (len(symtab\[1\]))" "1" "python.c:26 length 1"
+    gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "python.c:26 filename"
+    gdb_test "python print (symtab\[1\]\[0\].line)" "26" "python.c:26 line number"
+
+    gdb_test "python gdb.decode_line(\"randomfunc\")" \
+	"gdb.error: Function \"randomfunc\" not defined.*" "randomfunc"
+    gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "func1()" 1
+    gdb_test "python print (len(symtab))" "2" "func1 length 2"
+    gdb_test "python print (len(symtab\[1\]))" "1" "func1 length 1"
+}
 
 if { [is_remote host] } {
     set python_1_c [string_to_regexp "python-1.c"]
@@ -284,12 +288,14 @@  gdb_py_test_silent_cmd {python symtab = gdb.decode_line ("func1,func2")} \
     "test decode_line func1,func2" 1
 gdb_test {python print (symtab[0])} ",func2" "stop at comma in linespec"
 
-gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"*0\")" "Test decode_line *0" 1
-gdb_test "python print (len(symtab))" "2" "test decode_line *0 result length"
-gdb_test "python print (symtab\[0\])" "None" "test decode_line *0 unparsed"
-gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line *0 locations length"
-gdb_test "python print (symtab\[1\]\[0\].symtab)" "None" "test decode_line *0 filename"
-gdb_test "python print (symtab\[1\]\[0\].pc)" "0" "test decode_line *0 pc"
+with_test_prefix "test decode_line" {
+    gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"*0\")" "*0" 1
+    gdb_test "python print (len(symtab))" "2" "*0 result length"
+    gdb_test "python print (symtab\[0\])" "None" "*0 unparsed"
+    gdb_test "python print (len(symtab\[1\]))" "1" "*0 locations length"
+    gdb_test "python print (symtab\[1\]\[0\].symtab)" "None" "*0 filename"
+    gdb_test "python print (symtab\[1\]\[0\].pc)" "0" "*0 pc"
+}
 
 # gdb.write
 gdb_test "python print (sys.stderr)" ".*gdb._GdbOutputErrorFile (instance|object) at.*" "test stderr location"
@@ -308,7 +314,7 @@  gdb_py_test_silent_cmd "set python print-stack full" \
 
 # Test prompt substituion
 
-gdb_py_test_multiple "prompt substitution" \
+gdb_test_multiline "prompt substitution" \
   "python" "" \
   "someCounter = 0" "" \
   "def prompt(current):" "" \
@@ -319,7 +325,7 @@  gdb_py_test_multiple "prompt substitution" \
   "   return \"py prompt \" + str (someCounter) + \" \"" "" \
   "end" ""
 
-gdb_py_test_multiple "prompt substitution readline" \
+gdb_test_multiline "prompt substitution readline" \
   "python" "" \
   "pCounter = 0" "" \
   "def program_prompt(current):" "" \
@@ -334,39 +340,39 @@  set newprompt "py prompt 1"
 set newprompt2 "py prompt 2"
 set testfake "testfake"
 
-gdb_test_multiple "python gdb.prompt_hook = prompt" "set the hook" {
+gdb_test_multiple "python gdb.prompt_hook = prompt" "set the hook = prompt" {
     -re "\[\r\n\]$newprompt $" {
-	pass "set hook"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "set prompt testfake " "set testfake prompt in GDB" {
     -re "\[\r\n\]$testfake $" {
-	pass "set prompt testfake"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "show prompt" "show testfake prompt" {
     -re "Gdb's prompt is \"$testfake \"..* $" {
-	pass "show prompt shows guarded prompt"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "set prompt blah " "set blah in GDB" {
     -re "\[\r\n\]$newprompt2 $" {
-	pass "set prompt blah overriden"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "python gdb.prompt_hook = None" "delete hook" {
     -re "\[\r\n\]$newprompt2 $" {
-	pass "delete old hook"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "set prompt $gdb_prompt " "set default prompt" {
     -re "\[\r\n\]$gdb_prompt $" {
-	pass "set default prompt"
+	pass $gdb_test_name
     }
 }
 
@@ -377,25 +383,25 @@  gdb_test_multiple "pwd" "pwd" {
     }
 }
 
-gdb_test_multiple "python gdb.prompt_hook = program_prompt" "set the hook" {
+gdb_test_multiple "python gdb.prompt_hook = program_prompt" "set the programming hook" {
     -re "\[\r\n\]$gdb_prompt $" {
-	pass "set programming hook"
+	pass $gdb_test_name
     }
 }
 
-gdb_test_multiple "python" "test we ignore substituion for seconday prompts" {
+gdb_test_multiple "python" "test we ignore substitution for seconday prompts" {
     -re "\r\n>$" {
-	pass "readline secondary are not substituted"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "end" "end programming" {
     -re "\[\r\n\]$gdb_prompt $" {
-	pass "end programming"
+	pass $gdb_test_name
     }
 }
 
-gdb_py_test_multiple "prompt substitution readline" \
+gdb_test_multiline "prompt substitution readline import" \
   "python" "" \
   "import gdb.command.prompt" "" \
   "end" ""
@@ -403,21 +409,21 @@  gdb_py_test_multiple "prompt substitution readline" \
 gdb_test_multiple "set extended-prompt one two three " \
     "set basic extended prompt" {
     -re "\[\r\n\]one two three $" {
-	pass "set basic extended prompt"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "set extended-prompt \\w " \
     "set extended prompt working directory" {
     -re "\[\r\n\][string_to_regexp $working_dir] $" {
-	pass "set extended prompt working directory"
+	pass $gdb_test_name
     }
 }
 
 gdb_test_multiple "set extended-prompt some param \\p{python print-stack} " \
     "set extended prompt parameter" {
     -re "\[\r\n\]some param full $" {
-	pass "set extended prompt parameter"
+	pass $gdb_test_name
     }
 }
 
@@ -449,33 +455,33 @@  gdb_test "show python print-stack" \
 gdb_py_test_silent_cmd "set python print-stack message" \
     "Test print-stack set setting to message" 1
 
-gdb_py_test_multiple "prompt substitution readline" \
+gdb_test_multiline "prompt substitution readline error_prompt" \
   "python" "" \
   "pCounter = 0" "" \
   "def error_prompt(current):" "" \
   "   raise RuntimeError(\"Python exception called\")" "" \
   "end" ""
 
-gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
+gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook error_prompt" {
     -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*$gdb_prompt $" {
-	pass "set hook"
+	pass $gdb_test_name
     }
 }
 
 gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \
-    "set the hook to default" 1
+    "set the hook to default 1" 1
 
 gdb_py_test_silent_cmd "set python print-stack full" \
     "set print-stack full for prompt error test" 1
 
-gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
+gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook error_prompt traceback" {
     -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*$gdb_prompt $" {
-	pass "set hook"
+	pass $gdb_test_name
     }
 }
 
 gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \
-    "set the hook to default" 1
+    "set the hook to default 2" 1
 
 # Start with a fresh gdb.
 clean_restart ${testfile}
diff --git a/gdb/testsuite/lib/gdb-guile.exp b/gdb/testsuite/lib/gdb-guile.exp
index bda994b74c..ab6277b45a 100644
--- a/gdb/testsuite/lib/gdb-guile.exp
+++ b/gdb/testsuite/lib/gdb-guile.exp
@@ -54,26 +54,6 @@  proc gdb_scm_test_silent_cmd { cmd name {report_pass 1} } {
     }
 }
 
-# Usage: gdb_test_multiline NAME INPUT RESULT {INPUT RESULT} ...
-# Run a test named NAME, consisting of multiple lines of input.
-# After each input line INPUT, search for result line RESULT.
-# Succeed if all results are seen; fail otherwise.
-# FIXME: Move to gdb.exp and remove Python's gdb_py_test_multiple.
-
-proc gdb_test_multiline { name args } {
-    global gdb_prompt
-    foreach {input result} $args {
-	if {[gdb_test_multiple $input "$name - $input" {
-	    -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" {
-		pass "$name - $input"
-	    }
-	}]} {
-	    return 1
-	}
-    }
-    return 0
-}
-
 # Load Scheme file FILE_NAME.
 # TEST_NAME can be used to specify the name of the test,
 # otherwise a standard test name is provided.
diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp
index 2408f2e221..b41032feb2 100644
--- a/gdb/testsuite/lib/gdb-python.exp
+++ b/gdb/testsuite/lib/gdb-python.exp
@@ -27,25 +27,6 @@  proc gdb_py_test_silent_cmd { cmd name report_pass } {
     }
 }
 
-# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}...
-# Run a test named NAME, consisting of multiple lines of input.
-# After each input line INPUT, search for result line RESULT.
-# Succeed if all results are seen; fail otherwise.
-
-proc gdb_py_test_multiple { name args } {
-    global gdb_prompt
-    foreach {input result} $args {
-	if {[gdb_test_multiple $input "$name - $input" {
-	    -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" {
-		pass "$name - $input"
-	    }
-	}]} {
-	    return 1
-	}
-    }
-    return 0
-}
-
 # Return the result of python expression EXPR.  DEFAULT is returned if
 # there's an error.  TEST is the test message to use.  It can be
 # omitted, in which case a test message is built from EXP.  This is
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 7b243f5fff..5959a92d79 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1236,6 +1236,28 @@  proc gdb_test_multiple { command message args } {
     return $result
 }
 
+# Usage: gdb_test_multiline NAME INPUT RESULT {INPUT RESULT} ...
+# Run a test named NAME, consisting of multiple lines of input.
+# After each input line INPUT, search for result line RESULT.
+# Succeed if all results are seen; fail otherwise.
+
+proc gdb_test_multiline { name args } {
+    global gdb_prompt
+    set inputnr 0
+    foreach {input result} $args {
+	incr inputnr
+	if {[gdb_test_multiple $input "$name: input $inputnr: $input" {
+	    -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" {
+		pass $gdb_test_name
+	    }
+	}]} {
+	    return 1
+	}
+    }
+    return 0
+}
+
+
 # gdb_test COMMAND PATTERN MESSAGE QUESTION RESPONSE
 # Send a command to gdb; test the result.
 #