public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Use 'require' even more
@ 2023-01-24 23:02 Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 1/9] Convert skip_altivec_tests to allow form Tom Tromey
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches

Here's v2 of the series to use 'require' even more.

v1 was here:

    https://sourceware.org/pipermail/gdb-patches/2023-January/196054.html

I think this addresses all the review comments.

Tom



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/9] Convert skip_altivec_tests to allow form
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-25 10:54   ` Pedro Alves
  2023-01-24 23:02 ` [PATCH v2 2/9] Rename skip_float_test " Tom Tromey
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This renames skip_altivec_tests to allow_altivec_tests and updates its
users to use require.
---
 gdb/testsuite/gdb.arch/altivec-abi.exp        |  3 +-
 gdb/testsuite/gdb.arch/altivec-regs.exp       |  4 +--
 .../gdb.arch/powerpc-vector-regs.exp          |  3 +-
 gdb/testsuite/lib/gdb.exp                     | 28 +++++++++----------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 28d0ae1fff9..1c3cda451e4 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -21,7 +21,8 @@
 # This file uses altivec-abi.c for input.
 #
 
-if {![istarget "powerpc*"] || [skip_altivec_tests]} {
+require allow_altivec_tests
+if {![istarget "powerpc*"]} {
     verbose "Skipping altivec abi tests."
     return
 }
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 21e019122ce..8a7fd2e502c 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -21,8 +21,8 @@
 # This file uses altivec-regs.c for input.
 #
 
-
-if {![istarget "powerpc*"] || [skip_altivec_tests]} {
+require allow_altivec_tests
+if {![istarget "powerpc*"]} {
     verbose "Skipping altivec register tests."
     return
 }
diff --git a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
index f9d404b4835..bbcf45a555d 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
@@ -20,7 +20,8 @@
 # 0 to 31 in each of the 16 bytes of each corresponding register, and
 # we then check if gdb sees these same values.
 
-if {![istarget "powerpc*"] || [skip_altivec_tests]} {
+require allow_altivec_tests
+if {![istarget "powerpc*"]} {
     verbose "Skipping PowerPC vector register tests."
     return
 }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3188f2de615..4346c858579 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3457,18 +3457,18 @@ proc support_displaced_stepping {} {
     return 0
 }
 
-# Run a test on the target to see if it supports vmx hardware.  Return 0 if so, 
-# 1 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
+# Run a test on the target to see if it supports vmx hardware.  Return 1 if so, 
+# 0 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
 
-gdb_caching_proc skip_altivec_tests {
+gdb_caching_proc allow_altivec_tests {
     global srcdir subdir gdb_prompt inferior_exited_re
 
-    set me "skip_altivec_tests"
+    set me "allow_altivec_tests"
 
     # Some simulators are known to not support VMX instructions.
     if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
-        verbose "$me:  target known to not support VMX, returning 1" 2
-        return 1
+	verbose "$me:  target known to not support VMX, returning 0" 2
+	return 0
     }
 
     # Make sure we have a compiler that understands altivec.
@@ -3477,8 +3477,8 @@ gdb_caching_proc skip_altivec_tests {
     } elseif [test_compiler_info xlc*] {
         set compile_flags "additional_flags=-qaltivec"
     } else {
-        verbose "Could not compile with altivec support, returning 1" 2
-        return 1
+	verbose "Could not compile with altivec support, returning 0" 2
+	return 0
     }
 
     # Compile a test program containing VMX instructions.
@@ -3493,7 +3493,7 @@ gdb_caching_proc skip_altivec_tests {
 	}
     }
     if {![gdb_simple_compile $me $src executable $compile_flags]} {
-        return 1
+	return 0
     }
 
     # Compilation succeeded so now run it via gdb.
@@ -3506,22 +3506,22 @@ gdb_caching_proc skip_altivec_tests {
     gdb_expect {
         -re ".*Illegal instruction.*${gdb_prompt} $" {
             verbose -log "\n$me altivec hardware not detected" 
-            set skip_vmx_tests 1
+	    set allow_vmx_tests 0
         }
         -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: altivec hardware detected" 
-            set skip_vmx_tests 0
+	    set allow_vmx_tests 1
         }
         default {
           warning "\n$me: default case taken"
-            set skip_vmx_tests 1
+	    set allow_vmx_tests 0
         }
     }
     gdb_exit
     remote_file build delete $obj
 
-    verbose "$me:  returning $skip_vmx_tests" 2
-    return $skip_vmx_tests
+    verbose "$me:  returning $allow_vmx_tests" 2
+    return $allow_vmx_tests
 }
 
 # Run a test on the power target to see if it supports ISA 3.1 instructions
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 2/9] Rename skip_float_test to allow form
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 1/9] Convert skip_altivec_tests to allow form Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 3/9] Rename skip_power_isa_3_1_tests " Tom Tromey
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This renames skip_float_test to allow_float_test and updates its users
to use require.
---
 gdb/testsuite/gdb.arch/arm-neon.exp           |  5 +----
 gdb/testsuite/gdb.arch/riscv-info-fcsr.exp    |  5 +----
 gdb/testsuite/gdb.base/call-ar-st.exp         | 20 +++++++++----------
 gdb/testsuite/gdb.base/call-rt-st.exp         |  6 +++---
 gdb/testsuite/gdb.base/call-sc.exp            |  4 ++--
 gdb/testsuite/gdb.base/callfuncs.exp          |  8 ++++----
 gdb/testsuite/gdb.base/finish.exp             |  6 +++---
 gdb/testsuite/gdb.base/funcargs.exp           |  6 +++---
 .../gdb.base/infcall-nested-structs.exp.tcl   |  2 +-
 gdb/testsuite/gdb.base/return-nodebug.exp     |  4 ++--
 gdb/testsuite/gdb.base/return.exp             |  6 +++---
 gdb/testsuite/gdb.base/return2.exp            |  6 +++---
 gdb/testsuite/gdb.base/structs.exp            |  8 ++++----
 gdb/testsuite/gdb.base/varargs.exp            |  4 ++--
 gdb/testsuite/lib/gdb.exp                     | 18 ++++++++---------
 15 files changed, 51 insertions(+), 57 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/arm-neon.exp b/gdb/testsuite/gdb.arch/arm-neon.exp
index 409623e8c6c..54720e891e3 100644
--- a/gdb/testsuite/gdb.arch/arm-neon.exp
+++ b/gdb/testsuite/gdb.arch/arm-neon.exp
@@ -20,10 +20,7 @@ if {![istarget "aarch64*-*-*"] && ![istarget "arm*-*-*"]} {
     return
 }
 
