]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Introduce and use is_any_target
authorTom Tromey <tom@tromey.com>
Sun, 22 Jan 2023 17:05:00 +0000 (10:05 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 25 Jan 2023 16:02:11 +0000 (09:02 -0700)
A few tests work on two different targets that can't be detected with
a single call to istarget -- that proc only accepts globs, not regular
expressions.

This patch introduces a new is_any_target proc and then converts these
tests to use it in a 'require'.

28 files changed:
gdb/testsuite/gdb.arch/amd64-i386-address.exp
gdb/testsuite/gdb.arch/arm-neon.exp
gdb/testsuite/gdb.arch/i386-avx.exp
gdb/testsuite/gdb.arch/i386-avx512.exp
gdb/testsuite/gdb.arch/i386-biarch-core.exp
gdb/testsuite/gdb.arch/i386-bp_permanent.exp
gdb/testsuite/gdb.arch/i386-byte.exp
gdb/testsuite/gdb.arch/i386-dr3-watch.exp
gdb/testsuite/gdb.arch/i386-float.exp
gdb/testsuite/gdb.arch/i386-mpx-call.exp
gdb/testsuite/gdb.arch/i386-mpx-map.exp
gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
gdb/testsuite/gdb.arch/i386-mpx.exp
gdb/testsuite/gdb.arch/i386-permbkpt.exp
gdb/testsuite/gdb.arch/i386-pkru.exp
gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
gdb/testsuite/gdb.arch/i386-signal.exp
gdb/testsuite/gdb.arch/i386-sse.exp
gdb/testsuite/gdb.arch/i386-word.exp
gdb/testsuite/gdb.arch/s390-tdbregs.exp
gdb/testsuite/gdb.arch/s390-vregs.exp
gdb/testsuite/gdb.base/auxv.exp
gdb/testsuite/gdb.base/catch-fork-static.exp
gdb/testsuite/gdb.base/jit-reader.exp
gdb/testsuite/gdb.server/extended-remote-restart.exp
gdb/testsuite/gdb.trace/stap-trace.exp
gdb/testsuite/lib/gdb.exp

index 7f7863a1d576c933db8e767e5991079e35b36998..8224d8d821898f073c8e8a83765777d379cabf58 100644 (file)
 # Test UNsigned extension of the 32-bit inferior address on a 64-bit host.
 # On native 32-bit host the test always PASSed.
 
-if { (![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_lp64_target]
-     || [istarget "*-*-openbsd*"] } then {
-    verbose "Skipping amd64->i386 address test."
-    return
-}
+require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target
+require {!istarget "*-*-openbsd*"}
 
 if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] {
     return -1
index 54720e891e3fd7b4b09b955761b1676083a4daba..a34dbc3b0512ce1e90c36bdf1d9ff70cbf9148cd 100644 (file)
 
 # This file is part of the gdb testsuite.
 
-if {![istarget "aarch64*-*-*"] && ![istarget "arm*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {is_any_target "aarch64*-*-*" "arm*-*-*"}
 
 require allow_float_test
 
index 72523c5d47b0f4a5d675381d3e697da8aaf6b303..ad2cb5852d1570b2cb992a9eeed125df3f3d15ef 100644 (file)
 # This file is part of the gdb testsuite.
 
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 AVX tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 require have_avx
 
index b62cb9cf6bbc3d3b7f260e6216f8cfedc7e61299..0c50591dcbe2f549e66b760e51e749cfb5e83d96 100644 (file)
 # This file is part of the gdb testsuite.
 
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 AVX512 tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 standard_testfile
 
index a36153cfe272459ce7ff3f53195bbb7777f23324..f70b0922212731b18fda189f24ad9579f61306a0 100644 (file)
 # #define EM_X86_64       62              /* AMD x86-64 architecture */
 # patch @0x12: 0x3E -> 0x03
 
-if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    verbose "Skipping i386 biarch core test."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
index 9f8b8e63409c747de82b5918305ac8943889ed63..d75ea64814895e5c1817683b150129aac0c02730 100644 (file)
 
 # Test stepping over permanent breakpoints on i386.
 
-if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    verbose "Skipping skip over permanent breakpoint on i386 tests."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
index 02a2380cd3f62ac9f8485ed2a2e1732385df69f6..07f292c3313589c58e852005486d8e8e246da2b3 100644 (file)
 # This file is part of the gdb testsuite.
 
 
-if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} {
-    verbose "Skipping i386 byte register tests."
-    return
-}
+require {is_any_target "x86_64-*-*" "i?86-*-*"}
 
 standard_testfile i386-pseudo.c
 
index 2356c3c3e78d80f684c9353baf44d8704539c52f..b5c43f2db351b2a039489966db33721899e8a65e 100644 (file)
@@ -19,9 +19,7 @@
 # This test relies on being able to set 4 hardware watchpoints.  Since
 # that is not a valid assumption across most targets, and we're
 # testing a x86 specific bug, skip everywhere else.
-if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    return 0
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
index dd613444fdcdaba702b5effc8f55eef0e128865c..3ae6f849f34040f2a1d65ae74bc3378206e88dfe 100644 (file)
 
 # Test the x87 floating point information printout.
 
-if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    verbose "Skipping i386 tests for x87 floating point support."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile .S
 
index 8371546a8f991931f12273daae074caf49964c92..95b68cd30dfd1330dfef08a4c2ead033e525eb6a 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    untested "skipping x86 MPX tests."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
index d95adef7d8b44d8305de1d87ddf416b88d4efb10..6d95fd89171a054e13f74a8645edd5a629b62e8b 100644 (file)
 # 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 { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 MPX tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 standard_testfile
 
index eaac31edbd337a03dbb8ada97c63fc7caac73bd3..84c04763257cd6374a3d72babde0c61cfa0dc340 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 MPX tests."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
index a33c4f526f7555e18012e9b800f231d6840baa92..5f9568357b4734bd7c944c170f8c2e7727b558ba 100644 (file)
 #
 # Caveat: Setting the handle to nopass, ends up in a endless loop.
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 MPX tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 standard_testfile
 
index 5534ec9aa81c5cb2eb7103e8ba4a9a6d1e1be5be..156c3ae7831fc0dbf0ddf8748a3fcea19cf82392 100644 (file)
 # 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 { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 MPX tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 standard_testfile
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 MPX tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 require supports_mpx_check_pointer_bounds have_mpx
 
index f2a3966690354aa9cf6a3ae0f1fec97fc2bf5866..42171093ba74b04b94e2fa285e582513f35ca35c 100644 (file)
 
 # Test inserting breakpoints over permanent breakpoints on i386 and amd64.
 
-if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    verbose "Skipping i386 test for multi break at permanent breakpoint location."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile .S
 
index 5d2b1a24a1537d880ea449c997334417d2aa57e6..90d8c1d9d4c26702ea78eae90d5abd516d207b23 100644 (file)
 
 standard_testfile
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    unsupported "skipping x86 PKEYS tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 set default_pkru_re 0x0
 if { [istarget *-*-linux*] } {
index 06cb2b1b8189e32494a159a1f96853d4c671229b..256f6fde9e52c72006b02a28d4df6af83a00b51c 100644 (file)
 standard_testfile .c
 set binfile ${binfile}
 
-if { ![istarget x86_64-*-*] && ![istarget i?86-*-*] } {
-    verbose "Skipping ${testfile}."
-    return
-}
+require {is_any_target x86_64-*-* i?86-*-*}
 
 require supports_fcf_protection
 
index 9806970b2456acbd4f27dcd15b378d417b3daa12..17c6467076c14fe73d8a5c7e25b7297e1cfce3b3 100644 (file)
 # 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 {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    verbose "Skipping i386 unwinder tests."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
index a178247e066fa5a64d7db573a95de08181893ce6..6df98ec1219bde1abc1c1144c33529dd447f6c57 100644 (file)
 # This file is part of the gdb testsuite.
 
 
-if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 SSE tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 standard_testfile .c
 
index 4e1e634bb12654adeea63fdee9f2cca13fa4a370..42d4446c4d04e7ebd3c67424023aa99500435b41 100644 (file)
 # This file is part of the gdb testsuite.
 
 
-if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} {
-    verbose "Skipping i386 word register tests."
-    return
-}
+require {is_any_target "x86_64-*-*" "i?86-*-*"}
 
 standard_testfile i386-pseudo.c
 
index 4908fff5619cfc3413da741b823c8ed7c0a40fe7..7d1ea0bdedd8fa4ac016d96d2a62d3a54f3db196 100644 (file)
 
 # This file is part of the gdb testsuite.
 
-
-if { ![istarget s390-*-*] && ![istarget s390x-*-* ] } {
-    verbose "Skipping s390 TDB register tests."
-    return
-}
+require {is_any_target s390-*-* s390x-*-*}
 
 standard_testfile .c
 
index b1f8eed6701867e7b03759f3afe9476120360875..21f468f8472d92c12a4d6cd23f517343ec045f9b 100644 (file)
 
 # Test vector register access for s390 platforms.
 
-if { ![istarget s390-*-*] && ![istarget s390x-*-* ] } {
-    verbose "Skipping s390 vector register tests."
-    return
-}
+require {is_any_target s390-*-* s390x-*-*}
 
 standard_testfile .S
 
index 3529d55261db10b2c65332360b46c239fd8673d1..89242b6f4321ff6464ba39455fde60fbf6ffdd07 100644 (file)
 # This file is based on corefile.exp which was written by Fred
 # Fish. (fnf@cygnus.com)
 
-if { ! [istarget "*-*-linux*"] && ! [istarget "*-*-solaris*"] } {
-    verbose "Skipping auxv.exp because of lack of support."
-    return
-}
-
+require {is_any_target "*-*-linux*" "*-*-solaris*"}
 
 standard_testfile .c
 
index a59c6808f8509019ed718c9cce9215fec1d4c0aa..2844843638f36766b07786d6f88dbe222561a733 100644 (file)
@@ -23,9 +23,7 @@
 
 # Until "catch fork" is implemented on other targets...
 #
-if {![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"]} {
-    return
-}
+require {is_any_target "*-*-linux*" "*-*-openbsd*"}
 
 # Reusing foll-fork.c since it's a simple forking program.
 standard_testfile foll-fork.c
index 399cb67dcce8d1a7519a1b20b9847ca3256ea4cb..d603ad975ff5bf58dbd1c4c807bccf594941f5bd 100644 (file)
@@ -18,9 +18,7 @@ load_lib gdb-python.exp
 
 standard_testfile jit-reader-host.c
 
-if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) || ![is_lp64_target] } {
-    return -1;
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"} is_lp64_target
 
 require allow_shlib_tests isnative
 
index 6622b526125fe7891257ea8947db5c7d64934a1e..8d3b384f348b656aab6d48cc8668e9f522e14ab1 100644 (file)
@@ -35,9 +35,7 @@ if {[target_info gdb_protocol] != "extended-remote"} {
 
 # This test also makes use of 'detach-on-fork' which is not supported
 # on all platforms.
-if {![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"]} {
-    return
-}
+require {is_any_target "*-*-linux*" "*-*-openbsd*"}
 
 # And we need to be able to reconnect to gdbserver.
 set gdbserver_reconnect_p 1
index b40c7bc9e0d6c7e9c42c0bb36423965e860572f4..34122737d20f8e5bb439ce4ad8bf8f72cd0fbe38 100644 (file)
@@ -23,9 +23,7 @@ set cr "\[\r\n\]+"
 
 # Only x86 and x86_64 targets are supported for now.
 
-if { ![istarget "x86_64-*"] && ![istarget "i?86-*"] } {
-    return
-}
+require {is_any_target "x86_64-*" "i?86-*"}
 
 proc compile_stap_bin {exec_name {arg ""}} {
     global srcfile
index 4b8337dbc1cf17b427043614b4f7594a673b9da6..d30340e1df145b4aa17ad5d9cbeb7b29a9249a47 100644 (file)
@@ -4201,6 +4201,16 @@ proc gdb_is_target_native { } {
     return [gdb_is_target_1 "native" ".*native \\(Native process\\).*" "$gdb_prompt $"]
 }
 
+# Like istarget, but checks a list of targets.
+proc is_any_target {args} {
+    foreach targ $args {
+       if {[istarget $targ]} {
+           return 1
+       }
+    }
+    return 0
+}
+
 # Return the effective value of use_gdb_stub.
 #
 # If the use_gdb_stub global has been set (it is set when the gdb process is