[v2,23/37] GDB: testsuite: Python: Don't return 0 from top-level (sed)

Message ID 20260429230432.60487-24-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 is purely the result of running:

$ sed -i 's/^    return -1/    return/' *.exp*

inside gdb/testsuite/gdb.python.  A couple of false positives weren't
included.
---
 gdb/testsuite/gdb.python/lib-types.exp              | 2 +-
 gdb/testsuite/gdb.python/py-as-string.exp           | 2 +-
 gdb/testsuite/gdb.python/py-block.exp               | 2 +-
 gdb/testsuite/gdb.python/py-caller-is.exp           | 2 +-
 gdb/testsuite/gdb.python/py-cmd.exp                 | 2 +-
 gdb/testsuite/gdb.python/py-commands-breakpoint.exp | 2 +-
 gdb/testsuite/gdb.python/py-connection.exp          | 2 +-
 gdb/testsuite/gdb.python/py-error.exp               | 2 +-
 gdb/testsuite/gdb.python/py-finish-breakpoint2.exp  | 2 +-
 gdb/testsuite/gdb.python/py-frame-inline.exp        | 2 +-
 gdb/testsuite/gdb.python/py-frame.exp               | 4 ++--
 gdb/testsuite/gdb.python/py-inferior.exp            | 2 +-
 gdb/testsuite/gdb.python/py-infthread.exp           | 2 +-
 gdb/testsuite/gdb.python/py-missing-objfile.exp     | 2 +-
 gdb/testsuite/gdb.python/py-objfile.exp             | 4 ++--
 gdb/testsuite/gdb.python/py-pending-frame-level.exp | 2 +-
 gdb/testsuite/gdb.python/py-rbreak.exp              | 2 +-
 gdb/testsuite/gdb.python/py-recurse-unwind.exp      | 2 +-
 gdb/testsuite/gdb.python/py-shared.exp              | 2 +-
 gdb/testsuite/gdb.python/py-strfns.exp              | 2 +-
 gdb/testsuite/gdb.python/py-symbol.exp              | 6 +++---
 gdb/testsuite/gdb.python/py-symtab.exp              | 2 +-
 gdb/testsuite/gdb.python/py-unwind-inline.exp       | 2 +-
 gdb/testsuite/gdb.python/py-unwind-user-regs.exp    | 2 +-
 gdb/testsuite/gdb.python/py-unwind.exp              | 2 +-
 gdb/testsuite/gdb.python/py-value.exp               | 2 +-
 gdb/testsuite/gdb.python/python.exp                 | 6 +++---
 27 files changed, 33 insertions(+), 33 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.python/lib-types.exp b/gdb/testsuite/gdb.python/lib-types.exp
index aa281c6443d5..d2e7d391a779 100644
--- a/gdb/testsuite/gdb.python/lib-types.exp
+++ b/gdb/testsuite/gdb.python/lib-types.exp
@@ -25,11 +25,11 @@  standard_testfile .cc
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test_no_output "python import gdb.types"
 
 # test get_basic_type const stripping
diff --git a/gdb/testsuite/gdb.python/py-as-string.exp b/gdb/testsuite/gdb.python/py-as-string.exp
index 3dc858db1ada..41cefbe0411f 100644
--- a/gdb/testsuite/gdb.python/py-as-string.exp
+++ b/gdb/testsuite/gdb.python/py-as-string.exp
@@ -25,11 +25,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 proc test_as_string { } {
     gdb_test "p \$_as_string(2)" "\"2\""
     gdb_test "p \$_as_string(enum_valid)" "\"ENUM_VALUE_B\""
diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp
index b0123c4d3b57..30983ac35f25 100644
--- a/gdb/testsuite/gdb.python/py-block.exp
+++ b/gdb/testsuite/gdb.python/py-block.exp
@@ -25,11 +25,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 global hex decimal
 gdb_breakpoint [gdb_get_line_number "Block break here."]
 gdb_continue_to_breakpoint "Block break here."
diff --git a/gdb/testsuite/gdb.python/py-caller-is.exp b/gdb/testsuite/gdb.python/py-caller-is.exp
index e195e42a8ca6..d9b826cb6a23 100644
--- a/gdb/testsuite/gdb.python/py-caller-is.exp
+++ b/gdb/testsuite/gdb.python/py-caller-is.exp
@@ -25,11 +25,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint "bottom_func"
 gdb_continue_to_breakpoint "bottom_func"
 
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index 766a594d2f49..0bda3cdc934c 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -25,11 +25,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Test a simple command.
 
 gdb_test_multiline "input simple command" \
diff --git a/gdb/testsuite/gdb.python/py-commands-breakpoint.exp b/gdb/testsuite/gdb.python/py-commands-breakpoint.exp
index 2b3842c816f6..1afb41c80ea2 100644
--- a/gdb/testsuite/gdb.python/py-commands-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-commands-breakpoint.exp
@@ -24,11 +24,11 @@  standard_testfile .c .py
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return
 }
 
 if { ![runto_main] } {
-    return 0
+    return
 }
 
 set host_python_file \
     [gdb_remote_download host $srcdir/$subdir/$srcfile2]
 
