[v2,24/37] GDB: testsuite: Python: Don't return value from top-level (manual)

Message ID 20260429230432.60487-25-thiago.bauermann@linaro.org
State New
Headers
Series GDB: testsuite: Fix top-level returns |

Commit Message

Thiago Jung Bauermann April 29, 2026, 11:04 p.m. UTC
  This patch manually changes "return -1" and "return 0" statements that
weren't caught by the sed command.

These return statements fall into one of these criteria:

- misaligned line, which is then fixed by this patch;
- return at top level but inside block such as save_vars,
  with_test_prefix, foreach, gdb_test_multiple.

In a couple of cases the whole if block was in a single line:

  if { condition } { return -1 }

In those cases the formatting was changed to the multi-line style we
tend to use.
---
 gdb/testsuite/gdb.python/py-arch-reg-groups.exp  |  2 +-
 gdb/testsuite/gdb.python/py-arch-reg-names.exp   |  2 +-
 gdb/testsuite/gdb.python/py-arch.exp             |  2 +-
 .../gdb.python/py-auto-load-chaining.exp         | 10 +++++-----
 gdb/testsuite/gdb.python/py-disasm.exp.tcl       |  6 +++---
 gdb/testsuite/gdb.python/py-events.exp           |  2 +-
 gdb/testsuite/gdb.python/py-explore-cc.exp       |  2 +-
 gdb/testsuite/gdb.python/py-explore.exp          |  2 +-
 .../gdb.python/py-finish-breakpoint.exp          | 16 ++++++++--------
 gdb/testsuite/gdb.python/py-format-address.exp   |  4 ++--
 gdb/testsuite/gdb.python/py-framefilter-addr.exp |  2 +-
 .../gdb.python/py-label-symbol-value.exp         |  2 +-
 gdb/testsuite/gdb.python/py-linetable-empty.exp  |  2 +-
 gdb/testsuite/gdb.python/py-pp-registration.exp  |  6 +++---
 gdb/testsuite/gdb.python/py-prompt.exp           |  2 +-
 gdb/testsuite/gdb.python/py-read-memory-leak.exp |  2 +-
 gdb/testsuite/gdb.python/py-record-btrace.exp    |  4 +++-
 gdb/testsuite/gdb.python/py-record-full.exp      |  4 +++-
 .../gdb.python/py-rvalue-ref-value-cc.exp        |  2 +-
 gdb/testsuite/gdb.python/py-value-cc.exp         |  2 +-
 gdb/testsuite/gdb.python/py-value.exp            |  2 +-
 gdb/testsuite/gdb.python/py-xmethods.exp         |  2 +-
 gdb/testsuite/gdb.python/python.exp              |  2 +-
 23 files changed, 43 insertions(+), 39 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp
index 6630143f0373..7a1025841f46 100644
--- a/gdb/testsuite/gdb.python/py-arch-reg-groups.exp
+++ b/gdb/testsuite/gdb.python/py-arch-reg-groups.exp
@@ -22,11 +22,11 @@  standard_testfile py-arch.c
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 # First, use 'maint print reggroups' to get a list of all register
 # groups.
 set groups {}