-if { [gdb_skip_float_test] } {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require allow_float_test
 
 standard_testfile
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug quiet}] } {
diff --git a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
index 94b7279336f..d8e88994266 100644
--- a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
+++ b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
@@ -21,10 +21,7 @@ if {![istarget "riscv*-*-*"]} {
     return
 }
 
-if { [gdb_skip_float_test] } {
-    untested "no floating point support"
-    return
-}
+require allow_float_test
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index c86a5c38a78..37b817ae279 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -29,7 +29,7 @@ if [target_info exists gdb,cannot_call_functions] {
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
@@ -61,7 +61,7 @@ gdb_test continue \
 
 
 #call print_double_array(double_array)
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "print print_double_array(double_array)"] } {
 
     gdb_test_stdio "print print_double_array(double_array)" \
@@ -122,7 +122,7 @@ gdb_test "tbreak $stop_line" \
 	"Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
 	"tbreakpoint at tbreak3"
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "continuing to tbreak3"] } {
 
     gdb_test_stdio "continue" \
@@ -175,7 +175,7 @@ if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
 }
 
 #call print_double_array(array_d)
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "print print_double_array(array_d)"] } {
 
     gdb_test_stdio "print print_double_array(array_d)" \
@@ -193,7 +193,7 @@ gdb_test "tbreak $stop_line" \
 "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
 "tbreakpoint at tbreak4"
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "continuing to tbreak4"] } {
 
     gdb_test_stdio "continue" \
@@ -312,7 +312,7 @@ if ![gdb_skip_stdio_test "continuing to tbreak6"] {
 #                         *flags, *flags_combo, *three_char, *five_char, 
 #                         *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "print print_small_structs(...)"] } {
     gdb_test_stdio "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)" \
 	[multi_line \
@@ -375,7 +375,7 @@ gdb_test "print compute_with_small_structs(20)" \
 #call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 
 #                       3.14, -5678.12345, -0.11111111, 216.97065)
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "print print_ten_doubles(...)"]} {
     gdb_test_stdio "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)" \
 	[multi_line \
@@ -403,7 +403,7 @@ gdb_test "tbreak print_long_arg_list" \
 # The short match case below handles cases where a buffer
 # overflows or something, and expect can't deal with the full
 # line.  Perhaps a more elegant solution exists... -sts 1999-08-17
-if {!$skip_float_test} {
+if {$allow_float_test} {
     gdb_test_multiple "continue" "step into print_long_arg_list" {
 	-re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:$stop_line\[\r\n\]+$stop_line\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
 	    pass "step into print_long_arg_list"
@@ -425,7 +425,7 @@ set ws "\[\n\r\t \]+"
 #                         flags_combo, three_char, five_char, int_char_combo, 
 #                         d1, d2, d3, f1, f2, f3)
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } {
 
     # On 32-bit SPARC, some of the args are passed by ref, others by
@@ -526,7 +526,7 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*$srcfile:$stop_line\[\r\n\t \
 
 #call print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
     ![gdb_skip_stdio_test "print print_long_arg_list"] } {
 
     gdb_test_stdio "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)" \
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 14d5014e9cf..16ecb9288b7 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -35,7 +35,7 @@ if [target_info exists gdb,cannot_call_functions] {
     return
 }
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 # Start with a fresh gdb.
 
@@ -120,14 +120,14 @@ if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
 	".\[0-9\]+ = \\{next_index = \\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\}, values = \\{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\\}, head = 0\\}"
 }
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
         ![gdb_skip_stdio_test "print print_one_double(*d1)"] } {
     print_struct_call "print_one_double(*d1)" \
 	".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+" \
 	".\[0-9\]+ = \\{double1 = 1\\.111\[0-9\]*\\}"
 }
 
-if {!$skip_float_test && \
+if {$allow_float_test && \
         ![gdb_skip_stdio_test "print print_two_floats(*f3)"] } {
     print_struct_call "print_two_floats(*f3)" \
 	".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+" \
diff --git a/gdb/testsuite/gdb.base/call-sc.exp b/gdb/testsuite/gdb.base/call-sc.exp
index 3d4ac06dab1..dc78308d42e 100644
--- a/gdb/testsuite/gdb.base/call-sc.exp
+++ b/gdb/testsuite/gdb.base/call-sc.exp
@@ -29,7 +29,7 @@ if [target_info exists gdb,cannot_call_functions] {
 
 standard_testfile .c
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 # Compile a variant of scalars.c using TYPE to specify the type of the
 # parameter and return-type.  Run the compiled program up to "main".
@@ -425,7 +425,7 @@ test tl
 # Approx size: 8, 16, ...
 test tll
 
-if {!$skip_float_test} {
+if {$allow_float_test} {
     # Approx size: 4, 8, ...
     test tf
 
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index df67c772e41..9bbf108ac0e 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -32,7 +32,7 @@ if [target_info exists gdb,cannot_call_functions] {
     return
 }
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 # FIXME:  Before calling this proc, we should probably verify that
 # we can call inferior functions and get a valid integral value
@@ -42,7 +42,7 @@ set skip_float_test [gdb_skip_float_test]
 # (computed in the inferior) is 1 for true and 0 for false.
 
 proc do_function_calls {prototypes} {
-    global gdb_prompt skip_float_test
+    global gdb_prompt allow_float_test
 
     # We need to up this because this can be really slow on some boards.
     set timeout 60
@@ -75,7 +75,7 @@ proc do_function_calls {prototypes} {
     gdb_test "p t_long_values(789,long_val2)" " = 1"
     gdb_test "p t_long_values(long_val1,-321)" " = 1"
 
-    if {!$skip_float_test} {
+    if {$allow_float_test} {
 	gdb_test "p t_float_values(0.0,0.0)" " = 0"
 
 	# These next four tests fail on the mn10300.
@@ -217,7 +217,7 @@ proc do_function_calls {prototypes} {
     gdb_test "p t_structs_l(struct_val1)" "= 51" \
 	"call inferior func with struct - returns long"
 
-    if {!$skip_float_test} {
+    if {$allow_float_test} {
 	gdb_test "p t_structs_f(struct_val1)" "= 2.12.*" \
 	    "call inferior func with struct - returns float"
 	gdb_test "p t_structs_d(struct_val1)" "= 9.87.*" \
diff --git a/gdb/testsuite/gdb.base/finish.exp b/gdb/testsuite/gdb.base/finish.exp
index 9e6961b4016..fa0fb8ba3bb 100644
--- a/gdb/testsuite/gdb.base/finish.exp
+++ b/gdb/testsuite/gdb.base/finish.exp
@@ -15,7 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 # re-use the program from the "return2" test.
 if { [prepare_for_testing "failed to prepare" finish return2.c] } {
@@ -100,7 +100,7 @@ proc finish_no_print {} {
 }
 
 proc finish_tests { } {
-    global gdb_prompt skip_float_test
+    global gdb_prompt allow_float_test
 
     if {![runto_main]} {
 	return -1
@@ -112,7 +112,7 @@ proc finish_tests { } {
     finish_1 "int"
     finish_1 "long"
     finish_1 "long_long"
-    if {!$skip_float_test} {
+    if {$allow_float_test} {
 	finish_1 "float"
 	finish_1 "double"
     }
diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp
index 3edc082fafa..860d411685d 100644
--- a/gdb/testsuite/gdb.base/funcargs.exp
+++ b/gdb/testsuite/gdb.base/funcargs.exp
@@ -25,7 +25,7 @@ if [support_complex_tests] {
     lappend compile_flags "additional_flags=-DTEST_COMPLEX"
 }
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile $compile_flags]} {
     return -1
@@ -1078,7 +1078,7 @@ gdb_test_no_output "set print frame-arguments all"
 
 integral_args
 unsigned_integral_args
-if {!$skip_float_test} {
+if {$allow_float_test} {
   float_and_integral_args
 }
 
@@ -1088,7 +1088,7 @@ if [support_complex_tests] {
 
     complex_integral_args
 
-    if {!$skip_float_test} {
+    if {$allow_float_test} {
 	complex_float_integral_args
     }
 }
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
index 95411077e81..d9d2fa519d2 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
@@ -167,7 +167,7 @@ if [support_complex_tests] {
     }
 }
 
-if ![gdb_skip_float_test] {
+if {[allow_float_test]} {
     foreach ta $float_types {
 	start_gdb_and_run_tests $lang $ta
     }
diff --git a/gdb/testsuite/gdb.base/return-nodebug.exp b/gdb/testsuite/gdb.base/return-nodebug.exp
index 3c09e0512fb..daee0b8e3fe 100644
--- a/gdb/testsuite/gdb.base/return-nodebug.exp
+++ b/gdb/testsuite/gdb.base/return-nodebug.exp
@@ -13,7 +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/>.
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 proc do_test {type} {
     set typenospace [string map {{ } -} $type]
@@ -49,7 +49,7 @@ proc do_test {type} {
 }
 
 foreach type {{signed char} {short} {int} {long} {long long} {float} {double}} {
-    if { $skip_float_test && ($type == "float" || $type == "double") } {
+    if { !$allow_float_test && ($type == "float" || $type == "double") } {
 	continue
     }
     set typenospace_dash \
diff --git a/gdb/testsuite/gdb.base/return.exp b/gdb/testsuite/gdb.base/return.exp
index 11e1923d660..fb4096e71e6 100644
--- a/gdb/testsuite/gdb.base/return.exp
+++ b/gdb/testsuite/gdb.base/return.exp
@@ -19,10 +19,10 @@ if { [prepare_for_testing "failed to prepare" "return"] } {
     return -1
 }
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 proc return_tests { } {
-    global gdb_prompt skip_float_test
+    global gdb_prompt allow_float_test
 
 
     if {![runto func1]} { return 0 }
@@ -90,7 +90,7 @@ proc return_tests { } {
     # is not xfailed.
 
     setup_xfail "sparc-*-solaris2.3*" "sparc-*-solaris2.4*" "m6811-*-*"
-    if {!$skip_float_test} {
+    if {$allow_float_test} {
 	gdb_test "p tmp3" ".* = 5.*" \
 	    "correct value returned double test (known problem with sparc solaris)"
     }
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index a65f2ac20fe..6361a6a9dd5 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -23,7 +23,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 proc return_1 { type } {
     global gdb_prompt
@@ -79,7 +79,7 @@ proc return_void { } {
 }
 
 proc return2_tests { } {
-    global gdb_prompt skip_float_test
+    global gdb_prompt allow_float_test
 
     if {![runto_main]} {
 	return -1
@@ -93,7 +93,7 @@ proc return2_tests { } {
     if {![istarget "m6811-*-*"] && ![istarget "h8300*-*"]} {
         return_1 "long_long"
     }
-    if {!$skip_float_test} {
+    if {$allow_float_test} {
 	return_1 "float"
 	if {![istarget "m6811-*-*"]} {
 	    return_1 "double"
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index ca6e80e8287..31b58cf8bdf 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -29,7 +29,7 @@ standard_testfile .c
 # Regex matching any value of `char' type like: a = 65 'A'
 set anychar_re {-?[0-9]{1,3} '(.|\\([0-7]{3}|[a-z]|\\|'))'}
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 # Compile a variant of structs.c using TYPES to specify the type of
 # the first N struct elements (the remaining elements take the type of
@@ -539,7 +539,7 @@ test { tl } {1 3} {1 2}
 # Approx size: 8, 16, ...
 test { tll } {1 2} {1}
 
-if { !$skip_float_test } {
+if { $allow_float_test } {
     # Approx size: 4, 8, ...
     test { tf } {1 3} {1 2}
 
@@ -562,7 +562,7 @@ test { tl tc } {2 6} {2}
 # Approx size: 8+1=9, 10, ...
 test { tll tc } {2} {}
 
-if { !$skip_float_test } {
+if { $allow_float_test } {
     # Approx size: 4+1=5, 6, ...
     test { tf tc } {2 6} {2}
 
@@ -585,7 +585,7 @@ test { tc tl } {2 4} {2}
 # Approx size: (1+7)+8=16, 24, ...
 test { tc tll } {2} {}
 
-if { !$skip_float_test } {
+if { $allow_float_test } {
     # Approx size: (1+3)+4=8, 12, ...
     test { tc tf } {2 4} {}
 
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index cca7d6ae5cd..f205a715f39 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -31,7 +31,7 @@
 
 standard_testfile .c
 
-set skip_float_test [gdb_skip_float_test]
+set allow_float_test [allow_float_test]
 
 set additional_flags {debug}
 if [support_complex_tests] {
@@ -81,7 +81,7 @@ gdb_test_stdio "print find_max2(3,1,2,3)" \
     ".\[0-9\]+ = 3" \
     "print find_max2(3,1,2,3)"
 
-if {!$skip_float_test} {
+if {$allow_float_test} {
     gdb_test_stdio "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" \
 	"find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+" \
 	".\[0-9\]+ = 17" \
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4346c858579..2c53ebe7774 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3167,7 +3167,7 @@ proc with_read1_timeout_factor { factor body } {
 
 gdb_caching_proc support_complex_tests {
 
-    if { [gdb_skip_float_test] } {
+    if { ![allow_float_test] } {
 	# If floating point is not supported, _Complex is not
 	# supported.
 	return 0
@@ -6846,13 +6846,13 @@ proc exec_is_pie { executable } {
     return 0
 }
 
-# Return true if a test should be skipped due to lack of floating
+# Return false if a test should be skipped due to lack of floating
 # point support or GDB can't fetch the contents from floating point
 # registers.
 
-gdb_caching_proc gdb_skip_float_test {
+gdb_caching_proc allow_float_test {
     if [target_info exists gdb,skip_float_tests] {
-	return 1
+	return 0
     }
 
     # There is an ARM kernel ptrace bug that hardware VFP registers
@@ -6901,13 +6901,13 @@ gdb_caching_proc gdb_skip_float_test {
 
 	if {![string match "" $lines]} {
 	    verbose "testfile compilation failed, returning 1" 2
-	    return 0
+	    return 1
 	}
 
 	# No error message, compilation succeeded so now run it via gdb.
 	# Run the test up to 5 times to detect whether ptrace can
 	# correctly update VFP registers or not.
-	set skip_vfp_test 0
+	set allow_vfp_test 1
 	for {set i 0} {$i < 5} {incr i} {
 	    global gdb_prompt srcdir subdir
 
@@ -6931,7 +6931,7 @@ gdb_caching_proc gdb_skip_float_test {
 		-re "exited normally.*$gdb_prompt $" {
 		    # However, the exit code is 0.  That means something
 		    # wrong in setting VFP registers.
-		    set skip_vfp_test 1
+		    set allow_vfp_test 0
 		    break
 		}
 	    }
@@ -6940,9 +6940,9 @@ gdb_caching_proc gdb_skip_float_test {
 	gdb_exit
 	remote_file build delete $exe
 
-	return $skip_vfp_test
+	return $allow_vfp_test
     }
-    return 0
+    return 1
 }
 
 # Print a message and return true if a test should be skipped
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 3/9] Rename skip_power_isa_3_1_tests to allow form
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 1/9] Convert skip_altivec_tests to allow form Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 2/9] Rename skip_float_test " Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 4/9] Rename skip_vsx_tests " Tom Tromey
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This renames skip_power_isa_3_1_tests to allow_power_isa_3_1_tests and
updates its users to use require.
---
 gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp |  3 ++-
 .../gdb.reverse/ppc_record_test_isa_3_1.exp    |  3 ++-
 gdb/testsuite/lib/gdb.exp                      | 18 +++++++++---------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
index a1aacb05070..1ad3ea8bde4 100644
--- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
@@ -16,10 +16,11 @@
 # Test to see if gdb is properly single stepping over the
 # displaced plxv instruction.
 
-if { ![istarget powerpc*-*] || [skip_power_isa_3_1_tests] } {
+if { ![istarget powerpc*-*] } {
     verbose "Skipping powerpc ISA 3.1 plxv test."
     return
 }
+require allow_power_isa_3_1_tests
 
 set retval 0
 
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
index f6bf4857fdf..7a291aaa49d 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
@@ -37,10 +37,11 @@ standard_testfile
 set gen_src record_test_isa_3_1.c
 set executable record_test_isa_3_1
 
-if {![istarget "powerpc*"] || [skip_power_isa_3_1_tests]}  {
+if {![istarget "powerpc*"]}  {
     verbose "Skipping PowerPC ISA 3.1 instruction record_test."
     return
 }
+require allow_power_isa_3_1_tests
 
 set options [list additional_flags=-mcpu=power10 debug]
 if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2c53ebe7774..5425ae74cb9 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3525,10 +3525,10 @@ gdb_caching_proc allow_altivec_tests {
 }
 
 # Run a test on the power target to see if it supports ISA 3.1 instructions
-gdb_caching_proc skip_power_isa_3_1_tests {
+gdb_caching_proc allow_power_isa_3_1_tests {
     global srcdir subdir gdb_prompt inferior_exited_re
 
-    set me "skip_power_isa_3_1_tests"
+    set me "allow_power_isa_3_1_tests"
 
     # Compile a test program containing ISA 3.1 instructions.
     set src {
@@ -3540,7 +3540,7 @@ gdb_caching_proc skip_power_isa_3_1_tests {
 	}
 
     if {![gdb_simple_compile $me $src executable ]} {
-        return 1
+	return 0
     }
 
     # No error message, compilation succeeded so now run it via gdb.
@@ -3553,22 +3553,22 @@ gdb_caching_proc skip_power_isa_3_1_tests {
     gdb_expect {
         -re ".*Illegal instruction.*${gdb_prompt} $" {
             verbose -log "\n$me Power ISA 3.1 hardware not detected"
-            set skip_power_isa_3_1_tests 1
+	    set allow_power_isa_3_1_tests 0
         }
         -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: Power ISA 3.1 hardware detected"
-            set skip_power_isa_3_1_tests 0
+	    set allow_power_isa_3_1_tests 1
         }
         default {
-          warning "\n$me: default case taken"
-            set skip_power_isa_3_1_tests 1
+	    warning "\n$me: default case taken"
+	    set allow_power_isa_3_1_tests 0
         }
     }
     gdb_exit
     remote_file build delete $obj
 
-    verbose "$me:  returning $skip_power_isa_3_1_tests" 2
-    return $skip_power_isa_3_1_tests
+    verbose "$me:  returning $allow_power_isa_3_1_tests" 2
+    return $allow_power_isa_3_1_tests
 }
 
 # Run a test on the target to see if it supports vmx hardware.  Return 0 if so,
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 4/9] Rename skip_vsx_tests to allow form
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
                   ` (2 preceding siblings ...)
  2023-01-24 23:02 ` [PATCH v2 3/9] Rename skip_power_isa_3_1_tests " Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 5/9] Use require with istarget Tom Tromey
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This renames skip_vsx_tests to allow_vsx_tests and updates it users to
use require.
---
 gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp |  3 ++-
 gdb/testsuite/gdb.arch/vsx-regs.exp          |  3 ++-
 gdb/testsuite/gdb.arch/vsx-vsr-float28.exp   |  4 +--
 gdb/testsuite/lib/gdb.exp                    | 28 ++++++++++----------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp b/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
index 69789998ea2..b80afa5b7f2 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
@@ -18,10 +18,11 @@
 # This test checks that generating and loading a core file preserves
 # the correct VSX register state.
 
-if {![istarget "powerpc*-*-linux*"] || [skip_vsx_tests]} {
+if {![istarget "powerpc*-*-linux*"]} {
     verbose "Skipping PowerPC test for corefiles with VSX registers."
     return
 }
+require allow_vsx_tests
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index b3a120e8188..e7476f1015b 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -19,10 +19,11 @@
 #
 
 
-if {![istarget "powerpc*"] || [skip_vsx_tests]} {
+if {![istarget "powerpc*"]} {
     verbose "Skipping vsx register tests."
     return
 }
+require allow_vsx_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
index 296a7420f61..04915719615 100644
--- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
+++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
@@ -18,11 +18,11 @@
 # Test the vsr registers print values in float128 bit format.
 #
 
-
-if {![istarget "powerpc*"] || [skip_vsx_tests]} {
+if {![istarget "powerpc*"]} {
     verbose "Skipping vsr float128 field tests."
     return
 }
+require allow_vsx_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 5425ae74cb9..4b8337dbc1c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3571,19 +3571,19 @@ gdb_caching_proc allow_power_isa_3_1_tests {
     return $allow_power_isa_3_1_tests
 }
 
-# Run a test on the target to see if it supports vmx hardware.  Return 0 if so,
-# 1 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
+# Run a test on the target to see if it supports vmx hardware.  Return 1 if so,
+# 0 if it does not.  Based on 'check_vmx_hw_available' from the GCC testsuite.
 
-gdb_caching_proc skip_vsx_tests {
+gdb_caching_proc allow_vsx_tests {
     global srcdir subdir gdb_prompt inferior_exited_re
 
-    set me "skip_vsx_tests"
+    set me "allow_vsx_tests"
 
     # Some simulators are known to not support Altivec instructions, so
     # they won't support VSX instructions as well.
     if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
-        verbose "$me:  target known to not support VSX, returning 1" 2
-        return 1
+	verbose "$me:  target known to not support VSX, returning 0" 2
+	return 0
     }
 
     # Make sure we have a compiler that understands altivec.
@@ -3592,8 +3592,8 @@ gdb_caching_proc skip_vsx_tests {
     } elseif [test_compiler_info xlc*] {
         set compile_flags "additional_flags=-qasm=gcc"
     } else {
-        verbose "Could not compile with vsx support, returning 1" 2
-        return 1
+	verbose "Could not compile with vsx support, returning 0" 2
+	return 0
     }
 
     # Compile a test program containing VSX instructions.
@@ -3609,7 +3609,7 @@ gdb_caching_proc skip_vsx_tests {
 	}
     }
     if {![gdb_simple_compile $me $src executable $compile_flags]} {
-        return 1
+	return 0
     }
 
     # No error message, compilation succeeded so now run it via gdb.
@@ -3622,22 +3622,22 @@ gdb_caching_proc skip_vsx_tests {
     gdb_expect {
         -re ".*Illegal instruction.*${gdb_prompt} $" {
             verbose -log "\n$me VSX hardware not detected"
-            set skip_vsx_tests 1
+	    set allow_vsx_tests 0
         }
         -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: VSX hardware detected"
-            set skip_vsx_tests 0
+	    set allow_vsx_tests 1
         }
         default {
           warning "\n$me: default case taken"
-            set skip_vsx_tests 1
+	    set allow_vsx_tests 0
         }
     }
     gdb_exit
     remote_file build delete $obj
 
-    verbose "$me:  returning $skip_vsx_tests" 2
-    return $skip_vsx_tests
+    verbose "$me:  returning $allow_vsx_tests" 2
+    return $allow_vsx_tests
 }
 
 # Run a test on the target to see if it supports TSX hardware.  Return 1 if so,
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 5/9] Use require with istarget
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
                   ` (3 preceding siblings ...)
  2023-01-24 23:02 ` [PATCH v2 4/9] Rename skip_vsx_tests " Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 6/9] Introduce and use is_any_target Tom Tromey
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes many tests to use require when checking 'istarget'.  A
few of these conversions were already done in earlier patches.

No change was needed to 'require' to make this work, due to the way it
is written.  I think the result looks pretty clear, and it has the
bonus of helping to ensure that the reason that a test is skipped is
always logged.
---
 gdb/testsuite/gdb.arch/aix-sighandle.exp         |  4 +---
 gdb/testsuite/gdb.arch/alpha-step.exp            |  5 +----
 gdb/testsuite/gdb.arch/altivec-abi.exp           |  5 +----
 gdb/testsuite/gdb.arch/altivec-regs.exp          |  5 +----
 .../gdb.arch/amd64-break-on-asm-line.exp         |  4 +---
 gdb/testsuite/gdb.arch/amd64-byte.exp            |  6 +-----
 gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp   | 10 +---------
 gdb/testsuite/gdb.arch/amd64-disp-step.exp       |  5 +----
 gdb/testsuite/gdb.arch/amd64-dword.exp           |  6 +-----
 .../gdb.arch/amd64-entry-value-inline.exp        |  5 ++---
 .../gdb.arch/amd64-entry-value-param-dwarf5.exp  |  5 ++---
 .../gdb.arch/amd64-entry-value-paramref.exp      |  5 +----
 gdb/testsuite/gdb.arch/amd64-entry-value.exp     |  5 ++---
 gdb/testsuite/gdb.arch/amd64-eval.exp            |  5 +----
 .../gdb.arch/amd64-invalid-stack-middle.exp      |  5 +----
 .../gdb.arch/amd64-invalid-stack-top.exp         |  6 ++----
 gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp |  5 ++---
 gdb/testsuite/gdb.arch/amd64-osabi.exp           |  6 +-----
 gdb/testsuite/gdb.arch/amd64-prologue-skip.exp   |  5 +----
 gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp    |  5 ++---
 .../gdb.arch/amd64-stap-expressions.exp          |  5 +----
 .../gdb.arch/amd64-stap-special-operands.exp     |  5 +----
 .../gdb.arch/amd64-stap-wrong-subexp.exp         |  5 +----
 gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp    |  5 ++---
 gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp  |  5 ++---
 gdb/testsuite/gdb.arch/amd64-tailcall-self.exp   |  5 +----
 gdb/testsuite/gdb.arch/amd64-word.exp            |  6 +-----
 gdb/testsuite/gdb.arch/arc-analyze-prologue.exp  |  5 +----
 gdb/testsuite/gdb.arch/arc-decode-insn.exp       |  5 +----
 .../gdb.arch/arc-disassembler-options.exp        |  5 +----
 gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp      |  4 +---
 .../gdb.arch/arm-disassembler-options.exp        |  5 +----
 gdb/testsuite/gdb.arch/avr-flash-qualifier.exp   |  5 +----
 gdb/testsuite/gdb.arch/e500-abi.exp              |  6 +-----
 gdb/testsuite/gdb.arch/e500-prologue.exp         |  6 +-----
 gdb/testsuite/gdb.arch/e500-regs.exp             |  6 +-----
 gdb/testsuite/gdb.arch/gdb1291.exp               |  6 +-----
 gdb/testsuite/gdb.arch/gdb1431.exp               |  6 +-----
 gdb/testsuite/gdb.arch/gdb1558.exp               |  6 +-----
 gdb/testsuite/gdb.arch/i386-avx.exp              |  5 +----
 gdb/testsuite/gdb.arch/i386-mpx-call.exp         |  9 +--------
 gdb/testsuite/gdb.arch/i386-mpx-map.exp          |  9 +--------
 gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp      |  9 +--------
 gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp  |  9 +--------
 gdb/testsuite/gdb.arch/i386-mpx.exp              |  9 +--------
 .../i386-prologue-skip-cf-protection.exp         |  5 +----
 .../gdb.arch/ia64-breakpoint-shadow.exp          |  5 +----
 gdb/testsuite/gdb.arch/iwmmxt-regs.exp           |  5 +----
 .../gdb.arch/mips-disassembler-options.exp       |  5 +----
 gdb/testsuite/gdb.arch/mips-fcr.exp              |  5 +----
 gdb/testsuite/gdb.arch/mips-fpregset-core.exp    |  5 +----
 gdb/testsuite/gdb.arch/mips-octeon-bbit.exp      |  4 +---
 gdb/testsuite/gdb.arch/mips16-thunks.exp         |  5 +----
 gdb/testsuite/gdb.arch/powerpc-addpcis.exp       |  5 +----
 gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp  |  5 +----
 gdb/testsuite/gdb.arch/powerpc-altivec.exp       |  5 +----
 gdb/testsuite/gdb.arch/powerpc-altivec2.exp      |  5 +----
 gdb/testsuite/gdb.arch/powerpc-altivec3.exp      |  5 +----
 gdb/testsuite/gdb.arch/powerpc-d128-regs.exp     |  5 +----
 .../gdb.arch/powerpc-disassembler-options.exp    |  5 +----
 gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp   |  5 +----
 gdb/testsuite/gdb.arch/powerpc-htm-regs.exp      |  5 +----
 gdb/testsuite/gdb.arch/powerpc-lnia.exp          |  5 +----
 gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp   |  6 +-----
 gdb/testsuite/gdb.arch/powerpc-power10.exp       |  5 +----
 gdb/testsuite/gdb.arch/powerpc-power7.exp        |  5 +----
 gdb/testsuite/gdb.arch/powerpc-power8.exp        |  5 +----
 gdb/testsuite/gdb.arch/powerpc-power9.exp        |  5 +----
 gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp      |  5 +----
 .../gdb.arch/powerpc-prologue-frame.exp          |  5 +----
 gdb/testsuite/gdb.arch/powerpc-prologue.exp      |  5 +----
 gdb/testsuite/gdb.arch/powerpc-stackless.exp     |  5 +----
 gdb/testsuite/gdb.arch/powerpc-tar.exp           |  5 +----
 gdb/testsuite/gdb.arch/powerpc-vector-regs.exp   |  6 +-----
 gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp     |  6 +-----
 gdb/testsuite/gdb.arch/powerpc-vsx.exp           |  5 +----
 gdb/testsuite/gdb.arch/powerpc-vsx2.exp          |  5 +----
 gdb/testsuite/gdb.arch/powerpc-vsx3.exp          |  5 +----
 gdb/testsuite/gdb.arch/powerpc64-prologue.exp    |  5 +----
 gdb/testsuite/gdb.arch/ppc-dfp.exp               |  5 +----
 gdb/testsuite/gdb.arch/ppc-fp.exp                |  5 +----
 gdb/testsuite/gdb.arch/ppc-longdouble.exp        |  5 +----
 gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp     |  6 +-----
 gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp  |  5 +----
 .../gdb.arch/ppc64-isa207-atomic-inst.exp        |  5 +----
 gdb/testsuite/gdb.arch/riscv-bp-infcall.exp      |  5 +----
 gdb/testsuite/gdb.arch/riscv-default-tdesc.exp   |  5 +----
 gdb/testsuite/gdb.arch/riscv-info-fcsr.exp       |  7 +------
 gdb/testsuite/gdb.arch/riscv-reg-aliases.exp     |  5 +----
 gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp   |  5 +----
 gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp      |  5 +----
 .../gdb.arch/riscv-unwind-long-insn.exp          |  5 +----
 .../riscv64-unwind-prologue-with-ld-lw.exp       |  5 +----
 .../gdb.arch/riscv64-unwind-prologue-with-mv.exp |  5 +----
 gdb/testsuite/gdb.arch/s390-multiarch.exp        |  6 +-----
 gdb/testsuite/gdb.arch/s390-stackless.exp        |  5 +----
 gdb/testsuite/gdb.arch/sparc-sysstep.exp         |  4 +---
 gdb/testsuite/gdb.arch/sparc64-adi.exp           |  5 +----
 gdb/testsuite/gdb.arch/sparc64-regs.exp          |  5 +----
 gdb/testsuite/gdb.arch/thumb2-it.exp             |  5 +----
 gdb/testsuite/gdb.arch/vsx-regs.exp              |  6 +-----
 gdb/testsuite/gdb.arch/vsx-vsr-float28.exp       |  6 +-----
 gdb/testsuite/gdb.base/overlays.exp              | 12 +-----------
 gdb/testsuite/gdb.disasm/am33.exp                |  5 +----
 gdb/testsuite/gdb.disasm/h8300s.exp              |  5 +----
 gdb/testsuite/gdb.disasm/hppa.exp                |  7 +------
 gdb/testsuite/gdb.disasm/mn10300.exp             |  5 +----
 gdb/testsuite/gdb.disasm/sh3.exp                 |  5 +----
 gdb/testsuite/gdb.disasm/t01_mov.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t02_mova.exp            |  5 +----
 gdb/testsuite/gdb.disasm/t03_add.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t04_sub.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t05_cmp.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t06_ari2.exp            |  5 +----
 gdb/testsuite/gdb.disasm/t07_ari3.exp            |  5 +----
 gdb/testsuite/gdb.disasm/t08_or.exp              |  5 +----
 gdb/testsuite/gdb.disasm/t09_xor.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t10_and.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t11_logs.exp            |  5 +----
 gdb/testsuite/gdb.disasm/t12_bit.exp             |  5 +----
 gdb/testsuite/gdb.disasm/t13_otr.exp             |  5 +----
 gdb/testsuite/gdb.mi/mi-regs.exp                 | 16 +++++++---------
 .../gdb.reverse/ppc_record_test_isa_2_06.exp     |  5 +----
 .../gdb.reverse/ppc_record_test_isa_3_1.exp      |  6 +-----
 gdb/testsuite/gdb.reverse/s390-mvcle.exp         |  7 +------
 125 files changed, 139 insertions(+), 549 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/aix-sighandle.exp b/gdb/testsuite/gdb.arch/aix-sighandle.exp
index cb38a766562..c724c11abd8 100644
--- a/gdb/testsuite/gdb.arch/aix-sighandle.exp
+++ b/gdb/testsuite/gdb.arch/aix-sighandle.exp
@@ -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 {![istarget "powerpc*-*-aix*"]} {
-    return
-}
+require {istarget "powerpc*-*-aix*"}
 
 if { [prepare_for_testing "failed to prepare" aix-sighandle aix-sighandle.c] } {
     return -1
diff --git a/gdb/testsuite/gdb.arch/alpha-step.exp b/gdb/testsuite/gdb.arch/alpha-step.exp
index 6eafb8c508f..07b4c3912d9 100644
--- a/gdb/testsuite/gdb.arch/alpha-step.exp
+++ b/gdb/testsuite/gdb.arch/alpha-step.exp
@@ -14,10 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-if {![istarget "alpha*-*-*"]} {
-    verbose "Skipping alpha step tests."
-    return
-}
+require {istarget "alpha*-*-*"}
 
 set testfile "alpha-step"
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 1c3cda451e4..2cc75d4d617 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -22,10 +22,7 @@
 #
 
 require allow_altivec_tests
-if {![istarget "powerpc*"]} {
-    verbose "Skipping altivec abi tests."
-    return
-}
+require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 8a7fd2e502c..315ce1acfb2 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -22,10 +22,7 @@
 #
 
 require allow_altivec_tests
-if {![istarget "powerpc*"]} {
-    verbose "Skipping altivec register tests."
-    return
-}
+require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp
index 5a6ea3544d5..faa6ce14878 100644
--- a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp
+++ b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp
@@ -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 { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp
index 1ade593821a..78763e4e2ae 100644
--- a/gdb/testsuite/gdb.arch/amd64-byte.exp
+++ b/gdb/testsuite/gdb.arch/amd64-byte.exp
@@ -18,11 +18,7 @@
 
 # This file is part of the gdb testsuite.
 
-
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64 byte register tests."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 standard_testfile amd64-pseudo.c
 
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
index a36b706828f..fea71457081 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp
@@ -18,15 +18,7 @@
 # Test displaced stepping over VEX-encoded RIP-relative AVX
 # instructions.
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping x86_64 displaced stepping tests."
-    return
-}
-
-if { ![have_avx] } {
-    verbose "Skipping x86_64 displaced stepping tests."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target have_avx
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
index dbd2b37fe7f..6ca95f44406 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp
@@ -18,10 +18,7 @@
 # Test amd64 displaced stepping.
 
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping x86_64 displaced stepping tests."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 set newline "\[\r\n\]*"
 
diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp
index 947c8c11777..9f227601ca4 100644
--- a/gdb/testsuite/gdb.arch/amd64-dword.exp
+++ b/gdb/testsuite/gdb.arch/amd64-dword.exp
@@ -18,11 +18,7 @@
 
 # This file is part of the gdb testsuite.
 
-
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64 dword register tests."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 standard_testfile amd64-pseudo.c
 
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
index fc79f02f5ac..30b4395433d 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
@@ -20,9 +20,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
     standard_testfile
     lappend opts debug optimize=-O2
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
index 57baa073071..25615ceaafc 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
@@ -20,9 +20,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1"
     set srcfile ${srcfile2}
     lappend opts optimize=-O2 additional_flags=-gdwarf-5
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64-entry-value-param-dwarf5."
-    return
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
index 3f89b8656ab..be22937481a 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
@@ -15,10 +15,7 @@
 
 standard_testfile .S .cc
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64-entry-value-paramref."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 if { [prepare_for_testing_full "failed to prepare" \
 	  [list $testfile "c++" $srcfile {}]] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index 15dfaea4091..f5aa42a53b5 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -20,9 +20,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1"
     set srcfile ${testfile}.cc
     lappend opts debug optimize=-O2
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64-entry-value."
-    return
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-eval.exp b/gdb/testsuite/gdb.arch/amd64-eval.exp
index 43061e4e0fb..c9ae30fc4d0 100644
--- a/gdb/testsuite/gdb.arch/amd64-eval.exp
+++ b/gdb/testsuite/gdb.arch/amd64-eval.exp
@@ -17,10 +17,7 @@
 
 # This testcase exercises evaluation with amd64 calling conventions.
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping x86_64 eval test."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 standard_testfile .cc
 
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
index 3d3994e23f5..a5aaeedd359 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
@@ -29,10 +29,7 @@
 
 standard_testfile .S
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie}] } {
     return -1
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
index 74ca3e163c5..19b2972c34c 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
@@ -30,10 +30,8 @@
 set opts {}
 standard_testfile .c
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
+
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
index 9d4c219cb71..7f45b956b39 100644
--- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
+++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
@@ -20,9 +20,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-optimout-repeat.exp COMPILE=1"
     set srcfile ${srcfile2}
     lappend opts debug optimize=-O2
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64-optimout-repeat."
-    return
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-osabi.exp b/gdb/testsuite/gdb.arch/amd64-osabi.exp
index 1d8dbffcd9e..cb3718f76fc 100644
--- a/gdb/testsuite/gdb.arch/amd64-osabi.exp
+++ b/gdb/testsuite/gdb.arch/amd64-osabi.exp
@@ -15,11 +15,7 @@
 
 # Verify that gdbarches for i386 variants and osabi none are properly created.
 
-if { ![istarget x86_64-*-* ] } {
-    untested "skipping x86-64 specific test"
-    return
-}
-
+require {istarget x86_64-*-*}
 
 proc test_osabi_none { arch void_ptr_size long_double_size } {
     clean_restart
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp b/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp
index dc2d455c11d..44464bd3193 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-skip.exp
@@ -16,10 +16,7 @@
 standard_testfile .S
 set binfile ${binfile}.o
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}] != "" } {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
index 354628a7540..d02c1418a30 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
@@ -24,9 +24,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1'
     set srcfile ${csrcfile}
     lappend opts debug optimize=-O0
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64-prologue-xmm test."
-    return 0
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 if {[prepare_for_testing "failed to prepare" ${binfile} $srcfile $opts]} {
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp b/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp
index d71cc5fe45f..43627042e9e 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-expressions.exp
@@ -15,10 +15,7 @@
 
 standard_testfile ".S"
 
-if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
-    verbose "Skipping $testfile.exp"
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
index 205f871b90b..9a453e53ace 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-special-operands.exp
@@ -13,10 +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 { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
-    verbose "Skipping amd64-stap-special-operands.exp"
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 proc test_probe { probe_name } {
     with_test_prefix "probe: ${probe_name}" {
diff --git a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp
index f83336207ec..f2172a0ce35 100644
--- a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp
+++ b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.exp
@@ -13,10 +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 { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
-    verbose "Skipping amd64-stap-wrong-subexp.exp"
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 standard_testfile amd64-stap-wrong-subexp.S
 
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
index ae416f3dffa..756f210d783 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
@@ -20,9 +20,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-cxx.exp COMPILE=1"
     standard_testfile amd64-tailcall-cxx1.cc amd64-tailcall-cxx2.cc
     lappend opts debug optimize=-O2
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} "${srcfile} ${srcfile2}" $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
index 5676929ea4d..30be37fe4ff 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
@@ -20,9 +20,8 @@ if [info exists COMPILE] {
     # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-noret.exp COMPILE=1"
     standard_testfile
     lappend opts debug optimize=-O2
-} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
+} else {
+    require {istarget x86_64-*-*} is_lp64_target
 }
 
 lappend opts nopie
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
index 840ba5bd878..e2fa9328e71 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
@@ -15,10 +15,7 @@
 
 standard_testfile .S
 
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping ${testfile}."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } {
     return -1
diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp
index 2308f09ec3e..5c3164aa941 100644
--- a/gdb/testsuite/gdb.arch/amd64-word.exp
+++ b/gdb/testsuite/gdb.arch/amd64-word.exp
@@ -18,11 +18,7 @@
 
 # This file is part of the gdb testsuite.
 
-
-if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
-    verbose "Skipping amd64 word register tests."
-    return
-}
+require {istarget x86_64-*-*} is_lp64_target
 
 standard_testfile amd64-pseudo.c
 
diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
index 197d9135438..f414d9ccde0 100644
--- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
+++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp
@@ -15,10 +15,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 {![istarget "arc*-*-*"]} {
-    verbose "Skipping ARC prologue test."
-    return
-}
+require {istarget "arc*-*-*"}
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.exp b/gdb/testsuite/gdb.arch/arc-decode-insn.exp
index 792238d19f1..eeda8b42a6e 100644
--- a/gdb/testsuite/gdb.arch/arc-decode-insn.exp
+++ b/gdb/testsuite/gdb.arch/arc-decode-insn.exp
@@ -31,10 +31,7 @@
 # about requirements to actual test cases can be found in corresponding
 # assembly file of this test case (arc-decode-insn.S).
 
-if {![istarget "arc*-*-*"]} {
-    verbose "Skipping ARC decoder test."
-    return
-}
+require {istarget "arc*-*-*"}
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
index 56825fa5a3e..655edcc774b 100644
--- a/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.exp
@@ -15,10 +15,7 @@
 
 # Test ARC disassembler options.
 
-if {![istarget "arc-*-*"]} {
-    verbose "Skipping ARC disassembler option test."
-    return
-}
+require {istarget "arc-*-*"}
 
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
diff --git a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp
index 41e62ab9922..3b7d1b6b2d4 100644
--- a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp
+++ b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp
@@ -15,9 +15,7 @@
 
 # This file is part of the gdb testsuite.
 
-if { ![istarget "arm*-*-*"]} {
-     return 1
-}
+require {istarget "arm*-*-*"}
 
 standard_testfile
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile ]} {
diff --git a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
index 1d07d80770f..c7a35f4e947 100644
--- a/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/arm-disassembler-options.exp
@@ -18,10 +18,7 @@
 # This test exercises set/show disassembler-options results are preserved
 # across multiple set architecture calls.
 
-if {![istarget "arm*-*-*"]} {
-    verbose "Skipping ARM disassembler options."
-    return
-}
+require {istarget "arm*-*-*"}
 
 gdb_exit
 gdb_start
diff --git a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
index 1ced212c700..dfd9419f1ef 100644
--- a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
+++ b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp
@@ -18,10 +18,7 @@
 # Contributed by Pierre Langlois  <pierre.langlois@embecosm.com>
 # Tests for the AVR __flash named address space qualifier.
 
-if {![istarget "avr*"]} {
-  verbose "Skipping ${gdb_test_file_name}."
-  return
-}
+require {istarget "avr*"}
 
 # The __flash qualifier was added in GCC 4.7.
 if {[test_compiler_info {gcc-[0-4]-[0-6]}]} {
diff --git a/gdb/testsuite/gdb.arch/e500-abi.exp b/gdb/testsuite/gdb.arch/e500-abi.exp
index a8016bf800e..b466536249a 100644
--- a/gdb/testsuite/gdb.arch/e500-abi.exp
+++ b/gdb/testsuite/gdb.arch/e500-abi.exp
@@ -21,11 +21,7 @@
 # This file uses e500-abi.c for input.
 #
 
-
-if {![istarget "powerpc-*eabispe"]} {
-    verbose "Skipping e500 abi tests."
-    return
-}
+require {istarget "powerpc-*eabispe"}
 
 set testfile "e500-abi"
 set binfile ${objdir}/${subdir}/${testfile}
diff --git a/gdb/testsuite/gdb.arch/e500-prologue.exp b/gdb/testsuite/gdb.arch/e500-prologue.exp
index 6dbe7c911bf..7c32d9dd5b0 100644
--- a/gdb/testsuite/gdb.arch/e500-prologue.exp
+++ b/gdb/testsuite/gdb.arch/e500-prologue.exp
@@ -17,11 +17,7 @@
 
 # Test PowerPC E500 prologue analyzer.
 
-
-if {![istarget "powerpc-*"]} {
-    verbose "Skipping powerpc E500 prologue tests."
-    return
-}
+require {istarget "powerpc-*"}
 
 set testfile "e500-prologue"
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp
index 05beb635303..615b745d251 100644
--- a/gdb/testsuite/gdb.arch/e500-regs.exp
+++ b/gdb/testsuite/gdb.arch/e500-regs.exp
@@ -21,11 +21,7 @@
 # This file uses e500-regs.c for input.
 #
 
-
-if {![istarget "powerpc-*eabispe"]} {
-    verbose "Skipping e500 register tests."
-    return
-}
+require {istarget "powerpc-*eabispe"}
 
 set testfile "e500-regs"
 set binfile ${objdir}/${subdir}/${testfile}
diff --git a/gdb/testsuite/gdb.arch/gdb1291.exp b/gdb/testsuite/gdb.arch/gdb1291.exp
index eb523670ab1..a81a13ff151 100644
--- a/gdb/testsuite/gdb.arch/gdb1291.exp
+++ b/gdb/testsuite/gdb.arch/gdb1291.exp
@@ -23,11 +23,7 @@
 
 # Test SH backtraces with >256 byte frame stack. (PR:1291)
 
-
-if {![istarget "sh-*-*"]} {
-    verbose "Skipping SH backtrace tests."
-    return
-}
+require {istarget "sh-*-*"}
 
 set testfile "gdb1291"
 set srcfile ${testfile}.s
diff --git a/gdb/testsuite/gdb.arch/gdb1431.exp b/gdb/testsuite/gdb.arch/gdb1431.exp
index b15206d9745..eee14fb3025 100644
--- a/gdb/testsuite/gdb.arch/gdb1431.exp
+++ b/gdb/testsuite/gdb.arch/gdb1431.exp
@@ -25,11 +25,7 @@
 
 # Observe that the until command doesn't go all the way to sub2.
 
-
-if {![istarget "sh-*-*"]} {
-    verbose "Skipping SH backtrace tests."
-    return
-}
+require {istarget "sh-*-*"}
 
 set testfile "gdb1431"
 set srcfile ${testfile}.s
diff --git a/gdb/testsuite/gdb.arch/gdb1558.exp b/gdb/testsuite/gdb.arch/gdb1558.exp
index 4c6852e59b5..9090f03d6d9 100644
--- a/gdb/testsuite/gdb.arch/gdb1558.exp
+++ b/gdb/testsuite/gdb.arch/gdb1558.exp
@@ -21,11 +21,7 @@
 # Tests for PR:1558.  Hits breakpoint at main after function called
 # from main.
 
-
-if {![istarget "sh-*-*"]} {
-    verbose "Skipping SH breakpoint test."
-    return
-}
+require {istarget "sh-*-*"}
 
 set testfile "gdb1558"
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp
index 35557a1b84c..72523c5d47b 100644
--- a/gdb/testsuite/gdb.arch/i386-avx.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx.exp
@@ -24,10 +24,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
     return
 }
 
-if { ![have_avx] } {
-    verbose "Skipping x86 AVX tests."
-    return
-}
+require have_avx
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-call.exp b/gdb/testsuite/gdb.arch/i386-mpx-call.exp
index 4311abc41a8..8371546a8f9 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-call.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-call.exp
@@ -21,14 +21,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
-if { ![supports_mpx_check_pointer_bounds] } {
-    return -1
-}
-
-if { ![have_mpx] } {
-    unsupported "processor does not support MPX"
-    return -1
-}
+require supports_mpx_check_pointer_bounds have_mpx
 
 set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat"
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-map.exp b/gdb/testsuite/gdb.arch/i386-mpx-map.exp
index c4768acd0ea..d95adef7d8b 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-map.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-map.exp
@@ -23,14 +23,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
-if { ![supports_mpx_check_pointer_bounds] } {
-    return -1
-}
-
-if { ![have_mpx] } {
-    unsupported "processor does not support MPX"
-    return -1
-}
+require supports_mpx_check_pointer_bounds have_mpx
 
 set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/"
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp b/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
index 4021b50bab8..eaac31edbd3 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
@@ -23,14 +23,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
-if { ![supports_mpx_check_pointer_bounds] } {
-    return -1
-}
-
-if { ![have_mpx] } {
-    unsupported "processor does not support MPX"
-    return -1
-}
+require supports_mpx_check_pointer_bounds have_mpx
 
 set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/"
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp b/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
index 425834614c8..a33c4f526f7 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
@@ -29,14 +29,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile
 
-if { ![supports_mpx_check_pointer_bounds] } {
-    return -1
-}
-
-if { ![have_mpx] } {
-    unsupported "processor does not support MPX"
-    return -1
-}
+require supports_mpx_check_pointer_bounds have_mpx
 
 set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/"
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx.exp b/gdb/testsuite/gdb.arch/i386-mpx.exp
index 96cd8fe9092..5534ec9aa81 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx.exp
@@ -27,14 +27,7 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
     return
 }
 
-if { ![supports_mpx_check_pointer_bounds] } {
-    return -1
-}
-
-if { ![have_mpx] } {
-    unsupported "processor does not support MPX"
-    return -1
-}
+require supports_mpx_check_pointer_bounds have_mpx
 
 set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/"
 
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
index 3d12c2086f5..06cb2b1b818 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
@@ -27,10 +27,7 @@ if { ![istarget x86_64-*-*] && ![istarget i?86-*-*] } {
     return
 }
 
-if { ![supports_fcf_protection] } {
-    untested "-fcf-protection not supported"
-    return
-}
+require supports_fcf_protection
 
 set opts {debug additional_flags=-fcf-protection=full}
 
diff --git a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
index bddfcb57510..e9f98d0eb9e 100644
--- a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
+++ b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp
@@ -13,10 +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 ![istarget "ia64-*-*"] {
-    verbose "Skipping ia64-breakpoint-shadow test."
-    return
-}
+require {istarget "ia64-*-*"}
 
 set testfile ia64-breakpoint-shadow
 set srcfile ${testfile}.S
diff --git a/gdb/testsuite/gdb.arch/iwmmxt-regs.exp b/gdb/testsuite/gdb.arch/iwmmxt-regs.exp
index d2a97e297a2..90038e485b8 100644
--- a/gdb/testsuite/gdb.arch/iwmmxt-regs.exp
+++ b/gdb/testsuite/gdb.arch/iwmmxt-regs.exp
@@ -16,10 +16,7 @@
 
 # Tests for ARM iWMMXt register setting and fetching.
 
-if {![istarget "arm*-*-*"]} {
-    verbose "Skipping iWMMXt register tests."
-    return
-}
+require {istarget "arm*-*-*"}
 
 set testfile "iwmmxt-regs"
 set binfile ${objdir}/${subdir}/${testfile}
diff --git a/gdb/testsuite/gdb.arch/mips-disassembler-options.exp b/gdb/testsuite/gdb.arch/mips-disassembler-options.exp
index a9cac756115..e603cb000a6 100644
--- a/gdb/testsuite/gdb.arch/mips-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/mips-disassembler-options.exp
@@ -15,10 +15,7 @@
 
 # Test MIPS disassembler options.
 
-if {![istarget "mips*-*-*"]} {
-    verbose "Skipping MIPS disassembler option tests."
-    return
-}
+require {istarget "mips*-*-*"}
 
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
diff --git a/gdb/testsuite/gdb.arch/mips-fcr.exp b/gdb/testsuite/gdb.arch/mips-fcr.exp
index f301fb35469..14904bf6810 100644
--- a/gdb/testsuite/gdb.arch/mips-fcr.exp
+++ b/gdb/testsuite/gdb.arch/mips-fcr.exp
@@ -17,10 +17,7 @@
 
 # Test MIPS Floating Point Control Register handling.
 
-if {![istarget "mips*-*-*"]} {
-    verbose "Skipping MIPS Floating Point Control Register tests."
-    return
-}
+require {istarget "mips*-*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/mips-fpregset-core.exp b/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
index 9144e011d03..c257999b5b8 100644
--- a/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
+++ b/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
@@ -15,10 +15,7 @@
 
 # Test MIPS Floating Point General Register handling in core files.
 
-if {![istarget "mips*-*-*"]} {
-    verbose "Skipping MIPS Floating Point General Register tests."
-    return
-}
+require {istarget "mips*-*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
index e804780d4f6..2b00fe14ce0 100644
--- a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
+++ b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp
@@ -15,9 +15,7 @@
 
 # Test single-step on bbit.  
 
-if ![istarget "*octeon*"] {
-  return -1
-}
+require {istarget "*octeon*"}
 
 proc current_insn {} {
     global gdb_prompt
diff --git a/gdb/testsuite/gdb.arch/mips16-thunks.exp b/gdb/testsuite/gdb.arch/mips16-thunks.exp
index 5882f167035..07c832847e4 100644
--- a/gdb/testsuite/gdb.arch/mips16-thunks.exp
+++ b/gdb/testsuite/gdb.arch/mips16-thunks.exp
@@ -25,10 +25,7 @@
 # toolchain for a subset of ABIs, so we need to check that a MIPS16
 # executable can be built and run at all before we attempt the actual test.
 
-if {![istarget "mips*-*-*"]} {
-    verbose "Skipping MIPS16 thunk support tests."
-    return
-}
+require {istarget "mips*-*-*"}
 
 # A helper to set caller's SRCFILE and OBJFILE based on FILENAME and SUFFIX.
 proc set_src_and_obj { filename { suffix "" } } {
diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp
index a6a39eb26e5..37397df99ef 100644
--- a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp
@@ -24,10 +24,7 @@
 # lnia Rx == addpcis Rx,0
 # subcis Rx,value == addpcis Rx,-value
 
-if { ![istarget powerpc*-*] } {
-    verbose "Skipping powerpc addpcis test."
-    return
-}
+require {istarget powerpc*-*}
 
 set retval 0
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
index d787035c376..8179c03f2f1 100644
--- a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
@@ -18,10 +18,7 @@
 # Test rs6000 prologue analyzer.
 
 
-if {![istarget "powerpc-*-aix*"]} {
-    verbose "Skipping powerpc-aix prologue tests."
-    return
-}
+require {istarget "powerpc-*-aix*"}
 
 set testfile "powerpc-aix-prologue"
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec.exp b/gdb/testsuite/gdb.arch/powerpc-altivec.exp
index fcc93870f7e..b1396493750 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp
index bba6700510d..405c7ab50ac 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp
index 2b9efb135f0..d3daa5efbca 100644
--- a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
index 28c8268cb46..72ce2316b16 100644
--- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp
@@ -20,10 +20,7 @@
 
 # Testcase for ppc decimal128 pseudo-registers.
 
-if {![istarget "powerpc64*-*"]} {
-    verbose "Skipping powerpc Decimal128 pseudo-registers testcase."
-    return
-}
+require {istarget "powerpc64*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp b/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
index 823b5f7b52a..2b0995e9b6f 100644
--- a/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-disassembler-options.exp
@@ -18,10 +18,7 @@
 # This test exercises set/show disassembler-options results are preserved
 # across multiple set architecture calls.
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC disassembler options."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 gdb_exit
 gdb_start
diff --git a/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp b/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp
index e10ec442d59..5759692c1e4 100644
--- a/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-fpscr-gcore.exp
@@ -18,10 +18,7 @@
 # This tests checks that generating and loading a core file preserves
 # the correct FPSCR size.
 
-if {![istarget "powerpc*-*-linux*"]} {
-    verbose "Skipping PowerPC test for corefiles with FPSCR."
-    return
-}
+require {istarget "powerpc*-*-linux*"}
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp
index 345cb34ead9..7d21e52260d 100644
--- a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp
@@ -25,10 +25,7 @@
 # registers are then checked against the saved values, because the
 # abort should have reverted the registers to these values.
 
-if {![istarget "powerpc*-*-linux*"]} {
-    verbose "Skipping PowerPC test for HTM registers."
-    return
-}
+require {istarget "powerpc*-*-linux*"}
 
 standard_testfile .c .gen.c
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp
index 92e2502700a..88f3e8784a8 100644
--- a/gdb/testsuite/gdb.arch/powerpc-lnia.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp
@@ -23,10 +23,7 @@
 #		lnia Rx == addpcis Rx,0 == lnia Rx
 #		subcis Rx,value == addpcis Rx,-value
 
-if { ![istarget powerpc*-*] } {
-    verbose "Skipping powerpc lnia test."
-    return
-}
+require {istarget powerpc*-*}
 
 set retval 0
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
index 1ad3ea8bde4..acad3c5a57b 100644
--- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp
@@ -16,11 +16,7 @@
 # Test to see if gdb is properly single stepping over the
 # displaced plxv instruction.
 
-if { ![istarget powerpc*-*] } {
-    verbose "Skipping powerpc ISA 3.1 plxv test."
-    return
-}
-require allow_power_isa_3_1_tests
+require {istarget powerpc*-*} allow_power_isa_3_1_tests
 
 set retval 0
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-power10.exp b/gdb/testsuite/gdb.arch/powerpc-power10.exp
index 5e1d12b75f4..9224c6eb59b 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power10.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power10.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp
index 4773086b899..9fa16ce761d 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power7.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.exp b/gdb/testsuite/gdb.arch/powerpc-power8.exp
index baf7b614552..bf087988817 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power8.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power8.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.exp b/gdb/testsuite/gdb.arch/powerpc-power9.exp
index fe588568b3a..a66059e521e 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power9.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power9.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
index 9fcbf94b105..5bcfbb160d0 100644
--- a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp
@@ -20,10 +20,7 @@
 # values, then write to the registers trough GDB, step once, and check
 # again if we read back the same values.
 
-if {![istarget "powerpc*-*-linux*"]} {
-    verbose "Skipping PowerPC test for PPR and DSCR registers."
-    return
-}
+require {istarget "powerpc*-*-linux*"}
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp
index 454b1499420..dd99250736b 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp
@@ -13,10 +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 {![istarget "powerpc-*-*"] } {
-    verbose "Skipping powerpc back trace test."
-    return
-}
+require {istarget "powerpc-*-*"}
 
 standard_testfile .c .S
 set binfile [standard_output_file ${testfile}]
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
index 2f00c90cc11..edc7116754a 100644
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
@@ -17,10 +17,7 @@
 
 # Do not run on AIX (where we won't be able to build the tests without
 # some surgery) or on PowerPC64 (ditto, dot symbols).
-if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} {
-    verbose "Skipping PowerPC prologue tests."
-    return
-}
+require {!istarget *-*-aix*} {istarget "powerpc-*-*"}
 
 set testfile "powerpc-prologue"
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.arch/powerpc-stackless.exp b/gdb/testsuite/gdb.arch/powerpc-stackless.exp
index cd6b5765651..9005577b139 100644
--- a/gdb/testsuite/gdb.arch/powerpc-stackless.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-stackless.exp
@@ -15,10 +15,7 @@
 
 # Testcase for PR tdep/17379.
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping powerpc-stackless.exp"
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-tar.exp b/gdb/testsuite/gdb.arch/powerpc-tar.exp
index 5fe800ba802..726ca04ba07 100644
--- a/gdb/testsuite/gdb.arch/powerpc-tar.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-tar.exp
@@ -22,10 +22,7 @@
 # branch to TAR and check that we stop at the address that we wrote to
 # register.
 
-if {![istarget "powerpc*-*-linux*"]} {
-    verbose "Skipping PowerPC test for the TAR register."
-    return
-}
+require {istarget "powerpc*-*-linux*"}
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
index bbcf45a555d..2447d740624 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
@@ -20,11 +20,7 @@
 # 0 to 31 in each of the 16 bytes of each corresponding register, and
 # we then check if gdb sees these same values.
 
-require allow_altivec_tests
-if {![istarget "powerpc*"]} {
-    verbose "Skipping PowerPC vector register tests."
-    return
-}
+require allow_altivec_tests {[istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp b/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
index b80afa5b7f2..8ea773ccaee 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx-gcore.exp
@@ -18,11 +18,7 @@
 # This test checks that generating and loading a core file preserves
 # the correct VSX register state.
 
-if {![istarget "powerpc*-*-linux*"]} {
-    verbose "Skipping PowerPC test for corefiles with VSX registers."
-    return
-}
-require allow_vsx_tests
+require {istarget "powerpc*-*-linux*"} allow_vsx_tests
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.exp b/gdb/testsuite/gdb.arch/powerpc-vsx.exp
index ec58eb87704..7980a3c9ecb 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp
index 2b842d2eb02..ec566d821b4 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp
index 5ee2ea861f5..cdb5bf6f420 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp
@@ -20,10 +20,7 @@
 standard_testfile .s
 set objfile [standard_output_file ${testfile}.o]
 
-if {![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC instructions disassembly."
-    return
-}
+require {istarget "powerpc*-*-*"}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     untested "PowerPC instructions disassembly"
diff --git a/gdb/testsuite/gdb.arch/powerpc64-prologue.exp b/gdb/testsuite/gdb.arch/powerpc64-prologue.exp
index 901d4e4fd1d..3034ac168bb 100644
--- a/gdb/testsuite/gdb.arch/powerpc64-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc64-prologue.exp
@@ -17,10 +17,7 @@
 
 # Do not run on AIX (where we won't be able to build the tests without
 # some surgery) or on PowerPC64 (ditto, dot symbols).
-if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} {
-    verbose "Skipping PowerPC prologue tests."
-    return
-}
+require {!istarget *-*-aix*} {istarget "powerpc*-*-*"}
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 366968136bb..eca44a683e4 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -16,10 +16,7 @@
 
 # Tests for Powerpc Decimal Floating Point registers setting and fetching
 
-if {![istarget "powerpc*"]} {
-    verbose "Skipping powerpc decimal floating point register tests."
-    return
-}
+require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/ppc-fp.exp b/gdb/testsuite/gdb.arch/ppc-fp.exp
index 30d6f8aa660..db7ea1202d5 100644
--- a/gdb/testsuite/gdb.arch/ppc-fp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-fp.exp
@@ -16,10 +16,7 @@
 
 # Tests for Powerpc floating point register setting and fetching
 
-if {![istarget "powerpc*"]} {
-    verbose "Skipping powerpc floating point register tests."
-    return
-}
+require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/ppc-longdouble.exp b/gdb/testsuite/gdb.arch/ppc-longdouble.exp
index d8193696502..c7d7817377b 100644
--- a/gdb/testsuite/gdb.arch/ppc-longdouble.exp
+++ b/gdb/testsuite/gdb.arch/ppc-longdouble.exp
@@ -13,10 +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 {![istarget "powerpc*"]} {
-    verbose "Skipping powerpc long-double floating point tests."
-    return
-}
+require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
index 1ff1e58367f..e6777312508 100644
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
@@ -19,11 +19,7 @@
 # a lwarx/ldarx instruction and ending with a stwcx/stdcx
 # instruction.
 
-
-if {![istarget "powerpc*"] || ![is_lp64_target]} {
-    verbose "Skipping testing of powerpc64 single stepping over atomic sequences."
-    return
-}
+require {istarget "powerpc*"} is_lp64_target
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
index 1cdf303a0c6..c03215ef9f2 100644
--- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
@@ -23,10 +23,7 @@
 # read, then that functionality might not be used because f.i.
 # line-info is used instead.  So, we use nodebug.
 
-if {![istarget "powerpc*"] || ![is_lp64_target]} {
-    unsupported "Not powerpc64"
-    return
-}
+require {istarget "powerpc*"} is_lp64_target
 
 set flags { nodebug }
 if [info exists COMPILE] {
diff --git a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
index caaed41e611..7c89c7e5af2 100644
--- a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
+++ b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
@@ -21,10 +21,7 @@
 # were introduced in ISA 2.06, they were implemented only in POWER8 (ISA 2.07).
 
 
-if {![istarget "powerpc*"] || ![is_lp64_target]} {
-    untested "skipping powerpc isa 207 atomic sequences test"
-    return
-}
+require {istarget "powerpc*"} is_lp64_target
 
 standard_testfile  .c .S
 
diff --git a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp
index 2dc5f53fab3..f0c1527439d 100644
--- a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp
+++ b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp
@@ -16,10 +16,7 @@
 # Test GDB for RISC-V always uses an uncompressed breakpoint when
 # setting up for an inferior call.
 
-if {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv*-*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp b/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp
index c00b4a741d8..1a201723d8b 100644
--- a/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp
+++ b/gdb/testsuite/gdb.arch/riscv-default-tdesc.exp
@@ -23,10 +23,7 @@
 #
 # In all other cases the default will be RV64.
 
-if {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv*-*-*"}
 
 # Start GDB with no executable.
 gdb_start
diff --git a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
index d8e88994266..d72b740b9bd 100644
--- a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
+++ b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp
@@ -16,12 +16,7 @@
 # Check the formatting of the fcsr, fflags, and frm registers in the
 # output of the 'info registers' command.
 
-if {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
-
-require allow_float_test
+require {istarget "riscv*-*-*"} allow_float_test
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp b/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp
index 8f35a502827..ef2e695ffc0 100644
--- a/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp
+++ b/gdb/testsuite/gdb.arch/riscv-reg-aliases.exp
@@ -13,10 +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 {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv*-*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp b/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp
index 6019dfdc98f..e0bdc212a1e 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp
@@ -15,10 +15,7 @@
 
 # Check that we can load different RISC-V target descriptions.
 
-if {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv*-*-*"}
 
 clean_restart
 
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
index 8ba9bc5647a..1a92f424cbe 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
@@ -17,10 +17,7 @@
 # loading a new target description file, and which registers show up
 # in the output of the 'info registers' command.
 
-if {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv*-*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp
index 18ec4f1e7a4..ac7c3e9f77f 100644
--- a/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp
+++ b/gdb/testsuite/gdb.arch/riscv-unwind-long-insn.exp
@@ -22,10 +22,7 @@
 # prologue.  We trick GDB into parsing the fake instruction by tail
 # calling from a different function, 'bar' to the middle of 'func'.
 
-if {![istarget "riscv*-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv*-*-*"}
 
 standard_testfile riscv-unwind-long-insn.c \
     riscv-unwind-long-insn.S
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp
index 50c33596f6a..373bbab2229 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw.exp
@@ -16,10 +16,7 @@
 # This tests GDB's ability to use the RISC-V prologue scanner in order to
 # unwind through a function that uses the 'ld' instruction in its prologue.
 
-if {![istarget "riscv64-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv64-*-*"}
 
 standard_testfile riscv64-unwind-prologue-with-ld-lw.c \
 		  riscv64-unwind-prologue-with-ld-lw-foo.s
diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp
index cdd0f8d3e0f..4bbf9e96577 100644
--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp
+++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.exp
@@ -16,10 +16,7 @@
 # This tests GDB's ability to use the RISC-V prologue scanner in order to
 # unwind through a function that uses the 'c.mv' instruction in its prologue.
 
-if {![istarget "riscv64-*-*"]} {
-    verbose "Skipping ${gdb_test_file_name}."
-    return
-}
+require {istarget "riscv64-*-*"}
 
 standard_testfile .c .s
 if {[prepare_for_testing "failed to prepare" $testfile \
diff --git a/gdb/testsuite/gdb.arch/s390-multiarch.exp b/gdb/testsuite/gdb.arch/s390-multiarch.exp
index b82cf159011..4256d30b0b9 100644
--- a/gdb/testsuite/gdb.arch/s390-multiarch.exp
+++ b/gdb/testsuite/gdb.arch/s390-multiarch.exp
@@ -23,11 +23,7 @@
 # running native.  It should be executed on a sufficiently new Linux
 # kernel that provides the 'system_call' regset.
 
-require isnative
-if { ![istarget s390x-*-* ] } {
-    verbose "Skipping s390 multi-arch tests."
-    return
-}
+require isnative {istarget s390x-*-*}
 
 standard_testfile
 set binprefix $binfile
diff --git a/gdb/testsuite/gdb.arch/s390-stackless.exp b/gdb/testsuite/gdb.arch/s390-stackless.exp
index 2b2ac991bc5..f942ce8669e 100644
--- a/gdb/testsuite/gdb.arch/s390-stackless.exp
+++ b/gdb/testsuite/gdb.arch/s390-stackless.exp
@@ -13,10 +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 {![istarget "s390*-*-*"]} {
-    verbose "Skipping s390 stackless test."
-    return
-}
+require {istarget "s390*-*-*"}
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/sparc-sysstep.exp b/gdb/testsuite/gdb.arch/sparc-sysstep.exp
index 99e2770cf1f..e86c50eea0e 100644
--- a/gdb/testsuite/gdb.arch/sparc-sysstep.exp
+++ b/gdb/testsuite/gdb.arch/sparc-sysstep.exp
@@ -21,9 +21,7 @@
 # PC must be extracted from the sigreturn register save area in the
 # stack.
 
-if {![istarget "sparc*-*-linux*"]} {
-    return 0
-}
+require {istarget "sparc*-*-linux*"}
 
 set testfile sparc-sysstep
 set srcfile ${testfile}.c
diff --git a/gdb/testsuite/gdb.arch/sparc64-adi.exp b/gdb/testsuite/gdb.arch/sparc64-adi.exp
index b44ec1739d3..9f8545b3c94 100644
--- a/gdb/testsuite/gdb.arch/sparc64-adi.exp
+++ b/gdb/testsuite/gdb.arch/sparc64-adi.exp
@@ -18,10 +18,7 @@
 # Basic tests of examining/assigning ADI version tags, and reporting 
 # precise mismatch.
 
-if {![istarget "sparc64*-*-linux*"]} {
-    verbose "Skipping sparc64 ADI test."
-    return 0
-}
+require {istarget "sparc64*-*-linux*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/sparc64-regs.exp b/gdb/testsuite/gdb.arch/sparc64-regs.exp
index 46e710c83fc..1c60c3d4275 100644
--- a/gdb/testsuite/gdb.arch/sparc64-regs.exp
+++ b/gdb/testsuite/gdb.arch/sparc64-regs.exp
@@ -18,10 +18,7 @@
 # Tests decoding of various sparc64 registers.
 # At the moment, only few registers are tested, but more can be added in future.
 
-if {![istarget "sparc64*-*-linux*"]} {
-    verbose "Skipping sparc64 register tests."
-    return 0
-}
+require {istarget "sparc64*-*-linux*"}
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/thumb2-it.exp b/gdb/testsuite/gdb.arch/thumb2-it.exp
index cbd7ffa2621..024718677de 100644
--- a/gdb/testsuite/gdb.arch/thumb2-it.exp
+++ b/gdb/testsuite/gdb.arch/thumb2-it.exp
@@ -15,10 +15,7 @@
 
 # Test single stepping over Thumb-2 IT blocks.
 
-if {![istarget arm*-*eabi*]} {
-    verbose "Skipping Thumb-2 tests."
-    return
-}
+require {istarget arm*-*eabi*}
 
 standard_testfile .S
 
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index e7476f1015b..2b72a012ef9 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -19,11 +19,7 @@
 #
 
 
-if {![istarget "powerpc*"]} {
-    verbose "Skipping vsx register tests."
-    return
-}
-require allow_vsx_tests
+require {istarget "powerpc*"} allow_vsx_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
index 04915719615..4f831d5c9fd 100644
--- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
+++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
@@ -18,11 +18,7 @@
 # Test the vsr registers print values in float128 bit format.
 #
 
-if {![istarget "powerpc*"]} {
-    verbose "Skipping vsr float128 field tests."
-    return
-}
-require allow_vsx_tests
+require {istarget "powerpc*"} allow_vsx_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp
index 57ead7dde74..3278c530913 100644
--- a/gdb/testsuite/gdb.base/overlays.exp
+++ b/gdb/testsuite/gdb.base/overlays.exp
@@ -22,17 +22,7 @@
 
 set data_overlays 1
 
-if {[istarget "m32r-*-*"]} {
-    set linker_script "${srcdir}/${subdir}/m32r.ld"
-} else {
-    verbose "Skipping overlay test -- not implemented for this target."
-    return 
-}
-
-if {[istarget "*-*-linux*"]} {
-    verbose "Skipping overlay test -- Linux doesn't support overlayed programs."
-    return 
-}
+require {istarget "m32r-*-*"} {!istarget "*-*-linux*"}
 
 standard_testfile overlays.c ovlymgr.c foo.c bar.c baz.c grbx.c
 
diff --git a/gdb/testsuite/gdb.disasm/am33.exp b/gdb/testsuite/gdb.disasm/am33.exp
index e9898ce73ee..a278f395dd6 100644
--- a/gdb/testsuite/gdb.disasm/am33.exp
+++ b/gdb/testsuite/gdb.disasm/am33.exp
@@ -16,10 +16,7 @@
 
 # This file was written by Jeff Law. (law@cygnus.com)
 
-if ![istarget "mn10300*-*-*"] {
-    verbose "Tests ignored for all but mn10300 based targets."
-    return
-}
+require {istarget "mn10300*-*-*"}
 
 global exec_output
 
diff --git a/gdb/testsuite/gdb.disasm/h8300s.exp b/gdb/testsuite/gdb.disasm/h8300s.exp
index c37ecbf861c..cd68a630959 100644
--- a/gdb/testsuite/gdb.disasm/h8300s.exp
+++ b/gdb/testsuite/gdb.disasm/h8300s.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Kazu Hirata. (kazu@hxi.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "h8300s"
diff --git a/gdb/testsuite/gdb.disasm/hppa.exp b/gdb/testsuite/gdb.disasm/hppa.exp
index b2a7bfbdc99..19fc08b6115 100644
--- a/gdb/testsuite/gdb.disasm/hppa.exp
+++ b/gdb/testsuite/gdb.disasm/hppa.exp
@@ -16,12 +16,7 @@
 
 # This file was written by Jeff Law. (law@cs.utah.edu)
 
-if ![istarget "hppa*-*-*"] {
-    verbose "Tests ignored for all but hppa based targets."
-    return
-}
-
-
+require {istarget "hppa*-*-*"}
 
 set testfile "hppa"
 set srcfile ${srcdir}/${subdir}/${testfile}.s
diff --git a/gdb/testsuite/gdb.disasm/mn10300.exp b/gdb/testsuite/gdb.disasm/mn10300.exp
index 4f76f4f5b94..425dc0615c8 100644
--- a/gdb/testsuite/gdb.disasm/mn10300.exp
+++ b/gdb/testsuite/gdb.disasm/mn10300.exp
@@ -16,10 +16,7 @@
 
 # This file was written by Jeff Law. (law@cygnus.com)
 
-if ![istarget "mn10300*-*-*"] {
-    verbose "Tests ignored for all but mn10300 based targets."
-    return
-}
+require {istarget "mn10300*-*-*"}
 
 global exec_output
 
diff --git a/gdb/testsuite/gdb.disasm/sh3.exp b/gdb/testsuite/gdb.disasm/sh3.exp
index 10e0ce4e9cf..84479ce83e7 100644
--- a/gdb/testsuite/gdb.disasm/sh3.exp
+++ b/gdb/testsuite/gdb.disasm/sh3.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Jeff Law. (law@cs.utah.edu)
 
-if ![istarget "sh3*-*-*"] {
-    verbose "Tests ignored for all but sh3 based targets."
-    return
-}
+require {istarget "sh3*-*-*"}
 
 
 set testfile "sh3"
diff --git a/gdb/testsuite/gdb.disasm/t01_mov.exp b/gdb/testsuite/gdb.disasm/t01_mov.exp
index f7faea298eb..8c9b6146266 100644
--- a/gdb/testsuite/gdb.disasm/t01_mov.exp
+++ b/gdb/testsuite/gdb.disasm/t01_mov.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t01_mov"
diff --git a/gdb/testsuite/gdb.disasm/t02_mova.exp b/gdb/testsuite/gdb.disasm/t02_mova.exp
index f94b8bc9715..654a1aaa5a1 100644
--- a/gdb/testsuite/gdb.disasm/t02_mova.exp
+++ b/gdb/testsuite/gdb.disasm/t02_mova.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t02_mova"
diff --git a/gdb/testsuite/gdb.disasm/t03_add.exp b/gdb/testsuite/gdb.disasm/t03_add.exp
index 904f9f82a95..8f7b272673f 100644
--- a/gdb/testsuite/gdb.disasm/t03_add.exp
+++ b/gdb/testsuite/gdb.disasm/t03_add.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t03_add"
diff --git a/gdb/testsuite/gdb.disasm/t04_sub.exp b/gdb/testsuite/gdb.disasm/t04_sub.exp
index ebbb21675ec..2440c8a89f4 100644
--- a/gdb/testsuite/gdb.disasm/t04_sub.exp
+++ b/gdb/testsuite/gdb.disasm/t04_sub.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t04_sub"
diff --git a/gdb/testsuite/gdb.disasm/t05_cmp.exp b/gdb/testsuite/gdb.disasm/t05_cmp.exp
index 45db9bd4aad..8f004348008 100644
--- a/gdb/testsuite/gdb.disasm/t05_cmp.exp
+++ b/gdb/testsuite/gdb.disasm/t05_cmp.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t05_cmp"
diff --git a/gdb/testsuite/gdb.disasm/t06_ari2.exp b/gdb/testsuite/gdb.disasm/t06_ari2.exp
index 68503204f7e..ae6fee677d3 100644
--- a/gdb/testsuite/gdb.disasm/t06_ari2.exp
+++ b/gdb/testsuite/gdb.disasm/t06_ari2.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t06_ari2"
diff --git a/gdb/testsuite/gdb.disasm/t07_ari3.exp b/gdb/testsuite/gdb.disasm/t07_ari3.exp
index 44e8d547a18..66190939675 100644
--- a/gdb/testsuite/gdb.disasm/t07_ari3.exp
+++ b/gdb/testsuite/gdb.disasm/t07_ari3.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t07_ari3"
diff --git a/gdb/testsuite/gdb.disasm/t08_or.exp b/gdb/testsuite/gdb.disasm/t08_or.exp
index e51293ef618..bc01c07830b 100644
--- a/gdb/testsuite/gdb.disasm/t08_or.exp
+++ b/gdb/testsuite/gdb.disasm/t08_or.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t08_or"
diff --git a/gdb/testsuite/gdb.disasm/t09_xor.exp b/gdb/testsuite/gdb.disasm/t09_xor.exp
index 3614325e7ef..547d21f173f 100644
--- a/gdb/testsuite/gdb.disasm/t09_xor.exp
+++ b/gdb/testsuite/gdb.disasm/t09_xor.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t09_xor"
diff --git a/gdb/testsuite/gdb.disasm/t10_and.exp b/gdb/testsuite/gdb.disasm/t10_and.exp
index fdc7a22efda..9f79b841454 100644
--- a/gdb/testsuite/gdb.disasm/t10_and.exp
+++ b/gdb/testsuite/gdb.disasm/t10_and.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t10_and"
diff --git a/gdb/testsuite/gdb.disasm/t11_logs.exp b/gdb/testsuite/gdb.disasm/t11_logs.exp
index 7f1e4f99e88..d946315e6f6 100644
--- a/gdb/testsuite/gdb.disasm/t11_logs.exp
+++ b/gdb/testsuite/gdb.disasm/t11_logs.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t11_logs"
diff --git a/gdb/testsuite/gdb.disasm/t12_bit.exp b/gdb/testsuite/gdb.disasm/t12_bit.exp
index 6fdb647fb8e..7692f9422c0 100644
--- a/gdb/testsuite/gdb.disasm/t12_bit.exp
+++ b/gdb/testsuite/gdb.disasm/t12_bit.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t12_bit"
diff --git a/gdb/testsuite/gdb.disasm/t13_otr.exp b/gdb/testsuite/gdb.disasm/t13_otr.exp
index 5c9333cac1f..1b53c1642e7 100644
--- a/gdb/testsuite/gdb.disasm/t13_otr.exp
+++ b/gdb/testsuite/gdb.disasm/t13_otr.exp
@@ -15,10 +15,7 @@
 
 # This file was written by Michael Snyder (msnyder@redhat.com)
 
-if ![istarget "h8300*-*-*"] {
-    verbose "Tests ignored for all but h8300s based targets."
-    return
-}
+require {istarget "h8300*-*-*"}
 
 
 set testfile "t13_otr"
diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp
index 6dad918d387..bda27d086d9 100644
--- a/gdb/testsuite/gdb.mi/mi-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi-regs.exp
@@ -104,15 +104,13 @@ proc sparc_register_tests { } {
 	    "list changed registers"
 }
 
-if {[istarget "sparc-*-*"]} {
-    mi_clean_restart
-    sparc_register_tests_no_exec
-    mi_clean_restart $binfile
-    mi_runto_main
-    sparc_register_tests
-} else {
-    verbose "mi-regs.exp tests ignored for this target"
-}
+require {istarget "sparc-*-*"}
+
+mi_clean_restart
+sparc_register_tests_no_exec
+mi_clean_restart $binfile
+mi_runto_main
+sparc_register_tests
 
 mi_gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
index f3009bc9ecb..9d08114121f 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
@@ -37,10 +37,7 @@ set gen_src record_test_isa_2_06.c
 set executable record_test_isa_2_06
 set options [list debug]
 
-if {![istarget "powerpc*"]} {
-    verbose "Skipping PowerPC ISA 2.06 instruction record_test_2_06."
-    return
-}
+require {istarget "powerpc*"}
 
 if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} {
     return -1
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
index 7a291aaa49d..9899da36829 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
@@ -37,11 +37,7 @@ standard_testfile
 set gen_src record_test_isa_3_1.c
 set executable record_test_isa_3_1
 
-if {![istarget "powerpc*"]}  {
-    verbose "Skipping PowerPC ISA 3.1 instruction record_test."
-    return
-}
-require allow_power_isa_3_1_tests
+require {istarget "powerpc*"} allow_power_isa_3_1_tests
 
 set options [list additional_flags=-mcpu=power10 debug]
 if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} {
diff --git a/gdb/testsuite/gdb.reverse/s390-mvcle.exp b/gdb/testsuite/gdb.reverse/s390-mvcle.exp
index b0890400bae..26997562b24 100644
--- a/gdb/testsuite/gdb.reverse/s390-mvcle.exp
+++ b/gdb/testsuite/gdb.reverse/s390-mvcle.exp
@@ -17,12 +17,7 @@
 # This test tests s390 MVCLE opcode for reverse execution.
 #
 
-require supports_reverse
-
-if { ! [istarget "s390*-*-*"] } {
-    verbose "Skipping s390 MVCLE instruction recording tests."
-    return
-}
+require supports_reverse {istarget "s390*-*-*"}
 
 standard_testfile
 
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 6/9] Introduce and use is_any_target
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
                   ` (4 preceding siblings ...)
  2023-01-24 23:02 ` [PATCH v2 5/9] Use require with istarget Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 7/9] Add unsupported calls where needed Tom Tromey
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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'.
---
 gdb/testsuite/gdb.arch/amd64-i386-address.exp          |  7 ++-----
 gdb/testsuite/gdb.arch/arm-neon.exp                    |  5 +----
 gdb/testsuite/gdb.arch/i386-avx.exp                    |  5 +----
 gdb/testsuite/gdb.arch/i386-avx512.exp                 |  5 +----
 gdb/testsuite/gdb.arch/i386-biarch-core.exp            |  5 +----
 gdb/testsuite/gdb.arch/i386-bp_permanent.exp           |  5 +----
 gdb/testsuite/gdb.arch/i386-byte.exp                   |  5 +----
 gdb/testsuite/gdb.arch/i386-dr3-watch.exp              |  4 +---
 gdb/testsuite/gdb.arch/i386-float.exp                  |  5 +----
 gdb/testsuite/gdb.arch/i386-mpx-call.exp               |  5 +----
 gdb/testsuite/gdb.arch/i386-mpx-map.exp                |  5 +----
 gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp            |  5 +----
 gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp        |  5 +----
 gdb/testsuite/gdb.arch/i386-mpx.exp                    | 10 ++--------
 gdb/testsuite/gdb.arch/i386-permbkpt.exp               |  5 +----
 gdb/testsuite/gdb.arch/i386-pkru.exp                   |  5 +----
 .../gdb.arch/i386-prologue-skip-cf-protection.exp      |  5 +----
 gdb/testsuite/gdb.arch/i386-signal.exp                 |  5 +----
 gdb/testsuite/gdb.arch/i386-sse.exp                    |  5 +----
 gdb/testsuite/gdb.arch/i386-word.exp                   |  5 +----
 gdb/testsuite/gdb.arch/s390-tdbregs.exp                |  6 +-----
 gdb/testsuite/gdb.arch/s390-vregs.exp                  |  5 +----
 gdb/testsuite/gdb.base/auxv.exp                        |  6 +-----
 gdb/testsuite/gdb.base/catch-fork-static.exp           |  4 +---
 gdb/testsuite/gdb.base/jit-reader.exp                  |  4 +---
 gdb/testsuite/gdb.server/extended-remote-restart.exp   |  4 +---
 gdb/testsuite/gdb.trace/stap-trace.exp                 |  4 +---
 gdb/testsuite/lib/gdb.exp                              | 10 ++++++++++
 28 files changed, 39 insertions(+), 110 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.exp b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
index 7f7863a1d57..8224d8d8218 100644
--- a/gdb/testsuite/gdb.arch/amd64-i386-address.exp
+++ b/gdb/testsuite/gdb.arch/amd64-i386-address.exp
@@ -18,11 +18,8 @@
 # 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
diff --git a/gdb/testsuite/gdb.arch/arm-neon.exp b/gdb/testsuite/gdb.arch/arm-neon.exp
index 54720e891e3..a34dbc3b051 100644
--- a/gdb/testsuite/gdb.arch/arm-neon.exp
+++ b/gdb/testsuite/gdb.arch/arm-neon.exp
@@ -15,10 +15,7 @@
 
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp
index 72523c5d47b..ad2cb5852d1 100644
--- a/gdb/testsuite/gdb.arch/i386-avx.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx.exp
@@ -19,10 +19,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-avx512.exp b/gdb/testsuite/gdb.arch/i386-avx512.exp
index b62cb9cf6bb..0c50591dcbe 100644
--- a/gdb/testsuite/gdb.arch/i386-avx512.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx512.exp
@@ -19,10 +19,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
index a36153cfe27..f70b0922212 100644
--- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
@@ -21,10 +21,7 @@
 # #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
 
diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
index 9f8b8e63409..d75ea648148 100644
--- a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
+++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
@@ -18,10 +18,7 @@
 
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
index 02a2380cd3f..07f292c3313 100644
--- a/gdb/testsuite/gdb.arch/i386-byte.exp
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -19,10 +19,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp
index 2356c3c3e78..b5c43f2db35 100644
--- a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp
+++ b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp
@@ -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
 
diff --git a/gdb/testsuite/gdb.arch/i386-float.exp b/gdb/testsuite/gdb.arch/i386-float.exp
index dd613444fdc..3ae6f849f34 100644
--- a/gdb/testsuite/gdb.arch/i386-float.exp
+++ b/gdb/testsuite/gdb.arch/i386-float.exp
@@ -18,10 +18,7 @@
 
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-call.exp b/gdb/testsuite/gdb.arch/i386-mpx-call.exp
index 8371546a8f9..95b68cd30df 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-call.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-call.exp
@@ -14,10 +14,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-map.exp b/gdb/testsuite/gdb.arch/i386-mpx-map.exp
index d95adef7d8b..6d95fd89171 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-map.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-map.exp
@@ -16,10 +16,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 { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
-    verbose "Skipping x86 MPX tests."
-    return
-}
+require {is_any_target i?86-*-* x86_64-*-*}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp b/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
index eaac31edbd3..84c04763257 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
@@ -16,10 +16,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp b/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
index a33c4f526f7..5f9568357b4 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx-simple_segv.exp
@@ -22,10 +22,7 @@
 #
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-mpx.exp b/gdb/testsuite/gdb.arch/i386-mpx.exp
index 5534ec9aa81..156c3ae7831 100644
--- a/gdb/testsuite/gdb.arch/i386-mpx.exp
+++ b/gdb/testsuite/gdb.arch/i386-mpx.exp
@@ -15,17 +15,11 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.exp b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
index f2a39666903..42171093ba7 100644
--- a/gdb/testsuite/gdb.arch/i386-permbkpt.exp
+++ b/gdb/testsuite/gdb.arch/i386-permbkpt.exp
@@ -18,10 +18,7 @@
 
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp
index 5d2b1a24a15..90d8c1d9d4c 100644
--- a/gdb/testsuite/gdb.arch/i386-pkru.exp
+++ b/gdb/testsuite/gdb.arch/i386-pkru.exp
@@ -15,10 +15,7 @@
 
 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*] } {
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
index 06cb2b1b818..256f6fde9e5 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
@@ -22,10 +22,7 @@
 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
index 9806970b245..17c6467076c 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -15,10 +15,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 {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} {
-    verbose "Skipping i386 unwinder tests."
-    return
-}
+require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp
index a178247e066..6df98ec1219 100644
--- a/gdb/testsuite/gdb.arch/i386-sse.exp
+++ b/gdb/testsuite/gdb.arch/i386-sse.exp
@@ -19,10 +19,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp
index 4e1e634bb12..42d4446c4d0 100644
--- a/gdb/testsuite/gdb.arch/i386-word.exp
+++ b/gdb/testsuite/gdb.arch/i386-word.exp
@@ -19,10 +19,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/s390-tdbregs.exp b/gdb/testsuite/gdb.arch/s390-tdbregs.exp
index 4908fff5619..7d1ea0bdedd 100644
--- a/gdb/testsuite/gdb.arch/s390-tdbregs.exp
+++ b/gdb/testsuite/gdb.arch/s390-tdbregs.exp
@@ -18,11 +18,7 @@
 
 # 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
 
diff --git a/gdb/testsuite/gdb.arch/s390-vregs.exp b/gdb/testsuite/gdb.arch/s390-vregs.exp
index b1f8eed6701..21f468f8472 100644
--- a/gdb/testsuite/gdb.arch/s390-vregs.exp
+++ b/gdb/testsuite/gdb.arch/s390-vregs.exp
@@ -15,10 +15,7 @@
 
 # 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
 
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 3529d55261d..89242b6f432 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -18,11 +18,7 @@
 # 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
 
diff --git a/gdb/testsuite/gdb.base/catch-fork-static.exp b/gdb/testsuite/gdb.base/catch-fork-static.exp
index a59c6808f85..2844843638f 100644
--- a/gdb/testsuite/gdb.base/catch-fork-static.exp
+++ b/gdb/testsuite/gdb.base/catch-fork-static.exp
@@ -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
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
index 399cb67dcce..d603ad975ff 100644
--- a/gdb/testsuite/gdb.base/jit-reader.exp
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -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
 
diff --git a/gdb/testsuite/gdb.server/extended-remote-restart.exp b/gdb/testsuite/gdb.server/extended-remote-restart.exp
index 6622b526125..8d3b384f348 100644
--- a/gdb/testsuite/gdb.server/extended-remote-restart.exp
+++ b/gdb/testsuite/gdb.server/extended-remote-restart.exp
@@ -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
diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp
index b40c7bc9e0d..34122737d20 100644
--- a/gdb/testsuite/gdb.trace/stap-trace.exp
+++ b/gdb/testsuite/gdb.trace/stap-trace.exp
@@ -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
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4b8337dbc1c..d30340e1df1 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -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
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 7/9] Add unsupported calls where needed
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
                   ` (5 preceding siblings ...)
  2023-01-24 23:02 ` [PATCH v2 6/9] Introduce and use is_any_target Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 8/9] Use require with is_remote Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 9/9] Move target check into allow_altivec_tests Tom Tromey
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

A number of tests will exit early without saying why.  This patch adds
"unsupported" at spots like this that I could readily find.

There are definitely more of these; for example dw2-ranges.exp fails
silently because a compilation fails.  I didn't attempt to address
these as that is a much larger task.
---
 gdb/testsuite/gdb.arch/pa-nullify.exp                | 2 +-
 gdb/testsuite/gdb.arch/powerpc-trap.exp              | 2 +-
 gdb/testsuite/gdb.base/remote.exp                    | 1 +
 gdb/testsuite/gdb.base/solib-disc.exp                | 1 +
 gdb/testsuite/gdb.dwarf2/implptr.exp                 | 1 +
 gdb/testsuite/gdb.server/extended-remote-restart.exp | 2 ++
 gdb/testsuite/gdb.threads/reconnect-signal.exp       | 1 +
 gdb/testsuite/gdb.trace/stap-trace.exp               | 1 +
 8 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/pa-nullify.exp b/gdb/testsuite/gdb.arch/pa-nullify.exp
index 4686ed29209..285047cc95f 100644
--- a/gdb/testsuite/gdb.arch/pa-nullify.exp
+++ b/gdb/testsuite/gdb.arch/pa-nullify.exp
@@ -26,7 +26,7 @@ switch -glob -- [istarget] {
 	set testfile "pa64-nullify"
     }
     "*" {
-        verbose "Skipping hppa nullification tests."
+        unsupported "Skipping hppa nullification tests."
         return
     }
 }
diff --git a/gdb/testsuite/gdb.arch/powerpc-trap.exp b/gdb/testsuite/gdb.arch/powerpc-trap.exp
index a1739f33c43..f197b1ab56b 100644
--- a/gdb/testsuite/gdb.arch/powerpc-trap.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-trap.exp
@@ -29,7 +29,7 @@ if { [istarget powerpc-*] } {
    # with the source file powerpc64-trap.s.
    set expected_traps 5
 } else {
-    verbose "Skipping ${gdb_test_file_name}."
+    unsupported "Skipping powerpc-specific tests"
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp
index 1ce27e8a958..a1c9973b802 100644
--- a/gdb/testsuite/gdb.base/remote.exp
+++ b/gdb/testsuite/gdb.base/remote.exp
@@ -16,6 +16,7 @@
 # Test only on boards that actually use the remote protocol.
 if {[target_info gdb_protocol] != "remote"
     && [target_info gdb_protocol] != "extended-remote"} {
+    unsupported "requires remote protocol"
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/solib-disc.exp b/gdb/testsuite/gdb.base/solib-disc.exp
index 0e3acfce954..46b11dc768b 100644
--- a/gdb/testsuite/gdb.base/solib-disc.exp
+++ b/gdb/testsuite/gdb.base/solib-disc.exp
@@ -19,6 +19,7 @@ require allow_shlib_tests
 
 set gdbserver_reconnect_p 1
 if { [info proc gdb_reconnect] == "" } {
+    unsupported "requires gdbserver reconnect"
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp
index a309994ecff..70d86ddf19a 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr.exp
@@ -29,6 +29,7 @@ if [info exists COMPILE] {
     lappend opts debug optimize=-O2
 } elseif {![is_x86_like_target]} {
     # This test can only be run on x86 targets.
+    unsupported "needs x86-like target"
     return 0  
 }
 
diff --git a/gdb/testsuite/gdb.server/extended-remote-restart.exp b/gdb/testsuite/gdb.server/extended-remote-restart.exp
index 8d3b384f348..b9eb2a69573 100644
--- a/gdb/testsuite/gdb.server/extended-remote-restart.exp
+++ b/gdb/testsuite/gdb.server/extended-remote-restart.exp
@@ -30,6 +30,7 @@
 
 # This test is only for extended remote targets.
 if {[target_info gdb_protocol] != "extended-remote"} {
+    unsupported "requires extended-remote"
     return
 }
 
@@ -40,6 +41,7 @@ require {is_any_target "*-*-linux*" "*-*-openbsd*"}
 # And we need to be able to reconnect to gdbserver.
 set gdbserver_reconnect_p 1
 if { [info proc gdb_reconnect] == "" } {
+    unsupported "requires gdbserver reconnect"
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.threads/reconnect-signal.exp b/gdb/testsuite/gdb.threads/reconnect-signal.exp
index bec68e62c91..dbc7d7d7806 100644
--- a/gdb/testsuite/gdb.threads/reconnect-signal.exp
+++ b/gdb/testsuite/gdb.threads/reconnect-signal.exp
@@ -17,6 +17,7 @@
 
 set gdbserver_reconnect_p 1
 if { [info proc gdb_reconnect] == "" } {
+    unsupported "requires gdbserver reconnect"
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp
index 34122737d20..39c2fa02ca1 100644
--- a/gdb/testsuite/gdb.trace/stap-trace.exp
+++ b/gdb/testsuite/gdb.trace/stap-trace.exp
@@ -115,6 +115,7 @@ if { ![runto_main] } {
 
 if { ![gdb_target_supports_trace] } {
     # Test cannot run on this target.
+    unsupported "test requires trace"
     return 1
 }
 
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 8/9] Use require with is_remote
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
                   ` (6 preceding siblings ...)
  2023-01-24 23:02 ` [PATCH v2 7/9] Add unsupported calls where needed Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  2023-01-24 23:02 ` [PATCH v2 9/9] Move target check into allow_altivec_tests Tom Tromey
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes some tests to use require with 'is_remote', rather than
an explicit test.  This adds uniformity helps clean up more spots
where a test might exit early without any notification.
---
 gdb/testsuite/gdb.base/annotate-symlink.exp       | 7 +++----
 gdb/testsuite/gdb.base/argv0-symlink.exp          | 5 +----
 gdb/testsuite/gdb.base/attach-pie-misread.exp     | 5 ++---
 gdb/testsuite/gdb.base/auto-load.exp              | 4 +---
 gdb/testsuite/gdb.base/break-interp.exp           | 5 ++---
 gdb/testsuite/gdb.base/bt-on-fatal-signal.exp     | 5 +----
 gdb/testsuite/gdb.base/fullname.exp               | 9 +++------
 gdb/testsuite/gdb.base/fullpath-expand.exp        | 7 +++----
 gdb/testsuite/gdb.base/gdbhistsize-history.exp    | 6 +-----
 gdb/testsuite/gdb.base/gdbinit-history.exp        | 9 +++------
 gdb/testsuite/gdb.base/info-fun.exp               | 4 +---
 gdb/testsuite/gdb.base/libsegfault.exp            | 5 +----
 gdb/testsuite/gdb.base/macro-source-path.exp      | 4 +---
 gdb/testsuite/gdb.base/prelink.exp                | 4 +---
 gdb/testsuite/gdb.base/realname-expand.exp        | 7 +++----
 gdb/testsuite/gdb.base/skip-solib.exp             | 5 ++---
 gdb/testsuite/gdb.base/solib-corrupted.exp        | 8 +++-----
 gdb/testsuite/gdb.base/solib-nodir.exp            | 4 +---
 gdb/testsuite/gdb.base/solib-search.exp           | 5 +----
 gdb/testsuite/gdb.base/startup-with-shell.exp     | 5 +----
 gdb/testsuite/gdb.base/style-logging.exp          | 5 +----
 gdb/testsuite/gdb.base/valgrind-bt.exp            | 5 +----
 gdb/testsuite/gdb.base/valgrind-disp-step.exp     | 5 +----
 gdb/testsuite/gdb.base/valgrind-infcall-2.exp     | 5 +----
 gdb/testsuite/gdb.base/valgrind-infcall.exp       | 5 +----
 gdb/testsuite/gdb.base/warning.exp                | 5 +----
 gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp    | 6 ++----
 gdb/testsuite/gdb.dwarf2/dwzbuildid.exp           | 4 +---
 gdb/testsuite/gdb.dwarf2/dwznolink.exp            | 4 +---
 gdb/testsuite/gdb.dwarf2/fission-base.exp         | 4 +---
 gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp | 4 +---
 gdb/testsuite/gdb.dwarf2/fission-loclists.exp     | 4 +---
 gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp     | 4 +---
 gdb/testsuite/gdb.dwarf2/fission-reread.exp       | 4 +---
 gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp     | 4 +---
 gdb/testsuite/gdb.linespec/macro-relative.exp     | 7 +++----
 gdb/testsuite/gdb.python/py-pp-maint.exp          | 5 +----
 gdb/testsuite/gdb.server/abspath.exp              | 4 +---
 gdb/testsuite/gdb.server/server-connect.exp       | 4 +---
 gdb/testsuite/gdb.server/server-pipe.exp          | 4 +---
 gdb/testsuite/gdb.threads/attach-into-signal.exp  | 5 ++---
 gdb/testsuite/gdb.threads/attach-slow-waitpid.exp | 5 ++---
 gdb/testsuite/gdb.threads/attach-stopped.exp      | 5 ++---
 43 files changed, 64 insertions(+), 156 deletions(-)

diff --git a/gdb/testsuite/gdb.base/annotate-symlink.exp b/gdb/testsuite/gdb.base/annotate-symlink.exp
index a0f8ed9eabc..73412406792 100644
--- a/gdb/testsuite/gdb.base/annotate-symlink.exp
+++ b/gdb/testsuite/gdb.base/annotate-symlink.exp
@@ -15,10 +15,9 @@
 
 standard_testfile realname-expand.c realname-expand-real.c
 
-if [is_remote host] {
-    unsupported "compiling on a remote host does not support a filename with directory."
-    return 0
-}
+# Compiling on a remote host does not support a filename with
+# directory.
+require {!is_remote host}
 
 set srcdirabs [file join [pwd] $srcdir]
 set srcfilelink [standard_output_file realname-expand-link.c]
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
index b321a244221..57b348b36bb 100644
--- a/gdb/testsuite/gdb.base/argv0-symlink.exp
+++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
@@ -22,10 +22,7 @@
 
 require isnative
 
-if { [is_remote host] } {
-    unsupported "argv0-symlink.exp not supported on remote host"
-    return -1
-}
+require {!is_remote host}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index 96f02429abd..484bd487a3b 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -15,9 +15,8 @@
 
 # This test only works on GNU/Linux.
 require !use_gdb_stub isnative allow_shlib_tests
-if { [is_remote host] || ![istarget *-linux*] } {
-    return
-}
+require {!is_remote host}
+require {istarget *-linux*}
 
 load_lib prelink-support.exp
 
diff --git a/gdb/testsuite/gdb.base/auto-load.exp b/gdb/testsuite/gdb.base/auto-load.exp
index 23cf72a942f..02ce0467730 100644
--- a/gdb/testsuite/gdb.base/auto-load.exp
+++ b/gdb/testsuite/gdb.base/auto-load.exp
@@ -15,9 +15,7 @@
 
 standard_testfile
 
-if [is_remote host] {
-    return 0
-}
+require {!is_remote host}
 
 set targetdir "${binfile}.dir"
 set sourcescript "${srcdir}/${subdir}/${testfile}-script"
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 9652b32b632..6061c739d05 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -15,9 +15,8 @@
 
 # This test only works on GNU/Linux.
 require !use_gdb_stub isnative allow_shlib_tests
-if { [is_remote host] || ![istarget *-linux*] } {
-    return
-}
+require {!is_remote host}
+require {istarget *-linux*}
 
 load_lib prelink-support.exp
 
diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
index 128db758284..d0364cc6b89 100644
--- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
+++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp
@@ -23,10 +23,7 @@ standard_testfile
 # remote host (will the signal go to GDB, or the program that
 # established the connection to the remote host?), so just skip this
 # test for remote host setups.
-if {[is_remote host]} {
-    untested $testfile
-    return -1
-}
+require {!is_remote host}
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
     return -1
diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index 19da89eae45..51ccb012688 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -18,12 +18,9 @@
 
 standard_testfile
 
-# We rely on being able to copy things around.
-
-if { [is_remote host] } {
-    untested "setting breakpoints by full path"
-    return -1
-}
+# We rely on being able to copy things around and being able to set
+# breakpoints by full path.
+require {!is_remote host}
 
 # Create a temporary file in the build directory.  Use a different
 # filename in case ${srcdir} == ${objdir}.
diff --git a/gdb/testsuite/gdb.base/fullpath-expand.exp b/gdb/testsuite/gdb.base/fullpath-expand.exp
index aee23fe0fea..285d0be08ec 100644
--- a/gdb/testsuite/gdb.base/fullpath-expand.exp
+++ b/gdb/testsuite/gdb.base/fullpath-expand.exp
@@ -15,10 +15,9 @@
 
 standard_testfile .c fullpath-expand-func.c
 
-if [is_remote host] {
-    unsupported "compiling on a remote host does not support a filename with directory."
-    return 0
-}
+# Compiling on a remote host does not support a filename with
+# directory.
+require {!is_remote host}
 
 if { [file pathtype $objdir] != "absolute" } {
     untested "objdir $objdir is not absolute"
diff --git a/gdb/testsuite/gdb.base/gdbhistsize-history.exp b/gdb/testsuite/gdb.base/gdbhistsize-history.exp
index d3e4a052c6b..59fd2d0c143 100644
--- a/gdb/testsuite/gdb.base/gdbhistsize-history.exp
+++ b/gdb/testsuite/gdb.base/gdbhistsize-history.exp
@@ -20,11 +20,7 @@
 
 # We cannot expect remote hosts to see environment variables set on the
 # local machine.
-
-if { [is_remote host] } {
-    unsupported "can't set environment variables on remote host"
-    return -1
-}
+require {!is_remote host}
 
 # Check that the history size is properly set to SIZE when the environment
 # variable ENV_VAR is set to GDBHISTSIZE.
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index 46d76b0e239..4c73293627c 100644
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -18,16 +18,13 @@
 # Test the setting of "history size" via $HOME/.gdbinit
 
 # This test depends on being able to set $HOME and $GDBHISTSIZE.
-# We cannot expect remote hosts to see environment variables set on the
-# local machine.
 
 # Do not run if gdb debug is enabled - it interferes with the command history.
 require !gdb_debug_enabled
 
-if { [is_remote host] } {
-    unsupported "can't set environment variables on remote host"
-    return -1
-}
+# We cannot expect remote hosts to see environment variables set on the
+# local machine.
+require {!is_remote host}
 
 # Check that the history size is properly set to SIZE when reading the .gdbinit
 # file located in HOME with the environment variable GDBHISTSIZE optionally
diff --git a/gdb/testsuite/gdb.base/info-fun.exp b/gdb/testsuite/gdb.base/info-fun.exp
index 683c732e671..c14d87b8cc7 100644
--- a/gdb/testsuite/gdb.base/info-fun.exp
+++ b/gdb/testsuite/gdb.base/info-fun.exp
@@ -13,9 +13,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 require allow_shlib_tests
-if { [is_remote target] } {
-    return 0
-}
+require {!is_remote target}
 
 # Library file.
 set libname "info-fun-solib"
diff --git a/gdb/testsuite/gdb.base/libsegfault.exp b/gdb/testsuite/gdb.base/libsegfault.exp
index 9a983992ea0..7862c9600fe 100644
--- a/gdb/testsuite/gdb.base/libsegfault.exp
+++ b/gdb/testsuite/gdb.base/libsegfault.exp
@@ -22,10 +22,7 @@
 
 # We cannot expect remote hosts to see environment variables set on
 # the local machine.
-if { [is_remote host] } {
-    unsupported "can't set environment variables on remote host"
-    return -1
-}
+require {!is_remote host}
 
 # Spawn GDB with LIB preloaded with LD_PRELOAD.  CMDLINE_OPTS are
 # command line options passed to GDB.
diff --git a/gdb/testsuite/gdb.base/macro-source-path.exp b/gdb/testsuite/gdb.base/macro-source-path.exp
index d46e93bb5c1..2d6eaeb6c65 100644
--- a/gdb/testsuite/gdb.base/macro-source-path.exp
+++ b/gdb/testsuite/gdb.base/macro-source-path.exp
@@ -23,9 +23,7 @@ standard_testfile
 # If the host is remote, source files are uploaded to the host and compiled
 # there, but without the directory structure we expect, making the test
 # pointless.  Skip the test in that case.
-if { [is_remote host] } {
-    return
-}
+require {!is_remote host}
 
 # Copy the source file at these locations in the output directory ($out):
 #
diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp
index 6945a923194..12837b95255 100644
--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -20,9 +20,7 @@
 
 
 require isnative allow_shlib_tests is_c_compiler_gcc
-if { [is_remote host] } {
-    return
-}
+require {!is_remote host}
 
 load_lib prelink-support.exp
 
diff --git a/gdb/testsuite/gdb.base/realname-expand.exp b/gdb/testsuite/gdb.base/realname-expand.exp
index ade6fe22c52..74dc725a4d0 100644
--- a/gdb/testsuite/gdb.base/realname-expand.exp
+++ b/gdb/testsuite/gdb.base/realname-expand.exp
@@ -15,10 +15,9 @@
 
 standard_testfile .c realname-expand-real.c
 
-if [is_remote host] {
-    unsupported "compiling on a remote host does not support a filename with directory."
-    return 0
-}
+# Compiling on a remote host does not support a filename with
+# directory.
+require {!is_remote host}
 
 set srcdirabs [file join [pwd] $srcdir]
 set srcfilelink [standard_output_file realname-expand-link.c]
diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base/skip-solib.exp
index e04bec9c504..3cdb455bb59 100644
--- a/gdb/testsuite/gdb.base/skip-solib.exp
+++ b/gdb/testsuite/gdb.base/skip-solib.exp
@@ -21,9 +21,8 @@
 
 # This only works on GNU/Linux.
 require isnative allow_shlib_tests
-if { [is_remote host] || ![istarget *-linux*] } {
-    return
-}
+require {!is_remote host}
+require {istarget *-linux*}
 
 set test "skip-solib"
 set srcfile_main "${test}-main.c"
diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp
index 644c8ece11f..e778711a9d6 100644
--- a/gdb/testsuite/gdb.base/solib-corrupted.exp
+++ b/gdb/testsuite/gdb.base/solib-corrupted.exp
@@ -15,11 +15,9 @@
 
 require allow_shlib_tests
 
-if {[is_remote target]} {
-    # gdbserver prints the warning message but expect is parsing only the GDB
-    # output, not the gdbserver output.
-    return 0
-}
+# gdbserver prints the warning message but expect is parsing only the GDB
+# output, not the gdbserver output.
+require {!is_remote target}
 
 set testfile "solib-corrupted"
 set srcfile start.c
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index dd0724909ad..1530d80d694 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.exp
@@ -16,9 +16,7 @@
 require allow_shlib_tests
 
 # The testcase assumes the target can access the OBJDIR.
-if [is_remote target] {
-    return
-}
+require {!is_remote target}
 
 # We need to be able to influence the target's environment and working
 # directory.  Can't do that if when we connect the inferior is already
diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp
index 5e9e3d43ee0..1d678efc2d5 100644
--- a/gdb/testsuite/gdb.base/solib-search.exp
+++ b/gdb/testsuite/gdb.base/solib-search.exp
@@ -17,10 +17,7 @@
 # is properly reset when the path is changed.
 
 require allow_shlib_tests
-if {[is_remote target]} {
-    untested "skipping remote target and shared library tests"
-    return -1
-}
+require {!is_remote target}
 
 # Build "wrong" and "right" versions of the libraries in separate directories.
 set wrong_lib_subdir "solib-search-wrong"
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
index b1f868b520a..51b1e4fa922 100644
--- a/gdb/testsuite/gdb.base/startup-with-shell.exp
+++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
@@ -20,10 +20,7 @@ require !use_gdb_stub
 
 # There's no easy way to set environment variables on remote targets
 # (via dejagnu) yet.
-if { [is_remote target] } {
-    untested "remote board"
-    return
-}
+require {!is_remote target}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
index dcf13575a17..a156c39146f 100644
--- a/gdb/testsuite/gdb.base/style-logging.exp
+++ b/gdb/testsuite/gdb.base/style-logging.exp
@@ -18,10 +18,7 @@
 # Do not run if gdb debug is enabled as it will interfere with log redirect.
 require !gdb_debug_enabled
 
-if {[is_remote host]} {
-    untested "does not work on remote host"
-    return 0
-}
+require {!is_remote host}
 
 standard_testfile style.c
 
diff --git a/gdb/testsuite/gdb.base/valgrind-bt.exp b/gdb/testsuite/gdb.base/valgrind-bt.exp
index da0261eabe6..6849a344ee3 100644
--- a/gdb/testsuite/gdb.base/valgrind-bt.exp
+++ b/gdb/testsuite/gdb.base/valgrind-bt.exp
@@ -18,10 +18,7 @@ require allow_xml_test
 
 load_lib valgrind.exp
 
-if [is_remote target] {
-    # The test always runs locally.
-    return 0
-}
+require {!is_remote target}
 
 standard_testfile .c
 if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
diff --git a/gdb/testsuite/gdb.base/valgrind-disp-step.exp b/gdb/testsuite/gdb.base/valgrind-disp-step.exp
index 3fb4341d2c7..1033ac8c6a7 100644
--- a/gdb/testsuite/gdb.base/valgrind-disp-step.exp
+++ b/gdb/testsuite/gdb.base/valgrind-disp-step.exp
@@ -23,10 +23,7 @@ require allow_xml_test
 
 load_lib valgrind.exp
 
-if [is_remote target] {
-    # The test always runs locally.
-    return 0
-}
+require {!is_remote target}
 
 standard_testfile .c
 if {[build_executable "failed to build" $testfile $srcfile {debug}] == -1} {
diff --git a/gdb/testsuite/gdb.base/valgrind-infcall-2.exp b/gdb/testsuite/gdb.base/valgrind-infcall-2.exp
index 6ed6ecd1d42..aa8f472cdb5 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall-2.exp
+++ b/gdb/testsuite/gdb.base/valgrind-infcall-2.exp
@@ -34,10 +34,7 @@ require allow_xml_test
 
 load_lib valgrind.exp
 
-if [is_remote target] {
-    # The test always runs locally.
-    return 0
-}
+require {!is_remote target}
 
 standard_testfile .c
 if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
diff --git a/gdb/testsuite/gdb.base/valgrind-infcall.exp b/gdb/testsuite/gdb.base/valgrind-infcall.exp
index bcaca02c900..01267734409 100644
--- a/gdb/testsuite/gdb.base/valgrind-infcall.exp
+++ b/gdb/testsuite/gdb.base/valgrind-infcall.exp
@@ -18,10 +18,7 @@ require allow_xml_test
 
 load_lib valgrind.exp
 
-if [is_remote target] {
-    # The test always runs locally.
-    return 0
-}
+require {!is_remote target}
 
 standard_testfile .c
 if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
diff --git a/gdb/testsuite/gdb.base/warning.exp b/gdb/testsuite/gdb.base/warning.exp
index 50e680b920d..e58bde537f1 100644
--- a/gdb/testsuite/gdb.base/warning.exp
+++ b/gdb/testsuite/gdb.base/warning.exp
@@ -15,10 +15,7 @@
 
 # Test that an early warning does not cause a crash.
 
-if {[is_remote host]} {
-    unsupported "warning.exp can only run on local host"
-    return
-}
+require {!is_remote host}
 
 set tname [standard_temp_file warning]
 set fd [open $tname w]
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
index 2f37d4d7955..a6beba443c4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -19,10 +19,8 @@ require dwarf2_support
 
 # This test has hard-wired assumptions that host and build filenames are
 # the same, and assumes POSIX pathname syntax.
-if { [is_remote host] || [ishost *-*-mingw*] } {
-    unsupported "can only run on local host"
-    return 0
-}
+require {!is_remote host}
+require {!ishost *-*-mingw*}
 
 # Find length of addresses in bytes.
 if {[is_64_target]} {
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
index 48fc619f869..1b9ba8da092 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
@@ -19,9 +19,7 @@ load_lib dwarf.exp
 require dwarf2_support
 
 # No remote host testing either.
-if {[is_remote host]} {
-    return 0
-}
+require {!is_remote host}
 
 
 # Lots of source files since we test a few cases and make new files
diff --git a/gdb/testsuite/gdb.dwarf2/dwznolink.exp b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
index a03bff29068..d0bfa6b57f7 100644
--- a/gdb/testsuite/gdb.dwarf2/dwznolink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
@@ -19,9 +19,7 @@ load_lib dwarf.exp
 require dwarf2_support
 
 # No remote host testing either.
-if {[is_remote host]} {
-    return 0
-}
+require {!is_remote host}
 
 standard_testfile main.c dwznolink.S
 
diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp
index c3338c2951d..b654de40fcb 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp
@@ -16,9 +16,7 @@
 load_lib dwarf.exp
 
 # We run objcopy locally to split out the .dwo file.
-if [is_remote host] {
-    return 0
-}
+require {!is_remote host}
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
index c13450da03d..a6fb3e875a8 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
@@ -21,9 +21,7 @@
 load_lib dwarf.exp
 
 # We run objcopy locally to split out the .dwo file.
-if [is_remote host] {
-    return 0
-}
+require {!is_remote host}
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
index 31c7bcafbaf..d906eeb69cc 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp
@@ -16,9 +16,7 @@
 load_lib dwarf.exp
 
 # We run objcopy locally to split out the .dwo file.
-if [is_remote host] {
-    return 0
-}
+require {!is_remote host}
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
index 7bdf6271f5a..0a2a079e82b 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp
@@ -19,9 +19,7 @@
 load_lib dwarf.exp
 
 # We run objcopy locally to split out the .dwo file.
-if [is_remote host] {
-    return 0
-}
+require {!is_remote host}
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
index 0ef2b134ea0..01e9eada575 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
@@ -16,9 +16,7 @@
 load_lib dwarf.exp
 
 # We run objcopy locally to split out the .dwo file.
-if [is_remote host] {
-    return 0
-}
+require {!is_remote host}
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
diff --git a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
index 871a1867308..538004ec95a 100644
--- a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
+++ b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp
@@ -21,9 +21,7 @@ load_lib dwarf.exp
 require dwarf2_support
 
 # No remote host testing either.
-if {[is_remote host]} {
-    return 0
-}
+require {!is_remote host}
 
 standard_testfile main.c no-gnu-debuglink.S
 
diff --git a/gdb/testsuite/gdb.linespec/macro-relative.exp b/gdb/testsuite/gdb.linespec/macro-relative.exp
index 41159431ddc..4e79ecfc8b4 100644
--- a/gdb/testsuite/gdb.linespec/macro-relative.exp
+++ b/gdb/testsuite/gdb.linespec/macro-relative.exp
@@ -18,10 +18,9 @@ standard_testfile
 # Fission doesn't support macros yet.  Bug 15954.
 require !using_fission
 
-if [is_remote host] {
-    unsupported "compiling on a remote host does not support a filename with directory."
-    return 0
-}
+# Compiling on a remote host does not support a filename with
+# directory.
+require {!is_remote host}
 
 set opts {debug additional_flags=-I. macros}
 
diff --git a/gdb/testsuite/gdb.python/py-pp-maint.exp b/gdb/testsuite/gdb.python/py-pp-maint.exp
index 5e5b8030d20..dc5a1a68955 100644
--- a/gdb/testsuite/gdb.python/py-pp-maint.exp
+++ b/gdb/testsuite/gdb.python/py-pp-maint.exp
@@ -16,10 +16,7 @@
 # This file is part of the GDB testsuite.  It tests Python-based
 # pretty-printing for the CLI.
 
-if [is_remote host] {
-    untested "py-pp-maint.exp can only be run locally"
-    return -1
-}
+require {!is_remote host}
 
 load_lib gdb-python.exp
 
diff --git a/gdb/testsuite/gdb.server/abspath.exp b/gdb/testsuite/gdb.server/abspath.exp
index 46657c65e8f..f58d96257c2 100644
--- a/gdb/testsuite/gdb.server/abspath.exp
+++ b/gdb/testsuite/gdb.server/abspath.exp
@@ -27,9 +27,7 @@ require allow_gdbserver_tests
 # Because we're relying on being able to change our CWD before
 # executing gdbserver, we just run if we're not testing with a remote
 # target.
-if { [is_remote target] } {
-    return 0
-}
+require {!is_remote target}
 
 save_vars { GDBFLAGS } {
     # If GDB and GDBserver are both running locally, set the sysroot to avoid
diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp
index 6c4c969c30d..1f5b9a27cf4 100644
--- a/gdb/testsuite/gdb.server/server-connect.exp
+++ b/gdb/testsuite/gdb.server/server-connect.exp
@@ -25,9 +25,7 @@ standard_testfile normal.c
 require allow_gdbserver_tests
 
 # We want to have control over where we start gdbserver.
-if { [is_remote target] } {
-    return 0
-}
+require {!is_remote target}
 
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
     return -1
diff --git a/gdb/testsuite/gdb.server/server-pipe.exp b/gdb/testsuite/gdb.server/server-pipe.exp
index 48b79fe723c..e4ad0ce7854 100644
--- a/gdb/testsuite/gdb.server/server-pipe.exp
+++ b/gdb/testsuite/gdb.server/server-pipe.exp
@@ -24,9 +24,7 @@
 # This test relies on starting gdbserver using the pipe syntax.  Not
 # sure how well this will run if part of this test is being run
 # elsewhere.
-if { [is_remote target] || [is_remote host] } {
-    return 0
-}
+require {!is_remote target} {!is_remote host}
 
 load_lib gdbserver-support.exp
 
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index 4a5caaa2e85..e5cc1f9b9bb 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -18,9 +18,8 @@
 
 # This test only works on Linux
 require !use_gdb_stub isnative
-if { [is_remote host] || ![istarget *-linux*] } {
-    return
-}
+require {!is_remote host}
+require {istarget *-linux*}
 
 standard_testfile
 set executable_nothr ${testfile}-nothr
diff --git a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
index 7512a672890..85db583b0de 100644
--- a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
+++ b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
@@ -38,9 +38,8 @@
 
 # This test only works on Linux
 require !use_gdb_stub isnative
-if { [is_remote host] || ![istarget *-linux*] } {
-    return
-}
+require {!is_remote host}
+require {istarget *-linux*}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 35b31afafaf..25d63b37090 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -19,9 +19,8 @@
 
 # This test only works on Linux
 require !use_gdb_stub isnative
-if { [is_remote host] || ![istarget *-linux*] } {
-    return
-}
+require {!is_remote host}
+require {istarget *-linux*}
 
 standard_testfile
 set escapedbinfile  [string_to_regexp $binfile]
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 9/9] Move target check into allow_altivec_tests
  2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
                   ` (7 preceding siblings ...)
  2023-01-24 23:02 ` [PATCH v2 8/9] Use require with is_remote Tom Tromey
@ 2023-01-24 23:02 ` Tom Tromey
  8 siblings, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2023-01-24 23:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Pedro pointed out that only PPC can possibly have altivec, so we can
move the target check into allow_altivec_tests.
---
 gdb/testsuite/gdb.arch/altivec-abi.exp         | 1 -
 gdb/testsuite/gdb.arch/altivec-regs.exp        | 1 -
 gdb/testsuite/gdb.arch/powerpc-vector-regs.exp | 2 +-
 gdb/testsuite/lib/gdb.exp                      | 5 +++++
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 2cc75d4d617..b04858950e8 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -22,7 +22,6 @@
 #
 
 require allow_altivec_tests
-require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 315ce1acfb2..6cc32aeff22 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -22,7 +22,6 @@
 #
 
 require allow_altivec_tests
-require {istarget "powerpc*"}
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
index 2447d740624..2958af019cb 100644
--- a/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-vector-regs.exp
@@ -20,7 +20,7 @@
 # 0 to 31 in each of the 16 bytes of each corresponding register, and
 # we then check if gdb sees these same values.
 
-require allow_altivec_tests {[istarget "powerpc*"}
+require allow_altivec_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d30340e1df1..e2af5a252b7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3471,6 +3471,11 @@ gdb_caching_proc allow_altivec_tests {
 	return 0
     }
 
+    if {![istarget powerpc*]} {
+	verbose "$me: PPC target required, returning 0" 2
+	return 0
+    }
+
     # Make sure we have a compiler that understands altivec.
     if [test_compiler_info gcc*] {
         set compile_flags "additional_flags=-maltivec"
-- 
2.39.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/9] Convert skip_altivec_tests to allow form
  2023-01-24 23:02 ` [PATCH v2 1/9] Convert skip_altivec_tests to allow form Tom Tromey
@ 2023-01-25 10:54   ` Pedro Alves
  0 siblings, 0 replies; 11+ messages in thread
From: Pedro Alves @ 2023-01-25 10:54 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 2023-01-24 11:02 p.m., Tom Tromey wrote:
> -if {![istarget "powerpc*"] || [skip_altivec_tests]} {
> +require allow_altivec_tests
> +if {![istarget "powerpc*"]} {
>      verbose "Skipping altivec abi tests."
>      return
>  }

I noticed that this transformation changed one thing -- we'd now run allow_altivec_tests,
and hence the compilation tests that allow_altivec_tests does, on all targets, while
before we wouldn't, since the istarget check used to be before the skip_altivec_tests check.

Functionally, it's the same, even though it slows down testing a tiny bit for non-powerpc targets.

In the end, you'd now added the patch that removes this istarget check in the last patch of the
series, so it's good as is, no need to change anything here.

I went to look whether the skip_power_isa_3_1_tests and skip_vsx_tests patches (patches #3 and #4) were
likewise affected (as those are similar and could also have the istarget check pushed
down), but in those you've kept the order:

 -if {![istarget "powerpc*-*-linux*"] || [skip_vsx_tests]} {
 +if {![istarget "powerpc*-*-linux*"]} {
      verbose "Skipping PowerPC test for corefiles with VSX registers."
      return
  }
 +require allow_vsx_tests

... so we're all good.

The whole series looks good to me.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-25 10:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 23:02 [PATCH v2 0/9] Use 'require' even more Tom Tromey
2023-01-24 23:02 ` [PATCH v2 1/9] Convert skip_altivec_tests to allow form Tom Tromey
2023-01-25 10:54   ` Pedro Alves
2023-01-24 23:02 ` [PATCH v2 2/9] Rename skip_float_test " Tom Tromey
2023-01-24 23:02 ` [PATCH v2 3/9] Rename skip_power_isa_3_1_tests " Tom Tromey
2023-01-24 23:02 ` [PATCH v2 4/9] Rename skip_vsx_tests " Tom Tromey
2023-01-24 23:02 ` [PATCH v2 5/9] Use require with istarget Tom Tromey
2023-01-24 23:02 ` [PATCH v2 6/9] Introduce and use is_any_target Tom Tromey
2023-01-24 23:02 ` [PATCH v2 7/9] Add unsupported calls where needed Tom Tromey
2023-01-24 23:02 ` [PATCH v2 8/9] Use require with is_remote Tom Tromey
2023-01-24 23:02 ` [PATCH v2 9/9] Move target check into allow_altivec_tests Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).