diff --git a/gdb/testsuite/gdb.python/py-connection.exp b/gdb/testsuite/gdb.python/py-connection.exp
index e520e91368aa..7f3b46eff797 100644
--- a/gdb/testsuite/gdb.python/py-connection.exp
+++ b/gdb/testsuite/gdb.python/py-connection.exp
@@ -27,11 +27,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 if { [target_info exists gdb_protocol] } {
     set connection_type "RemoteTargetConnection"
 } else {
diff --git a/gdb/testsuite/gdb.python/py-error.exp b/gdb/testsuite/gdb.python/py-error.exp
index 583e63571a4a..3285746a47ca 100644
--- a/gdb/testsuite/gdb.python/py-error.exp
+++ b/gdb/testsuite/gdb.python/py-error.exp
@@ -42,11 +42,11 @@  gdb_test_multiple $test $test {
 	set test2 ""
     }
 }
 
 if {$test2 == ""} {
-    return 0
+    return
 }
 
 set remote_python_file [gdb_remote_download host \
 			    ${srcdir}/${subdir}/${testfile}.py]
 
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
index d782c577cfc1..9fa3faa7b9f5 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
@@ -25,11 +25,11 @@  standard_testfile .cc
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set pyfile [gdb_remote_download host \
 		${srcdir}/${subdir}/${testfile}.py]
 
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp
index a44136990c02..c90aed09e677 100644
--- a/gdb/testsuite/gdb.python/py-frame-inline.exp
+++ b/gdb/testsuite/gdb.python/py-frame-inline.exp
@@ -22,11 +22,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "break-here"]
 gdb_continue_to_breakpoint "Block break here."
 
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
index 92a0ef3f7ebb..ca350cf03c2d 100644
--- a/gdb/testsuite/gdb.python/py-frame.exp
+++ b/gdb/testsuite/gdb.python/py-frame.exp
@@ -27,11 +27,11 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 }
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Block break here."]
 gdb_continue_to_breakpoint "Block break here."
 gdb_py_test_silent_cmd "python bf1 = gdb.selected_frame ()" "get frame" 0
@@ -208,11 +208,11 @@  gdb_exit
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Test if Frame.static_link works for a frame without debug info.
 gdb_test "python print(gdb.selected_frame().static_link())" "None" \
     "test Frame.static_link for a frame without debug info"
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 8479427f726a..f69ad8fc0d8d 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -60,11 +60,11 @@  gdb_test "python \
     "read memory without execution"
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # The most recently added inferior.
 set most_recent_inf 1
 
diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp
index 65ccc8f9a9e8..93022e8ade3b 100644
--- a/gdb/testsuite/gdb.python/py-infthread.exp
+++ b/gdb/testsuite/gdb.python/py-infthread.exp
@@ -38,11 +38,11 @@  gdb_test_multiline "install new_thread event handler" \
     "end" ""
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test "python print(seen_a_thread)" "True"
 
 # Test basic gdb.Inferior attributes and methods.
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.exp b/gdb/testsuite/gdb.python/py-missing-objfile.exp
index e5e086130b00..907bdec76f4b 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.exp
@@ -54,11 +54,11 @@  set remote_python_file \
 
 # Generate a core file.
 set corefile [core_find $binfile {}]
 if {$corefile == ""} {
     unsupported "core file not generated"
-    return 0
+    return
 }
 
 # Create a directory named DIRNAME for use as the
 # debug-file-directory.  Populate the directory with links (based on
 # the build-ids) to each file in the list FILES.
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 0127b82936cb..64c626029300 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -25,11 +25,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set python_error_text "Error occurred in Python.*"
 
 gdb_py_test_silent_cmd "python sym = gdb.lookup_symbol(\"some_var\")" \