diff --git a/gdb/testsuite/gdb.python/py-arch-reg-names.exp b/gdb/testsuite/gdb.python/py-arch-reg-names.exp
index 7bbb171e13e1..6807098fbda8 100644
--- a/gdb/testsuite/gdb.python/py-arch-reg-names.exp
+++ b/gdb/testsuite/gdb.python/py-arch-reg-names.exp
@@ -22,11 +22,11 @@  standard_testfile py-arch.c
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 # First, use 'info registers' to get a list of register names.
 set regs {}
 gdb_test_multiple "info registers general" "info registers general" {
diff --git a/gdb/testsuite/gdb.python/py-arch.exp b/gdb/testsuite/gdb.python/py-arch.exp
index a2ac6ad4bfa1..b1dd81a05839 100644
--- a/gdb/testsuite/gdb.python/py-arch.exp
+++ b/gdb/testsuite/gdb.python/py-arch.exp
@@ -19,11 +19,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 # Test python/15461.  Invalid architectures should not trigger an
 # internal GDB assert.
 gdb_py_test_silent_cmd "python empty = gdb.Architecture()" "get empty arch" 0
diff --git a/gdb/testsuite/gdb.python/py-auto-load-chaining.exp b/gdb/testsuite/gdb.python/py-auto-load-chaining.exp
index 7a92ff0fac71..bd0d1c4b11ef 100644
--- a/gdb/testsuite/gdb.python/py-auto-load-chaining.exp
+++ b/gdb/testsuite/gdb.python/py-auto-load-chaining.exp
@@ -27,17 +27,17 @@  standard_testfile .c -f1.c -f2.c
 set f1_o [standard_output_file ${gdb_test_file_name}-f1.o]
 set f2_o [standard_output_file ${gdb_test_file_name}-f2.o]
 
 # Now build the object files.
 if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" ${f1_o} object {}] != ""} {
-  untested "failed to compile object file f1.o"
-  return -1
+    untested "failed to compile object file f1.o"
+    return
 }
 
 if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" ${f2_o} object {}] != ""} {
-  untested "failed to compile object file f2.o"
-  return -1
+    untested "failed to compile object file f2.o"
+    return
 }
 
 # Copy the two Python scripts to where the tests are being run.
 set remote_python_file [gdb_remote_download host \
 			    ${srcdir}/${subdir}/${testfile}-f1.o-gdb.py]
