Introduce and use is_any_target

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'.
This commit is contained in:
Tom Tromey
2023-01-22 10:05:00 -07:00
parent 73c0619748
commit c7ccb47177
28 changed files with 39 additions and 110 deletions

View File

@@ -18,11 +18,8 @@
# Test UNsigned extension of the 32-bit inferior address on a 64-bit host. # Test UNsigned extension of the 32-bit inferior address on a 64-bit host.
# On native 32-bit host the test always PASSed. # On native 32-bit host the test always PASSed.
if { (![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_lp64_target] require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target
|| [istarget "*-*-openbsd*"] } then { require {!istarget "*-*-openbsd*"}
verbose "Skipping amd64->i386 address test."
return
}
if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] { if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] {
return -1 return -1

View File

@@ -15,10 +15,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
if {![istarget "aarch64*-*-*"] && ![istarget "arm*-*-*"]} { require {is_any_target "aarch64*-*-*" "arm*-*-*"}
verbose "Skipping ${gdb_test_file_name}."
return
}
require allow_float_test require allow_float_test

View File

@@ -19,10 +19,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 AVX tests."
return
}
require have_avx require have_avx

View File

@@ -19,10 +19,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 AVX512 tests."
return
}
standard_testfile standard_testfile

View File

@@ -21,10 +21,7 @@
# #define EM_X86_64 62 /* AMD x86-64 architecture */ # #define EM_X86_64 62 /* AMD x86-64 architecture */
# patch @0x12: 0x3E -> 0x03 # patch @0x12: 0x3E -> 0x03
if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { require {is_any_target "i?86-*-*" "x86_64-*-*"}
verbose "Skipping i386 biarch core test."
return
}
standard_testfile standard_testfile

View File

@@ -18,10 +18,7 @@
# Test stepping over permanent breakpoints on i386. # Test stepping over permanent breakpoints on i386.
if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { require {is_any_target "i?86-*-*" "x86_64-*-*"}
verbose "Skipping skip over permanent breakpoint on i386 tests."
return
}
standard_testfile standard_testfile

View File

@@ -19,10 +19,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} { require {is_any_target "x86_64-*-*" "i?86-*-*"}
verbose "Skipping i386 byte register tests."
return
}
standard_testfile i386-pseudo.c standard_testfile i386-pseudo.c

View File

@@ -19,9 +19,7 @@
# This test relies on being able to set 4 hardware watchpoints. Since # This test relies on being able to set 4 hardware watchpoints. Since
# that is not a valid assumption across most targets, and we're # that is not a valid assumption across most targets, and we're
# testing a x86 specific bug, skip everywhere else. # testing a x86 specific bug, skip everywhere else.
if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { require {is_any_target "i?86-*-*" "x86_64-*-*"}
return 0
}
standard_testfile standard_testfile

View File

@@ -18,10 +18,7 @@
# Test the x87 floating point information printout. # Test the x87 floating point information printout.
if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { require {is_any_target "i?86-*-*" "x86_64-*-*"}
verbose "Skipping i386 tests for x87 floating point support."
return
}
standard_testfile .S standard_testfile .S

View File

@@ -14,10 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target "i?86-*-*" "x86_64-*-*"}
untested "skipping x86 MPX tests."
return
}
standard_testfile standard_testfile

View File

@@ -16,10 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 MPX tests."
return
}
standard_testfile standard_testfile

View File

@@ -16,10 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target "i?86-*-*" "x86_64-*-*"}
verbose "Skipping x86 MPX tests."
return
}
standard_testfile standard_testfile

View File

@@ -22,10 +22,7 @@
# #
# Caveat: Setting the handle to nopass, ends up in a endless loop. # Caveat: Setting the handle to nopass, ends up in a endless loop.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 MPX tests."
return
}
standard_testfile standard_testfile

View File

@@ -15,17 +15,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 MPX tests."
return
}
standard_testfile standard_testfile
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 MPX tests."
return
}
require supports_mpx_check_pointer_bounds have_mpx require supports_mpx_check_pointer_bounds have_mpx

View File

@@ -18,10 +18,7 @@
# Test inserting breakpoints over permanent breakpoints on i386 and amd64. # Test inserting breakpoints over permanent breakpoints on i386 and amd64.
if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { require {is_any_target "i?86-*-*" "x86_64-*-*"}
verbose "Skipping i386 test for multi break at permanent breakpoint location."
return
}
standard_testfile .S standard_testfile .S

View File

