[09/46] Use require skip_shlib_tests

Message ID 20221217000818.3729389-10-tom@tromey.com
State Committed
Headers
Series Rewrite "require" test procedure and use it more often |

Commit Message

Tom Tromey Dec. 17, 2022, 12:07 a.m. UTC
  This changes some tests to use "require skip_shlib_tests".
---
 gdb/testsuite/gdb.ada/catch_ex_std.exp                 |  4 +---
 gdb/testsuite/gdb.base/bfd-errors.exp                  |  4 +---
 gdb/testsuite/gdb.base/break-probes.exp                |  4 +---
 gdb/testsuite/gdb.base/catch-load.exp                  |  5 +----
 gdb/testsuite/gdb.base/ctxobj.exp                      |  4 +---
 gdb/testsuite/gdb.base/dprintf-pending.exp             |  4 +---
 gdb/testsuite/gdb.base/dso2dso.exp                     |  4 +---
 gdb/testsuite/gdb.base/fixsection.exp                  |  4 +---
 .../gdb.base/fork-no-detach-follow-child-dlopen.exp    |  4 +---
 gdb/testsuite/gdb.base/gcore-relro.exp                 |  4 +---
 gdb/testsuite/gdb.base/gdb1555.exp                     |  4 +---
 gdb/testsuite/gdb.base/global-var-nested-by-dso.exp    |  4 +---
 gdb/testsuite/gdb.base/gnu-ifunc.exp                   |  4 +---
 gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp   |  4 +---
 gdb/testsuite/gdb.base/info-shared.exp                 |  4 +---
 gdb/testsuite/gdb.base/info_sources_2.exp              |  4 +---
 gdb/testsuite/gdb.base/jit-bfd-name.exp                |  5 +----
 gdb/testsuite/gdb.base/jit-elf-fork.exp                |  5 +----
 gdb/testsuite/gdb.base/jit-elf-so.exp                  |  5 +----
 gdb/testsuite/gdb.base/jit-elf.exp                     |  5 +----
 gdb/testsuite/gdb.base/jit-reader-simple.exp           |  5 +----
 gdb/testsuite/gdb.base/jit-reader.exp                  |  4 +---
 gdb/testsuite/gdb.base/msym-bp-shl.exp                 |  4 +---
 gdb/testsuite/gdb.base/pending.exp                     |  4 +---
 gdb/testsuite/gdb.base/print-file-var.exp              |  4 +---
 gdb/testsuite/gdb.base/print-symbol-loading.exp        |  4 +---
 gdb/testsuite/gdb.base/shlib-call.exp                  |  4 +---
 gdb/testsuite/gdb.base/shreloc.exp                     |  4 +---
 gdb/testsuite/gdb.base/so-impl-ld.exp                  |  4 +---
 gdb/testsuite/gdb.base/solib-corrupted.exp             |  4 +---
 gdb/testsuite/gdb.base/solib-disc.exp                  |  4 +---
 gdb/testsuite/gdb.base/solib-display.exp               |  4 +---
 gdb/testsuite/gdb.base/solib-nodir.exp                 |  4 +---
 gdb/testsuite/gdb.base/solib-overlap.exp               |  4 +---
 gdb/testsuite/gdb.base/solib-symbol.exp                |  4 +---
 gdb/testsuite/gdb.base/solib-vanish.exp                |  4 +---
 gdb/testsuite/gdb.base/solib-weak.exp                  |  4 +---
 gdb/testsuite/gdb.base/sym-file.exp                    |  4 +---
 gdb/testsuite/gdb.base/symtab-search-order.exp         |  4 +---
 gdb/testsuite/gdb.base/type-opaque.exp                 |  4 +---
 gdb/testsuite/gdb.base/unload.exp                      |  4 +---
 gdb/testsuite/gdb.base/watchpoint-solib.exp            |  4 +---
 gdb/testsuite/gdb.btrace/dlopen.exp                    | 10 +---------
 gdb/testsuite/gdb.compile/compile.exp                  |  5 +----
 gdb/testsuite/gdb.cp/except-multi-location.exp         |  4 +---
 gdb/testsuite/gdb.cp/infcall-dlopen.exp                |  4 +---
 gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp            |  6 +-----
 .../gdb.dwarf2/locexpr-data-member-location.exp        |  4 +---
 gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp         |  4 +---
 gdb/testsuite/gdb.mi/mi-catch-load.exp                 |  4 +---
 gdb/testsuite/gdb.mi/mi-dprintf-pending.exp            |  4 +---
 gdb/testsuite/gdb.mi/mi-pending.exp                    |  4 +---
 gdb/testsuite/gdb.mi/mi-solib.exp                      |  5 +----
 gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp       |  4 +---
 gdb/testsuite/gdb.opt/solib-intra-step.exp             |  4 +---
 gdb/testsuite/gdb.python/py-event-load.exp             |  5 +----
 gdb/testsuite/gdb.python/py-finish-breakpoint.exp      |  5 +----
 gdb/testsuite/gdb.python/py-shared.exp                 |  4 +---
 gdb/testsuite/gdb.server/server-exec-info.exp          |  4 +---
 gdb/testsuite/gdb.server/solib-list.exp                |  4 +---
 gdb/testsuite/gdb.threads/dlopen-libpthread.exp        |  3 ++-
 gdb/testsuite/gdb.trace/change-loc.exp                 |  4 +---
 gdb/testsuite/gdb.trace/ftrace-lock.exp                |  4 +---
 gdb/testsuite/gdb.trace/ftrace.exp                     |  4 +---
 gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp      |  4 +---
 gdb/testsuite/gdb.trace/pending.exp                    |  4 +---
 gdb/testsuite/gdb.trace/range-stepping.exp             |  4 +---
 gdb/testsuite/gdb.trace/strace.exp                     |  4 +---
 gdb/testsuite/gdb.trace/trace-break.exp                |  4 +---
 gdb/testsuite/gdb.trace/trace-condition.exp            |  4 +---
 gdb/testsuite/gdb.trace/trace-enable-disable.exp       |  4 +---
 gdb/testsuite/gdb.trace/trace-mt.exp                   |  4 +---
 gdb/testsuite/gdb.trace/tspeed.exp                     |  4 +---
 73 files changed, 74 insertions(+), 235 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index 4d6f2a91c19..c8e0c288127 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 load_lib "ada.exp"
 
