Use require can_spawn_for_attach
authorTom Tromey <tom@tromey.com>
Wed, 14 Dec 2022 17:05:03 +0000 (10:05 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 13 Jan 2023 20:18:56 +0000 (13:18 -0700)
This changes some tests to use "require can_spawn_for_attach".

22 files changed:
gdb/testsuite/gdb.base/attach-non-pgrp-leader.exp
gdb/testsuite/gdb.base/attach-pie-noexec.exp
gdb/testsuite/gdb.base/attach-twice.exp
gdb/testsuite/gdb.base/attach.exp
gdb/testsuite/gdb.base/dlmopen.exp
gdb/testsuite/gdb.base/interrupt-daemon-attach.exp
gdb/testsuite/gdb.base/jit-attach-pie.exp
gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp
gdb/testsuite/gdb.base/run-after-attach.exp
gdb/testsuite/gdb.base/solib-overlap.exp
gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
gdb/testsuite/gdb.mi/list-thread-groups-available.exp
gdb/testsuite/gdb.multi/attach-no-multi-process.exp
gdb/testsuite/gdb.multi/multi-attach.exp
gdb/testsuite/gdb.multi/multi-term-settings.exp
gdb/testsuite/gdb.python/py-sync-interp.exp
gdb/testsuite/gdb.server/attach-flag.exp
gdb/testsuite/gdb.server/ext-attach.exp
gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
gdb/testsuite/gdb.threads/attach-non-stop.exp
gdb/testsuite/gdb.threads/clone-attach-detach.exp
gdb/testsuite/gdb.threads/detach-step-over.exp

index e55765120815bedf737288f7efb5782a642dc6f9..c35ce882383a61e4577b2e68cb01b2aebcf0510e 100644 (file)
@@ -18,9 +18,7 @@
 # call any of setpgrp/setpgid/setsid to move itself to a new process
 # group.
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 
index f32fce2bddff53b87d829695f541ca6716e8c841..a949dab521fc28da88f060f7273b1b85c0c5fe11 100644 (file)
@@ -13,9 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile .c
 set executable ${testfile}
index e140657278cb9acc37ec2c05f61a9f26ee2e2b6e..faca8c02c5816607b8cb160c19447e61d23ff7c0 100644 (file)
@@ -13,9 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 set executable ${testfile}
index dc0af932024c56fd9d19d2094a9bf9088744300f..03214885082fcc1915bcd543bd11832671284ee5 100644 (file)
@@ -13,9 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile attach.c attach2.c attach3.c
 set binfile2 ${binfile}2
index 4bbe37eb39d64e09599ab5805219c4e4e75dd600..54a5eadee2d1dc26e0b9847e00635bf3cb54f6d6 100644 (file)
@@ -144,10 +144,7 @@ gdb_breakpoint $srcfile:$bp_main
 test_dlmopen
 
 # Try the same again when attaching after dlmopen().
-if { ![can_spawn_for_attach] } {
-    unsupported "target does not support attach"
-    return -1
-}
+require can_spawn_for_attach
 
 clean_restart $binfile
 
index b2411c9ab5977d88e276fadcd1a394816c974025..0448de1de775822514284d32e3870d1c606d89c0 100644 (file)
@@ -24,9 +24,7 @@ if [target_info exists gdb,nointerrupts] {
     return
 }
 
-if { ![can_spawn_for_attach] } {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 
index 6b2d4879eb8b2daa0fbcba10b3f507da9d6d4677..df92cb772d82ec958373938349ae87e9385415d5 100644 (file)
@@ -13,9 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile .c
 set executable ${testfile}
index e416586b20c41d0377e4bff463d6c730ff434bc9..f093736fcd708ea1d216e39523cfff67007abad8 100644 (file)
@@ -18,9 +18,7 @@
 # Test the basic operation of the "kill inferiors" and "detach inferiors"
 # commands.
 
-if ![can_spawn_for_attach] {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 set executable $testfile
index b3ae58b48e4037d2274fe09e7d42eb74b6178ad4..549275c27a3a534447e73c7cf761cf14d6679d8f 100644 (file)
@@ -16,9 +16,7 @@
 # Check that forking a process after a previous process was attached to unsets
 # attach_flag.  This is done indirectly by inspecting GDB's quit prompt.
 
-if ![can_spawn_for_attach] {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 set executable $testfile
index 084047b709f34d4b6ccf3c8167348bd72d28e7f4..2c0e6f872866573525d02cbb2a0ac128dc6fd00c 100644 (file)
 #   difference appears to be caused by prelink, adjusting expectations
 # In such case both disk libraries will be loaded at VMAs starting at zero.
 
-require !skip_shlib_tests
-
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require !skip_shlib_tests can_spawn_for_attach
 
 # Library file.
 set libname "solib-overlap-lib"
index e1a9c94d94cc261ee64f16480dd23f2425cc9597..e87204580728df845707bbe83d3570e759368e0b 100644 (file)
@@ -18,9 +18,7 @@
 
 require !skip_hw_watchpoint_tests
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 
index e97132487745c55864794e29e7b0a6d8e67d4327..646d74ed0a6c35e23fd87f9e3f923911bdc0e196 100644 (file)
@@ -35,9 +35,7 @@ if [mi_gdb_start] {
     return
 }
 
-if ![can_spawn_for_attach] {
-    return
-}
+require can_spawn_for_attach
 
 set string_re {(?:[^\\"]|\\.)*}
 
index f0a964363151baae95b6dec8eddf38eacd6a1278..882ab69e14dcf05741a49f3989b5d0a21c01e808 100644 (file)
@@ -26,9 +26,7 @@ if { [skip_gdbserver_tests] } {
     return 0
 }
 
-if {![can_spawn_for_attach]} {
-    return
-}
+require can_spawn_for_attach
 
 if {[build_executable "build" $testfile $srcfile {debug}] == -1} {
     return -1
index 1c99ac85d8e688cf70a18b2b1ad44b6701293889..81230a03dc7f8d9700c7f668a24e307c85afba0a 100644 (file)
@@ -19,9 +19,7 @@
 
 standard_testfile
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
     return -1
index a69ed5b76eb5ec17a27baf74986cc9a22b6c4742..a55bc9b435a5396cd66f12403d15ac92b1f1b974 100644 (file)
@@ -25,9 +25,7 @@
 
 standard_testfile
 
-if ![can_spawn_for_attach] {
-    return 0
-}
+require can_spawn_for_attach
 
 if [build_executable "failed to prepare" $testfile $srcfile {debug}] {
     return -1
index add962ff1df2f636fc15eb4ceef71d0dc906f679..408a165e64863cafd2901ea73211019460c40c39 100644 (file)
@@ -20,9 +20,7 @@
 
 standard_testfile
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 load_lib gdb-python.exp
 
index 5f9019df6a7c814a120285897638c9ba03bd3284..ea4c87ee07782d14e18788d5e04c8f2fb1977350 100644 (file)
@@ -25,9 +25,7 @@ if { [skip_gdbserver_tests] } {
     return 0
 }
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 # Start the test program, attach to it using gdbserver's --attach flag, connect
 # to it with GDB, check that what we see makes sense.
index 7a5221188d8824a759601bdf9c389f71a7b22b9f..62296d091fa0f963d419a30b9fa1717f95d2f0ef 100644 (file)
@@ -26,9 +26,7 @@ if { [skip_gdbserver_tests] } {
     return 0
 }
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
     return -1
index bf5fe08f093ed1d208133dd25dd4192f46e5ab23..1dcf04d8b5dff5f8a6ca3f33d920b0ce64c43e9c 100644 (file)
@@ -49,9 +49,7 @@ if {[bad_dejagnu]} {
     return 0
 }
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 
index 3c3f2fafaf31c6858da9abbb0d4866af80bcb719..478032e09a1219e4c29bacfd112c4106a0736c09 100644 (file)
@@ -19,9 +19,7 @@
 #  - maint target non-stop off/on
 #  - "attach" vs "attach &"
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 
index d9642051d17252f3e57ae7ba24ad7eb471ec7d1e..ac9b92d5f57db7bdb9ce6434648cd3356e49320f 100644 (file)
@@ -23,9 +23,7 @@ if ![istarget *-*-linux*] {
     return
 }
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile
 
index b71059229fc2b492f8f5dcced82b1f18988cf4c1..ed9dc1aab88dcc99e21066941ba31e31a404c76a 100644 (file)
@@ -48,9 +48,7 @@
 # a breakpoint, which has helped with exposing further corner case
 # bugs.
 
-if {![can_spawn_for_attach]} {
-    return 0
-}
+require can_spawn_for_attach
 
 standard_testfile