@@ -118,11 +118,11 @@  gdb_test "python print(objfile.username)" "None" \
 if { [prepare_for_testing "failed to prepare" ${testfile}2 ${srcfile} {nodebug ldflags=-Wl,--strip-debug}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
     "Get no-debug objfile file" 1
 
diff --git a/gdb/testsuite/gdb.python/py-pending-frame-level.exp b/gdb/testsuite/gdb.python/py-pending-frame-level.exp
index 204c7c36c54b..0e10b8065d16 100644
--- a/gdb/testsuite/gdb.python/py-pending-frame-level.exp
+++ b/gdb/testsuite/gdb.python/py-pending-frame-level.exp
@@ -24,11 +24,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 
 gdb_breakpoint [gdb_get_line_number "Break here"]
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index eead513caeb2..ba02758ae798 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -25,11 +25,11 @@  standard_testfile py-rbreak.c py-rbreak-func2.c
 if {[prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } {
     return 1
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_test_no_output "nosharedlibrary"
 gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"\",minsyms=False)" \
     "get all function breakpoints" 0
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.exp b/gdb/testsuite/gdb.python/py-recurse-unwind.exp
index 4df47a6e8b4b..25cefc9b87ed 100644
--- a/gdb/testsuite/gdb.python/py-recurse-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-recurse-unwind.exp
@@ -38,11 +38,11 @@  gdb_test "source ${pyfile}" "Python script imported" \
 	 "import python scripts"
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 
 proc cont_and_backtrace { tst } {
 
diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp
index 0eef359d0b87..ff47270c0717 100644
--- a/gdb/testsuite/gdb.python/py-shared.exp
+++ b/gdb/testsuite/gdb.python/py-shared.exp
@@ -42,11 +42,11 @@  clean_restart $testfile
 gdb_load_shlib ${library}
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 runto [gdb_get_line_number "Break to end."]
 
 # Test gdb.solib_name
diff --git a/gdb/testsuite/gdb.python/py-strfns.exp b/gdb/testsuite/gdb.python/py-strfns.exp
index 539ba984db02..3a8610a971ed 100644
--- a/gdb/testsuite/gdb.python/py-strfns.exp
+++ b/gdb/testsuite/gdb.python/py-strfns.exp
@@ -25,11 +25,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 proc test_all_strfns { } {
     gdb_test "p \$_streq (str1, str2)" " = 1"
     gdb_test "p \$_streq (str1, str3)" " = 0"
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index 90e724ca0313..af187857176a 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -88,11 +88,11 @@  gdb_test "python print (gdb.lookup_static_symbol ('nonexistent') is None)" \
 
 gdb_test "python print (gdb.lookup_static_symbol ('qq') is None)" \
     "True" "lookup_static_symbol for global var"
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 global hex decimal
 
 gdb_breakpoint [gdb_get_line_number "Block break here."]
@@ -203,11 +203,11 @@  gdb_test "python print (gdb.lookup_global_symbol ('(anonymous namespace)::anon')
     "True" "anon is None"
 gdb_test "python print (gdb.lookup_static_symbol ('(anonymous namespace)::anon').value ())" \
     "10" "print value of anon"
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Break in class."]
 gdb_continue_to_breakpoint "Break in class."
 
@@ -231,11 +231,11 @@  gdb_test "python print (cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "t
 # Test is_valid when the objfile is unloaded.  This must be the last
 # test as it unloads the object file in GDB.
 # Start with a fresh gdb.
 clean_restart ${::testfile}
 if {![runto_main]} {
-    return 0
+    return
 }
 
 gdb_breakpoint [gdb_get_line_number "Break at end."]
 gdb_continue_to_breakpoint "Break at end for symbol validity" ".*Break at end.*"
 gdb_py_test_silent_cmd "python a = gdb.lookup_symbol(\'a\')" "Get variable a" 0
diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp
index 786bdc75fc4d..b5dd0c26988e 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -25,11 +25,11 @@  standard_testfile py-symbol.c
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set debug_types [debug_types]
 
 global hex decimal
diff --git a/gdb/testsuite/gdb.python/py-unwind-inline.exp b/gdb/testsuite/gdb.python/py-unwind-inline.exp
index ef9b00eccc8b..d7d82913f61a 100644
--- a/gdb/testsuite/gdb.python/py-unwind-inline.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-inline.exp
@@ -27,11 +27,11 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
     return
 }
 
 # The following tests require execution.
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 
 gdb_breakpoint "foo"
diff --git a/gdb/testsuite/gdb.python/py-unwind-user-regs.exp b/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
index c594bf74ceef..248996c51615 100644
--- a/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
@@ -45,11 +45,11 @@  standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 
 gdb_breakpoint [gdb_get_line_number "Break here"]
diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
index 058caaf1efc7..af864dceedfd 100644
--- a/gdb/testsuite/gdb.python/py-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-unwind.exp
@@ -35,11 +35,11 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} "debug $fla
 require is_x86_64_m64_target
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Check for the corrupt backtrace.
 proc check_for_broken_backtrace {testname} {
     gdb_test_sequence "where" $testname {
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index 3746a6cbc0bc..4337928ddef4 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -819,11 +819,11 @@  test_float_conversion
 test_add_to_history
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 test_unavailable
 test_value_in_inferior
 test_value_from_buffer
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index f2f32019e4c2..7d3cd299bc8c 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -208,11 +208,11 @@  gdb_expect {
 clean_restart ${testfile}
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set lineno [gdb_get_line_number "Break to end."]
 runto $lineno
 
@@ -422,11 +422,11 @@  gdb_test_multiple "set extended-prompt some param \\p{python print-stack} " \
 clean_restart ${testfile}
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # print-stack settings
 gdb_test "show python print-stack" \
     "The mode of Python stack printing on error is \"message\".*" \
@@ -477,11 +477,11 @@  gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \
 clean_restart ${testfile}
 
 # The following tests require execution.
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 runto [gdb_get_line_number "Break at func2 call site."]
 
 gdb_py_test_silent_cmd "python line = gdb.selected_frame().find_sal().line" "Get line number of func2 call site" 1