diff --git a/gdb/testsuite/gdb.base/bfd-errors.exp b/gdb/testsuite/gdb.base/bfd-errors.exp
index e436e40ba6e..cb94dea4ae1 100644
--- a/gdb/testsuite/gdb.base/bfd-errors.exp
+++ b/gdb/testsuite/gdb.base/bfd-errors.exp
@@ -46,9 +46,7 @@ 
 
 # This test can't be run on targets lacking shared library support
 # or for non-ELF targets.
-if { [skip_shlib_tests] || ![is_elf_target] } {
-    return 0
-}
+require !skip_shlib_tests is_elf_target
 
 # Library file names and flags:
 set lib_basename ${::gdb_test_file_name}-lib
diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp
index 51687c5ca68..93ac44d29a8 100644
--- a/gdb/testsuite/gdb.base/break-probes.exp
+++ b/gdb/testsuite/gdb.base/break-probes.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 { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index f8677b0a53d..70149513e0c 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -13,10 +13,7 @@ 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 standard_testfile .c
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
diff --git a/gdb/testsuite/gdb.base/ctxobj.exp b/gdb/testsuite/gdb.base/ctxobj.exp
index 228a6890f11..4c0430365e3 100644
--- a/gdb/testsuite/gdb.base/ctxobj.exp
+++ b/gdb/testsuite/gdb.base/ctxobj.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 {[skip_shlib_tests]} {
-    return -1
-}
+require !skip_shlib_tests
 
 set executable ctxobj-m
 
diff --git a/gdb/testsuite/gdb.base/dprintf-pending.exp b/gdb/testsuite/gdb.base/dprintf-pending.exp
index 2ab8d52f146..ccaef55b510 100644
--- a/gdb/testsuite/gdb.base/dprintf-pending.exp
+++ b/gdb/testsuite/gdb.base/dprintf-pending.exp
@@ -14,9 +14,7 @@ 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 set libfile "dprintf-pendshr"
diff --git a/gdb/testsuite/gdb.base/dso2dso.exp b/gdb/testsuite/gdb.base/dso2dso.exp
index 4c7a76d2dbe..0fd0e46b0f2 100644
--- a/gdb/testsuite/gdb.base/dso2dso.exp
+++ b/gdb/testsuite/gdb.base/dso2dso.exp
@@ -23,9 +23,7 @@ 
 # also happens to exercise an issue with displaced stepping on amd64
 # when libdso1 is mapped at an address greater than 0xffffffff.
 
-if { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/fixsection.exp b/gdb/testsuite/gdb.base/fixsection.exp
index 0872017e015..3493132b332 100644
--- a/gdb/testsuite/gdb.base/fixsection.exp
+++ b/gdb/testsuite/gdb.base/fixsection.exp
@@ -14,9 +14,7 @@ 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .c
 
diff --git a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp
index e8b61450b47..91576818532 100644
--- a/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp
+++ b/gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp
@@ -23,9 +23,7 @@ 
 # in the source of the shlib, and "list" should display the source where
 # the program stopped.
 
-if { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .c -shlib.c
 set shlib_path [standard_output_file ${testfile}-lib.so]
diff --git a/gdb/testsuite/gdb.base/gcore-relro.exp b/gdb/testsuite/gdb.base/gcore-relro.exp
index 4530a9d094a..5b15c08c209 100644
--- a/gdb/testsuite/gdb.base/gcore-relro.exp
+++ b/gdb/testsuite/gdb.base/gcore-relro.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile gcore-relro-main.c
 set libfile gcore-relro-lib
diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
index 1d603ab94c0..aef6af0eae1 100644
--- a/gdb/testsuite/gdb.base/gdb1555.exp
+++ b/gdb/testsuite/gdb.base/gdb1555.exp
@@ -17,9 +17,7 @@ 
 # a shared library (PR gdb/1555, was PR shlib/1280, shlib/1237).
 # Tested on ppc-yellowdog-linux (Yellow Dog Linux 3.0 3.2.2-2a)
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile gdb1555-main.c gdb1555.c
 
diff --git a/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp b/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp
index ff9414e63b9..7839c3cfd36 100644
--- a/gdb/testsuite/gdb.base/global-var-nested-by-dso.exp
+++ b/gdb/testsuite/gdb.base/global-var-nested-by-dso.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 { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index 715f5be04cb..f875443d830 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 if {[skip_ifunc_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
index 4836e133107..a4fcca876b9 100644
--- a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
+++ b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
@@ -17,9 +17,7 @@ 
 # when the target doesn't support hw breakpoints doesn't silently
 # error out without informing the user.
 
-if {[skip_shlib_tests]} {
-    return -1
-}
+require !skip_shlib_tests
 
 set main_src hbreak-in-shr-unsupported.c
 set lib_src hbreak-in-shr-unsupported-shr.c
diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp
index 8d3484b186c..a520e4d18d3 100644
--- a/gdb/testsuite/gdb.base/info-shared.exp
+++ b/gdb/testsuite/gdb.base/info-shared.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 { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/info_sources_2.exp b/gdb/testsuite/gdb.base/info_sources_2.exp
index 9fe3d479018..7a6a10b6435 100644
--- a/gdb/testsuite/gdb.base/info_sources_2.exp
+++ b/gdb/testsuite/gdb.base/info_sources_2.exp
@@ -16,9 +16,7 @@ 
 # Test 'info sources' when the test file makes use of a shared
 # library.
 
-if { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 set is_remote_target [is_remote target]
 
diff --git a/gdb/testsuite/gdb.base/jit-bfd-name.exp b/gdb/testsuite/gdb.base/jit-bfd-name.exp
index 7c8ad50d072..03039eeea39 100644
--- a/gdb/testsuite/gdb.base/jit-bfd-name.exp
+++ b/gdb/testsuite/gdb.base/jit-bfd-name.exp
@@ -20,10 +20,7 @@ 
 # Additionally, check that GDB cau use 'dump binary memory' to write
 # out the in-memory JIT files.
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 load_lib jit-elf-helpers.exp
 
diff --git a/gdb/testsuite/gdb.base/jit-elf-fork.exp b/gdb/testsuite/gdb.base/jit-elf-fork.exp
index a8e85b30e1b..17a1bcaba73 100644
--- a/gdb/testsuite/gdb.base/jit-elf-fork.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-fork.exp
@@ -15,10 +15,7 @@ 
 
 # Test fork handling of an inferior that has JIT-ed objfiles.
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 load_lib jit-elf-helpers.exp
 
diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp
index d5f56600701..c3e357785a6 100644
--- a/gdb/testsuite/gdb.base/jit-elf-so.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-so.exp
@@ -16,10 +16,7 @@ 
 # The same tests as in jit.exp, but loading JITer itself from a shared
 # library.
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 load_lib jit-elf-helpers.exp
 
diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp
index 0753072974f..eaa30b69399 100644
--- a/gdb/testsuite/gdb.base/jit-elf.exp
+++ b/gdb/testsuite/gdb.base/jit-elf.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 {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 load_lib jit-elf-helpers.exp
 
diff --git a/gdb/testsuite/gdb.base/jit-reader-simple.exp b/gdb/testsuite/gdb.base/jit-reader-simple.exp
index a8b632628e4..75193c2bcc2 100644
--- a/gdb/testsuite/gdb.base/jit-reader-simple.exp
+++ b/gdb/testsuite/gdb.base/jit-reader-simple.exp
@@ -24,10 +24,7 @@ 
 # For completeness, also test when the JIT descriptor does not change
 # address between runs.
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
index a66896dda67..bda31fef0a6 100644
--- a/gdb/testsuite/gdb.base/jit-reader.exp
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -22,9 +22,7 @@  if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) || ![is_lp64_target] } {
     return -1;
 }
 
-if {[skip_shlib_tests]} {
-    return -1
-}
+require !skip_shlib_tests
 
 if { ![isnative] } {
     return -1
diff --git a/gdb/testsuite/gdb.base/msym-bp-shl.exp b/gdb/testsuite/gdb.base/msym-bp-shl.exp
index 42adcb191dd..fdf22269c79 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl.exp
+++ b/gdb/testsuite/gdb.base/msym-bp-shl.exp
@@ -18,9 +18,7 @@ 
 # static function named "foo" exists in the shared library.  Tests
 # both with and without debug info.
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile msym-bp-shl-main.c msym-bp-shl-main-2.c msym-bp-shl-lib.c
 set srcfile ${srcdir}/${subdir}/${srcfile}
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index 1de35ea9927..3227675a156 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -19,9 +19,7 @@ 
 # test running programs
 #
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .c
 set libfile "pendshr"
diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp
index 841eb22d957..136e4d362aa 100644
--- a/gdb/testsuite/gdb.base/print-file-var.exp
+++ b/gdb/testsuite/gdb.base/print-file-var.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 {[skip_shlib_tests]} {
-    return -1
-}
+require !skip_shlib_tests
 
 proc test {hidden dlopen version_id_main lang} {
     global srcdir subdir
diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp
index 6de1a748d28..76c19b3c047 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading.exp
+++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp
@@ -15,9 +15,7 @@ 
 
 # Test the "print symbol-loading" option.
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile print-symbol-loading-main.c
 set libfile print-symbol-loading-lib
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index b148e91520e..26e0e6e5c48 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -29,9 +29,7 @@ 
 #prop lib shr2.sl
 
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 if { [is_remote host] } {
     gdb_remote_download host $srcdir/$subdir/ss.h
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index ad10d5f3497..326a826d78b 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -19,9 +19,7 @@ 
 # them gets relocated at load-time. Check that gdb gets the right
 # values for the debugging and minimal symbols.
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 #
 # This file uses shreloc.c, shreloc1.c and shreloc2.c
diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index 1822c03138c..8448617f6e3 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -14,9 +14,7 @@ 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .c
 set libfile "solib1"
diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp
index d65c32cad9c..594432acbc0 100644
--- a/gdb/testsuite/gdb.base/solib-corrupted.exp
+++ b/gdb/testsuite/gdb.base/solib-corrupted.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 if {[is_remote target]} {
     # gdbserver prints the warning message but expect is parsing only the GDB
diff --git a/gdb/testsuite/gdb.base/solib-disc.exp b/gdb/testsuite/gdb.base/solib-disc.exp
index 2433425bf00..c4de2e01ef0 100644
--- a/gdb/testsuite/gdb.base/solib-disc.exp
+++ b/gdb/testsuite/gdb.base/solib-disc.exp
@@ -15,9 +15,7 @@ 
 
 # Test connecting and disconnecting at shared library events.
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 set gdbserver_reconnect_p 1
 if { [info proc gdb_reconnect] == "" } {
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index 6da4b8d4d4a..79e46865eba 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -28,9 +28,7 @@ 
 # (and thus aren't affected by shared library unloading) are not
 # disabled prematurely.
 
-if { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 # This test is currently not supported for stub targets, because it uses the
 # start command (through gdb_start_cmd).  In theory, it could be changed to
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index c687b7eb511..b97064911dd 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.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 [skip_shlib_tests] {
-    return
-}
+require !skip_shlib_tests
 
 # The testcase assumes the target can access the OBJDIR.
 if [is_remote target] {
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index 3d9110baf2c..51378826657 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -27,9 +27,7 @@ 
 #   difference appears to be caused by prelink, adjusting expectations
 # In such case both disk libraries will be loaded at VMAs starting at zero.
 
-if [skip_shlib_tests] {
-    return 0
-}
+require !skip_shlib_tests
 
 if {![can_spawn_for_attach]} {
     return 0
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index ff812a7e87b..04cbffa4a59 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -15,9 +15,7 @@ 
 # Contributed by Markus Deuling <deuling@de.ibm.com>.
 #
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 # Library file.
 set libname "solib-symbol-lib"
diff --git a/gdb/testsuite/gdb.base/solib-vanish.exp b/gdb/testsuite/gdb.base/solib-vanish.exp
index 57e0b684dc8..1942f4487b2 100644
--- a/gdb/testsuite/gdb.base/solib-vanish.exp
+++ b/gdb/testsuite/gdb.base/solib-vanish.exp
@@ -53,9 +53,7 @@ 
 # 1) GDB does not segfault when stepping
 # 2) The stack frame is printed
 
-if { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 # Library 2
 set lib2name "solib-vanish-lib2"
diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp
index a8a9fc915b3..68d34c0bea2 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -17,9 +17,7 @@ 
 # than one shared library, when one of the implementations is a "weak"
 # symbol.  GDB should set a breakpoint at the first copy it finds.
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 # These targets have shared libraries, but weak symbols are not meaningful.
 if {([istarget *-*-mingw*]
diff --git a/gdb/testsuite/gdb.base/sym-file.exp b/gdb/testsuite/gdb.base/sym-file.exp
index c73facb1658..b93e99ed9a3 100644
--- a/gdb/testsuite/gdb.base/sym-file.exp
+++ b/gdb/testsuite/gdb.base/sym-file.exp
@@ -33,9 +33,7 @@  if {![is_elf_target]} {
     return 0
 }
 
-if [skip_shlib_tests] {
-    return 0
-}
+require !skip_shlib_tests
 
 set target_size TARGET_UNKNOWN
 if {[is_lp64_target]} {
diff --git a/gdb/testsuite/gdb.base/symtab-search-order.exp b/gdb/testsuite/gdb.base/symtab-search-order.exp
index d811af3cdec..bae7f8e458a 100644
--- a/gdb/testsuite/gdb.base/symtab-search-order.exp
+++ b/gdb/testsuite/gdb.base/symtab-search-order.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .c symtab-search-order-1.c symtab-search-order-shlib-1.c
 set srcfile  $srcdir/$subdir/$srcfile
diff --git a/gdb/testsuite/gdb.base/type-opaque.exp b/gdb/testsuite/gdb.base/type-opaque.exp
index 35ccfb7ec68..6ec51802ef5 100644
--- a/gdb/testsuite/gdb.base/type-opaque.exp
+++ b/gdb/testsuite/gdb.base/type-opaque.exp
@@ -15,9 +15,7 @@ 
 
 # Test resolving of an opaque type from the loaded shared library.
 
-if {[skip_shlib_tests]} {
-    return -1
-}
+require !skip_shlib_tests
 
 standard_testfile type-opaque-main.c
 
diff --git a/gdb/testsuite/gdb.base/unload.exp b/gdb/testsuite/gdb.base/unload.exp
index 0a66814ac3f..9c5ad2e16fb 100644
--- a/gdb/testsuite/gdb.base/unload.exp
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -19,9 +19,7 @@ 
 # test running programs
 #
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 set testfile "unload"
 set libfile "unloadshr"
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.exp b/gdb/testsuite/gdb.base/watchpoint-solib.exp
index a3fb5041294..1325a8fa40d 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp
@@ -26,9 +26,7 @@  set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
 #
 
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 set testfile "watchpoint-solib"
 set libfile "watchpoint-solib-shr"
diff --git a/gdb/testsuite/gdb.btrace/dlopen.exp b/gdb/testsuite/gdb.btrace/dlopen.exp
index 3557be98662..e9bd54dac90 100644
--- a/gdb/testsuite/gdb.btrace/dlopen.exp
+++ b/gdb/testsuite/gdb.btrace/dlopen.exp
@@ -15,15 +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 { [skip_btrace_tests] } {
-    unsupported "target does not support record-btrace"
-    return -1
-}
-
-if { [skip_shlib_tests]  } {
-    unsupported "target does not support shared library tests"
-    return -1
-}
+require !skip_btrace_tests !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
index b75ec4bd485..236b59fa385 100644
--- a/gdb/testsuite/gdb.compile/compile.exp
+++ b/gdb/testsuite/gdb.compile/compile.exp
@@ -366,10 +366,7 @@  if { $srcfile3 != "" } {
 
 # Shared library tests.
 
-if {[skip_shlib_tests]} {
-    untested "skipping shlib tests"
-    return;
-}
+require !skip_shlib_tests
 
 set libbin [standard_output_file ${testfile}-shlib.so]
 set binfile [standard_output_file ${testfile}-shlib]
diff --git a/gdb/testsuite/gdb.cp/except-multi-location.exp b/gdb/testsuite/gdb.cp/except-multi-location.exp
index a81a169c999..2dd457860d2 100644
--- a/gdb/testsuite/gdb.cp/except-multi-location.exp
+++ b/gdb/testsuite/gdb.cp/except-multi-location.exp
@@ -19,9 +19,7 @@ 
 # on the libstc++.so DSO (which is how GDB was built and revealed the
 # bug), and vice versa.
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 # STATIC_BIN indicates whether to build the main binary with
 # -static-libgcc/-static-libstdc++.  STATIC_LIB is the same, but for
diff --git a/gdb/testsuite/gdb.cp/infcall-dlopen.exp b/gdb/testsuite/gdb.cp/infcall-dlopen.exp
index 0ca53ef872e..0978c30e007 100644
--- a/gdb/testsuite/gdb.cp/infcall-dlopen.exp
+++ b/gdb/testsuite/gdb.cp/infcall-dlopen.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .cc infcall-dlopen-lib.cc
 set libfile [standard_output_file ${testfile}.so]
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index 5248da6e491..7d06bd53b99 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -19,11 +19,7 @@ 
 load_lib dwarf.exp
 
 # This test can only be run on targets which support DWARF-2 and use gas.
-require dwarf2_support
-
-if {[skip_shlib_tests]} {
-    return 0
-}
+require dwarf2_support !skip_shlib_tests
 
 standard_testfile .c -shlib.c -dw.S
 
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
index 270a03b7568..3decad78c2e 100644
--- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
@@ -49,9 +49,7 @@ 
 # which is then used by a shared object.
 
 # This test can't be run on targets lacking shared library support.
-if [skip_shlib_tests] {
-    return 0
-}
+require !skip_shlib_tests
 
 load_lib dwarf.exp
 
diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
index b71ea35d3c8..9757b057042 100644
--- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.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 {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 load_lib mi-support.exp
 
diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index 354168bd975..72df7e21d04 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -14,9 +14,7 @@ 
 #
 load_lib mi-support.exp
 
-if {[skip_shlib_tests]} {
-    return -1
-}
+require !skip_shlib_tests
 
 standard_testfile mi-catch-load.c
 
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
index 0e77735f682..b79bec3e5f9 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
@@ -19,9 +19,7 @@ 
 
 load_lib mi-support.exp
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile mi-dprintf-pending.c
 
diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp
index cfb4a3a99f2..d3771f6b39a 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-pending.exp
@@ -20,9 +20,7 @@  set MIFLAGS "-i=mi"
 # test running programs
 #
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile mi-pending.c
 
diff --git a/gdb/testsuite/gdb.mi/mi-solib.exp b/gdb/testsuite/gdb.mi/mi-solib.exp
index 37c203b04e0..98365165eb0 100644
--- a/gdb/testsuite/gdb.mi/mi-solib.exp
+++ b/gdb/testsuite/gdb.mi/mi-solib.exp
@@ -16,10 +16,7 @@ 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi2"
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 gdb_exit
 if [mi_gdb_start] {
diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp
index 7d1938880f9..1ada1f56472 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate-shlib.exp
@@ -20,9 +20,7 @@ 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-if { [skip_shlib_tests] } {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile .c -lib.c
 set shlib_path [standard_output_file ${testfile}-lib.so]
diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/gdb.opt/solib-intra-step.exp
index 9306ced85c8..6a995a6375a 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step.exp
+++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp
@@ -15,9 +15,7 @@ 
 
 standard_testfile
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 # Library file.
 set libname "${testfile}-lib"
diff --git a/gdb/testsuite/gdb.python/py-event-load.exp b/gdb/testsuite/gdb.python/py-event-load.exp
index f7aeb5f33fb..8503af0ef78 100644
--- a/gdb/testsuite/gdb.python/py-event-load.exp
+++ b/gdb/testsuite/gdb.python/py-event-load.exp
@@ -18,10 +18,7 @@ 
 
 load_lib gdb-python.exp
 
-if {[skip_shlib_tests]} {
-    untested "skipping shared library tests"
-    return -1
-}
+require !skip_shlib_tests
 
 if {[get_compiler_info]} {
     warning "Could not get compiler info"
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 2f6c2f78e67..e8cc3be0cfe 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -16,10 +16,7 @@ 
 # This file is part of the GDB testsuite.  It tests the mechanism
 # exposing values to Python.
 
-if {[skip_shlib_tests]} {
-	untested "skipping shared library tests"
-    return 0
-}
+require !skip_shlib_tests
 
 load_lib gdb-python.exp
 
diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp
index 8dfd53acd26..1b82e694046 100644
--- a/gdb/testsuite/gdb.python/py-shared.exp
+++ b/gdb/testsuite/gdb.python/py-shared.exp
@@ -17,9 +17,7 @@ 
 
 load_lib gdb-python.exp
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 
diff --git a/gdb/testsuite/gdb.server/server-exec-info.exp b/gdb/testsuite/gdb.server/server-exec-info.exp
index 8ab33af3364..68dc65c5376 100644
--- a/gdb/testsuite/gdb.server/server-exec-info.exp
+++ b/gdb/testsuite/gdb.server/server-exec-info.exp
@@ -18,9 +18,7 @@  load_lib gdbserver-support.exp
 # We test for skip_shlib_tests in this test because without a main
 # exec file we only have the exec target loaded if shared libraries
 # are present.
-if {[skip_gdbserver_tests] || [skip_shlib_tests]} {
-    return
-}
+require !skip_gdbserver_tests !skip_shlib_tests
 
 standard_testfile server.c
 if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index 9c99107af4e..7cbc4a941b9 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -23,9 +23,7 @@ 
 load_lib gdbserver-support.exp
 load_lib prelink-support.exp
 
-if {[skip_gdbserver_tests] || [skip_shlib_tests]} {
-    return
-}
+require !skip_gdbserver_tests !skip_shlib_tests
 
 standard_testfile solib-list-main.c
 set srclibfile ${testfile}-lib.c
diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
index 5c3d8a34c30..0c871b3b84d 100644
--- a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
+++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
@@ -13,7 +13,8 @@ 
 # 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 {![isnative] || ![istarget *-linux*] || [skip_shlib_tests]} {
+require isnative !skip_shlib_tests
+if {![istarget *-linux*]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 4710b8d0952..371fa7cca14 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 if ![gdb_trace_common_supports_arch] {
     unsupported "no trace-common.h support for arch"
diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp
index 7611e79074d..48cbe21397d 100644
--- a/gdb/testsuite/gdb.trace/ftrace-lock.exp
+++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 set executable $testfile
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index c32211a9d54..79fa6d3e924 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 set executable $testfile
diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
index abf5fec1ba2..f4b0b0ecead 100644
--- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
@@ -15,9 +15,7 @@ 
 
 load_lib trace-support.exp
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 if ![gdb_trace_common_supports_arch] {
     unsupported "no trace-common.h support for arch"
     return -1
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 7950fe86a4b..4ef0e5b4df2 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 if ![gdb_trace_common_supports_arch] {
     unsupported "no trace-common.h support for arch"
diff --git a/gdb/testsuite/gdb.trace/range-stepping.exp b/gdb/testsuite/gdb.trace/range-stepping.exp
index 1a543e5b070..8ed11d52139 100644
--- a/gdb/testsuite/gdb.trace/range-stepping.exp
+++ b/gdb/testsuite/gdb.trace/range-stepping.exp
@@ -65,9 +65,7 @@  proc range_stepping_with_tracepoint { type } {
 
 range_stepping_with_tracepoint "trace"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 set libipa [get_in_proc_agent]
 set remote_libipa [gdb_load_shlib $libipa]
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index 2e754891903..fd3d39d229d 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 set executable $testfile
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 8d80bdd909e..c3227494c45 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -345,9 +345,7 @@  foreach at_first_loc { "1" "0" } {
 break_trace_same_addr_6 "trace" "enable" "trace" "disable"
 break_trace_same_addr_6 "trace" "disable" "trace" "enable"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 set libipa [get_in_proc_agent]
 set remote_libipa [gdb_load_shlib $libipa]
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index ec0b5a186fa..6b0e6f80746 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 set executable $testfile
diff --git a/gdb/testsuite/gdb.trace/trace-enable-disable.exp b/gdb/testsuite/gdb.trace/trace-enable-disable.exp
index 813e2ea4a16..e477ad6152b 100644
--- a/gdb/testsuite/gdb.trace/trace-enable-disable.exp
+++ b/gdb/testsuite/gdb.trace/trace-enable-disable.exp
@@ -14,9 +14,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 standard_testfile
 set executable $testfile
diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp
index eba46f776a0..daf674a1c6d 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.exp
+++ b/gdb/testsuite/gdb.trace/trace-mt.exp
@@ -108,9 +108,7 @@  foreach break_always_inserted { "on" "off" } {
 
 step_over_tracepoint "trace"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 set libipa [get_in_proc_agent]
 set remote_libipa [gdb_load_shlib $libipa]
diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp
index 80ec962c042..f2be6e54186 100644
--- a/gdb/testsuite/gdb.trace/tspeed.exp
+++ b/gdb/testsuite/gdb.trace/tspeed.exp
@@ -15,9 +15,7 @@ 
 
 load_lib "trace-support.exp"
 
-if {[skip_shlib_tests]} {
-    return 0
-}
+require !skip_shlib_tests
 
 # Do not run if gdbsever debug is enabled - the output file is many Gb.
 if [gdbserver_debug_enabled] {