@@ -48,11 +48,11 @@  set remote_python_file [gdb_remote_download host \
 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 set safe_path [standard_output_file ""]
 gdb_test_no_output "set auto-load safe-path ${safe_path}" \
     "set auto-load safe-path"
diff --git a/gdb/testsuite/gdb.python/py-disasm.exp.tcl b/gdb/testsuite/gdb.python/py-disasm.exp.tcl
index e4391fa59ced..6382005eee52 100644
--- a/gdb/testsuite/gdb.python/py-disasm.exp.tcl
+++ b/gdb/testsuite/gdb.python/py-disasm.exp.tcl
@@ -28,24 +28,24 @@  if { $kind == "obj" } {
     set binfile [standard_output_file $testfile]
 
     if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile object \
 	      "debug"] != "" } {
 	untested "failed to compile object file $testfile"
-	return -1
+	return
     }
 
     clean_restart $testfile
 
 } else {
 
     if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
-	return -1
+	return
     }
 
     if { ![runto_main] } {
 	fail "can't run to main"
-	return 0
+	return
     }
 
 }
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/py-disasm.py]
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 1177dd54e482..16a290c31c29 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -313,11 +313,11 @@  with_test_prefix "gdb exiting: normal" {
 with_test_prefix "gdb exiting: error" {
     clean_restart ${testfile}
 
     if {![runto_main]} {
 	fail "cannot run to main."
-	return 0
+	return
     }
 
     gdb_test_no_output "source ${pyfile}" "load python file"
     gdb_test "test-exiting-event error" "GDB exiting event registered\\."
     gdb_test "test-events" "Event testers registered\\."
diff --git a/gdb/testsuite/gdb.python/py-explore-cc.exp b/gdb/testsuite/gdb.python/py-explore-cc.exp
index 772886b931f9..70b1beeada0a 100644
--- a/gdb/testsuite/gdb.python/py-explore-cc.exp
+++ b/gdb/testsuite/gdb.python/py-explore-cc.exp
@@ -35,11 +35,11 @@  set B_desc "'B' is a struct/class with the following fields:.*\
 A = <Enter 0 to explore this base class of type 'A'>.*\
 i = <Enter 1 to explore this field of type 'int'>.*\
 c = <Enter 2 to explore this field of type 'char'>.*"
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Break here."]
 gdb_continue_to_breakpoint "Break here" ".*Break here.*"
 
diff --git a/gdb/testsuite/gdb.python/py-explore.exp b/gdb/testsuite/gdb.python/py-explore.exp
index 276148da8f10..debe30315356 100644
--- a/gdb/testsuite/gdb.python/py-explore.exp
+++ b/gdb/testsuite/gdb.python/py-explore.exp
@@ -74,11 +74,11 @@  proc scalar_value { value_name value } {
 }
 
 set SS_fields [field_values {a = 10} {d = 100[.].*}]
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Break here."]
 gdb_continue_to_breakpoint "Break here" ".*Break here.*"
 
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 043416c724cc..960a44f412a6 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -44,11 +44,11 @@  clean_restart ${testfile}
 with_test_prefix "normal conditions" {
     clean_restart ${testfile}
     gdb_load_shlib ${lib_sl}
 
     if {![runto_main]} {
-	return 0
+	return
     }
 
     set python_file [gdb_remote_download host \
 			 ${srcdir}/${subdir}/${testfile}.py]
 
@@ -96,11 +96,11 @@  with_test_prefix "return to inlined function" {
 
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
     if {![runto_main]} {
-	return 0
+	return
     }
 
     gdb_breakpoint "increase_2"
     gdb_test "continue" "Breakpoint .*at.*" "continue to the function to finish"
 
@@ -122,11 +122,11 @@  with_test_prefix "no debug symbol" {
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
     set cond_line [gdb_get_line_number "Condition Break."]
 
     if {![runto_main]} {
-	return 0
+	return
     }
 
     gdb_test "print do_nothing" "no debug info.*" "ensure that shared lib has no debug info"
     gdb_breakpoint "do_nothing" {temporary}
     gdb_test "continue" "Temporary breakpoint .*in \\.?do_nothing.*" \
@@ -177,11 +177,11 @@  with_test_prefix "finish in dummy frame" {
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
 
     if {![runto_main]} {
-	return 0
+	return
     }
 
     gdb_test "break ${cond_line} if test_1(i,8)" "Breakpoint .* at .*" \
 	"set a conditional BP"
     gdb_test "python TestBreakpoint()" "TestBreakpoint init" \
@@ -204,11 +204,11 @@  with_test_prefix "finish in normal frame" {
 
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
     if {![runto_main]} {
-	return 0
+	return
     }
 
     gdb_test "break ${cond_line} if test(i,8)" \
 	"Breakpoint .* at .*" "set conditional BP"
     gdb_test "python TestBreakpoint()" "TestBreakpoint init" "set BP in condition"
@@ -233,11 +233,11 @@  with_test_prefix "explicit inferior function call" {
 
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
     if {![runto_main]} {
-	return 0
+	return
     }
 
     # return address in dummy frame
 
     gdb_test "python TestExplicitBreakpoint('increase_1')" "Breakpoint.*at.*" \
@@ -260,11 +260,11 @@  with_test_prefix "explicit inferior function call" {
 # Test FinishBreakpoint when inferior exits
 #
 
 with_test_prefix "inferior exit" {
     if {![runto "test_exec_exit"]} {
-	return 0
+	return
     }
 
     gdb_test_no_output "set var self_exec = 0" "switch to exit() test"
     gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exit()"
     gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exit"
@@ -274,11 +274,11 @@  with_test_prefix "inferior exit" {
 # Test FinishBreakpoint when inferior execs
 #
 
 with_test_prefix "inferior exec" {
     if {![runto "test_exec_exit"]} {
-	return 0
+	return
     }
 
     gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the 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-format-address.exp b/gdb/testsuite/gdb.python/py-format-address.exp
index dda012234b77..9f32686dfd3d 100644
--- a/gdb/testsuite/gdb.python/py-format-address.exp
+++ b/gdb/testsuite/gdb.python/py-format-address.exp
@@ -21,11 +21,11 @@  foreach func_name { foo bar } {
     if {[build_executable "build binary with ${func_name} function" \
 	     "$testfile-${func_name}" $srcfile \
 	     [list debug \
 		  nopie \
 		  additional_flags=-DFUNCTION_NAME=${func_name}]] == -1} {
-	return -1
+	return
     }
 }
 
 set testfile_foo $testfile-foo
 set testfile_bar $testfile-bar
@@ -33,11 +33,11 @@  set binary_foo [standard_output_file $testfile_foo]
 set binary_bar [standard_output_file $testfile_bar]
 
 clean_restart $testfile_foo
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 # Check the gdb.format_address method when using the default values
 # for the program space and architecture (these will be selected based
 # on the current inferior).
diff --git a/gdb/testsuite/gdb.python/py-framefilter-addr.exp b/gdb/testsuite/gdb.python/py-framefilter-addr.exp
index 3c0436ce1972..1c85a8afcb36 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-addr.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-addr.exp
@@ -26,11 +26,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 # Run to our test breakpoint.
 gdb_breakpoint [gdb_get_line_number "Break here"]
 gdb_continue_to_breakpoint "run to test breakpoint"
diff --git a/gdb/testsuite/gdb.python/py-label-symbol-value.exp b/gdb/testsuite/gdb.python/py-label-symbol-value.exp
index c97ae72ec58d..bd3f9ee689e9 100644
--- a/gdb/testsuite/gdb.python/py-label-symbol-value.exp
+++ b/gdb/testsuite/gdb.python/py-label-symbol-value.exp
@@ -23,11 +23,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 # Use Python to print the value of the 'some_label' symbol.
 gdb_test "python frame = gdb.selected_frame()"
 gdb_test "python frame_pc = frame.pc()"
diff --git a/gdb/testsuite/gdb.python/py-linetable-empty.exp b/gdb/testsuite/gdb.python/py-linetable-empty.exp
index 651fe9b6dbf3..3244d88a9367 100644
--- a/gdb/testsuite/gdb.python/py-linetable-empty.exp
+++ b/gdb/testsuite/gdb.python/py-linetable-empty.exp
@@ -41,11 +41,11 @@  if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile $asm_file] {nodebug}] } {
     return
 }
 
 if {![runto_main]} {
-	return -1
+    return
 }
 
 gdb_test "python print(gdb.selected_frame().function().symtab.fullname())" \
 	"py-linetable-empty.c" "Test main has symtab"
 
diff --git a/gdb/testsuite/gdb.python/py-pp-registration.exp b/gdb/testsuite/gdb.python/py-pp-registration.exp
index 3d974b2120b6..ab84a0f7f905 100644
--- a/gdb/testsuite/gdb.python/py-pp-registration.exp
+++ b/gdb/testsuite/gdb.python/py-pp-registration.exp
@@ -62,11 +62,11 @@  proc test_printers { s_prefix } {
 
 # Test registration with verbose off.
 
 with_test_prefix "verbose off" {
     if {![prepare_test]} {
-	return -1
+	return
     }
 
     gdb_test_no_output "set verbose off"
 
     gdb_test_no_output "py gdb.printing.register_pretty_printer(gdb, lookup_function_lookup_test)"
@@ -77,11 +77,11 @@  with_test_prefix "verbose off" {
 
 # Test registration with verbose on.
 
 with_test_prefix "verbose on" {
     if {![prepare_test]} {
-	return -1
+	return
     }
 
     gdb_test_no_output "set verbose on"
 
     gdb_test "py gdb.printing.register_pretty_printer(gdb, lookup_function_lookup_test)" \
@@ -94,11 +94,11 @@  with_test_prefix "verbose on" {
 
 # Exercise the "replace" argument to register_pretty_printer.
 
 with_test_prefix "replace" {
     if {![prepare_test]} {
-	return -1
+	return
     }
 
     gdb_test_no_output "py gdb.printing.register_pretty_printer(gdb, lookup_function_lookup_test)"
     gdb_test_no_output "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer1)"
     gdb_test "py gdb.printing.register_pretty_printer(progspace, my_pretty_printer2, replace=False)" \
diff --git a/gdb/testsuite/gdb.python/py-prompt.exp b/gdb/testsuite/gdb.python/py-prompt.exp
index cc149ae62303..96ea52843442 100644
--- a/gdb/testsuite/gdb.python/py-prompt.exp
+++ b/gdb/testsuite/gdb.python/py-prompt.exp
@@ -68,11 +68,11 @@  save_vars { INTERNAL_GDBFLAGS GDBFLAGS } {
 	    "prompt_hook argument is default prompt. 2"
 	gdb_exit
     }
 
     if {![can_spawn_for_attach]} {
-	return 0
+	return
     }
 
     set test_spawn_id [spawn_wait_for_attach $binfile]
     set testpid [spawn_id_get_pid $test_spawn_id]
 
diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.exp b/gdb/testsuite/gdb.python/py-read-memory-leak.exp
index 58343126e67c..1a361c990533 100644
--- a/gdb/testsuite/gdb.python/py-read-memory-leak.exp
+++ b/gdb/testsuite/gdb.python/py-read-memory-leak.exp
@@ -25,10 +25,10 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 gdb_py_run_memory_leak_test ${srcdir}/${subdir}/${testfile}.py \
     "buffers returned by read_memory() deallocates correctly"
diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp
index 4e324e71fc09..d5a647ebc59a 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace.exp
+++ b/gdb/testsuite/gdb.python/py-record-btrace.exp
@@ -21,11 +21,13 @@  require allow_btrace_tests allow_python_tests
 
 load_lib gdb-python.exp
 
 standard_testfile
 
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 }
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
+    return
+}
 
 if {![runto_main]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.python/py-record-full.exp b/gdb/testsuite/gdb.python/py-record-full.exp
index 95640770e9a5..37bf07a64bfd 100644
--- a/gdb/testsuite/gdb.python/py-record-full.exp
+++ b/gdb/testsuite/gdb.python/py-record-full.exp
@@ -21,11 +21,13 @@  require supports_process_record allow_python_tests
 
 load_lib gdb-python.exp
 
 standard_testfile
 
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 }
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
+    return
+}
 
 if {![runto_main]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp b/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp
index 576fd5a85d3d..5e2b769cf71f 100644
--- a/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp
+++ b/gdb/testsuite/gdb.python/py-rvalue-ref-value-cc.exp
@@ -25,11 +25,11 @@  if {[prepare_for_testing $testfile.exp $testfile $srcfile \
     {debug c++ additional_flags="-std=c++11"}]} {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Break here."]
 gdb_continue_to_breakpoint "Break here" ".*Break here.*"
 
diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp
index 1d65d617e30d..fa0cd066978b 100644
--- a/gdb/testsuite/gdb.python/py-value-cc.exp
+++ b/gdb/testsuite/gdb.python/py-value-cc.exp
@@ -23,11 +23,11 @@  standard_testfile .cc
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Break here."]
 gdb_continue_to_breakpoint "Break here" ".*Break here.*"
 
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index 4337928ddef4..ba3b1376ff5a 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -838,11 +838,11 @@  test_value_after_death
 
 test_subscript_regression "${binfile}" "c"
 
 if {[allow_cplus_tests]} {
     if { [build_inferior "${binfile}-cxx" "c++"] < 0 } {
-	return -1
+	return
     }
     with_test_prefix "c++" {
 	test_subscript_regression "${binfile}-cxx" "c++"
     }
 }
diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp
index 52f0a7597093..b8a8b46c1db3 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.exp
+++ b/gdb/testsuite/gdb.python/py-xmethods.exp
@@ -25,11 +25,11 @@  standard_testfile py-xmethods.cc
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return
 }
 
 if {![runto_main]} {
-   return -1
+    return
 }
 
 set xmethods_script [gdb_remote_download host \
 		     ${srcdir}/${subdir}/${testfile}.py]
 
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 7d3cd299bc8c..27dbc555a17b 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -46,11 +46,11 @@  gdb_test_multiple "python print (23)" "verify python support" {
       gdb_test_multiline "multi-line python command" \
 	  "python" "" \
 	  "print (23)" "" \
 	  "end" "not supported.*"
 
-      return -1
+      return
     }
     -re "$gdb_prompt $"	{}
 }
 
 gdb_test_multiline "multi-line python command" \