@@ -15,10 +15,7 @@
standard_testfile standard_testfile
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
unsupported "skipping x86 PKEYS tests."
return
}
set default_pkru_re 0x0 set default_pkru_re 0x0
if { [istarget *-*-linux*] } { if { [istarget *-*-linux*] } {

View File

@@ -22,10 +22,7 @@
standard_testfile .c standard_testfile .c
set binfile ${binfile} set binfile ${binfile}
if { ![istarget x86_64-*-*] && ![istarget i?86-*-*] } { require {is_any_target x86_64-*-* i?86-*-*}
verbose "Skipping ${testfile}."
return
}
require supports_fcf_protection require supports_fcf_protection

View File

@@ -15,10 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { require {is_any_target "i?86-*-*" "x86_64-*-*"}
verbose "Skipping i386 unwinder tests."
return
}
standard_testfile standard_testfile

View File

@@ -19,10 +19,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { require {is_any_target i?86-*-* x86_64-*-*}
verbose "Skipping x86 SSE tests."
return
}
standard_testfile .c standard_testfile .c

View File

@@ -19,10 +19,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} { require {is_any_target "x86_64-*-*" "i?86-*-*"}
verbose "Skipping i386 word register tests."
return
}
standard_testfile i386-pseudo.c standard_testfile i386-pseudo.c

View File

@@ -18,11 +18,7 @@
# This file is part of the gdb testsuite. # This file is part of the gdb testsuite.
require {is_any_target s390-*-* s390x-*-*}
if { ![istarget s390-*-*] && ![istarget s390x-*-* ] } {
verbose "Skipping s390 TDB register tests."
return
}
standard_testfile .c standard_testfile .c

View File

@@ -15,10 +15,7 @@
# Test vector register access for s390 platforms. # Test vector register access for s390 platforms.
if { ![istarget s390-*-*] && ![istarget s390x-*-* ] } { require {is_any_target s390-*-* s390x-*-*}
verbose "Skipping s390 vector register tests."
return
}
standard_testfile .S standard_testfile .S

View File

@@ -18,11 +18,7 @@
# This file is based on corefile.exp which was written by Fred # This file is based on corefile.exp which was written by Fred
# Fish. (fnf@cygnus.com) # Fish. (fnf@cygnus.com)
if { ! [istarget "*-*-linux*"] && ! [istarget "*-*-solaris*"] } { require {is_any_target "*-*-linux*" "*-*-solaris*"}
verbose "Skipping auxv.exp because of lack of support."
return
}
standard_testfile .c standard_testfile .c

View File

@@ -23,9 +23,7 @@
# Until "catch fork" is implemented on other targets... # Until "catch fork" is implemented on other targets...
# #
if {![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"]} { require {is_any_target "*-*-linux*" "*-*-openbsd*"}
return
}
# Reusing foll-fork.c since it's a simple forking program. # Reusing foll-fork.c since it's a simple forking program.
standard_testfile foll-fork.c standard_testfile foll-fork.c

View File

@@ -18,9 +18,7 @@ load_lib gdb-python.exp
standard_testfile jit-reader-host.c standard_testfile jit-reader-host.c
if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) || ![is_lp64_target] } { require {is_any_target "i?86-*-*" "x86_64-*-*"} is_lp64_target
return -1;
}
require allow_shlib_tests isnative require allow_shlib_tests isnative

View 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 # This test also makes use of 'detach-on-fork' which is not supported
# on all platforms. # on all platforms.
if {![istarget "*-*-linux*"] && ![istarget "*-*-openbsd*"]} { require {is_any_target "*-*-linux*" "*-*-openbsd*"}
return
}
# And we need to be able to reconnect to gdbserver. # And we need to be able to reconnect to gdbserver.
set gdbserver_reconnect_p 1 set gdbserver_reconnect_p 1

View File

@@ -23,9 +23,7 @@ set cr "\[\r\n\]+"
# Only x86 and x86_64 targets are supported for now. # Only x86 and x86_64 targets are supported for now.
if { ![istarget "x86_64-*"] && ![istarget "i?86-*"] } { require {is_any_target "x86_64-*" "i?86-*"}
return
}
proc compile_stap_bin {exec_name {arg ""}} { proc compile_stap_bin {exec_name {arg ""}} {
global srcfile global srcfile

View File

@@ -4201,6 +4201,16 @@ proc gdb_is_target_native { } {
return [gdb_is_target_1 "native" ".*native \\(Native process\\).*" "$gdb_prompt $"] 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. # 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 # If the use_gdb_stub global has been set (it is set when the gdb process is