Skip to content

Commit

Permalink
Consolidate calls to require
Browse files Browse the repository at this point in the history
The previous transforms left some files with multiple calls to
"require" near the top.  This patch consolidates these to the extent
possible.  (There are a couple of files that call "require" later,
after running some tests.  These have been left alone.)
  • Loading branch information
tromey committed Jan 13, 2023
1 parent abe2ff5 commit 1f2c4bb
Show file tree
Hide file tree
Showing 75 changed files with 95 additions and 238 deletions.
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/catch_ex_std.exp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

require allow_shlib_tests
require allow_shlib_tests allow_ada_tests

load_lib "ada.exp"

require allow_ada_tests

standard_ada_testfile foo

set srcfile2 [file join [file dirname $srcfile] some_package.adb]
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/dynamic-iface.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

load_lib "ada.exp"

require allow_ada_tests

require gnat_runtime_has_debug_info
require allow_ada_tests gnat_runtime_has_debug_info

standard_ada_testfile main

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/exec_changed.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

load_lib "ada.exp"

require allow_ada_tests

# This testcase verifies the behavior of the `start' command, which
# does not work when we use the gdb stub...
require !use_gdb_stub
require allow_ada_tests !use_gdb_stub

standard_ada_testfile first

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/interface.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

load_lib "ada.exp"

require allow_ada_tests

require gnat_runtime_has_debug_info
require allow_ada_tests gnat_runtime_has_debug_info

standard_ada_testfile foo

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/iwide.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

load_lib "ada.exp"

require allow_ada_tests

require gnat_runtime_has_debug_info
require allow_ada_tests gnat_runtime_has_debug_info

standard_ada_testfile p

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/mi_interface.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

load_lib "ada.exp"

require allow_ada_tests

require gnat_runtime_has_debug_info
require allow_ada_tests gnat_runtime_has_debug_info

standard_ada_testfile foo

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/start.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

load_lib "ada.exp"

require allow_ada_tests

# This testcase verifies the behavior of the `start' command, which
# does not work when we use the gdb stub...
require !use_gdb_stub
require allow_ada_tests !use_gdb_stub

standard_ada_testfile dummy

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/tagged.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

load_lib "ada.exp"

require allow_ada_tests

require gnat_runtime_has_debug_info
require allow_ada_tests gnat_runtime_has_debug_info

standard_ada_testfile foo

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/tagged_access.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

load_lib "ada.exp"

require allow_ada_tests

require gnat_runtime_has_debug_info
require allow_ada_tests gnat_runtime_has_debug_info

standard_ada_testfile p

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.ada/task_watch.exp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

load_lib "ada.exp"

require allow_ada_tests

require allow_hw_watchpoint_tests
require allow_ada_tests allow_hw_watchpoint_tests

standard_ada_testfile foo

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.base/async-shell.exp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

standard_testfile

require support_displaced_stepping

# The testfile uses "run". The real bug happened only for ![is_remote target].
require !use_gdb_stub
require support_displaced_stepping !use_gdb_stub

save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.base/fork-print-inferior-events.exp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
# 'set detach-on-fork [on,off]' are the correct ones.

# This test relies on "run", so it cannot run on target remote stubs.
require !use_gdb_stub

# Test relies on checking follow-fork output. Do not run if gdb debug is
# enabled as it will be redirected to the log.
require !gdb_debug_enabled
require !use_gdb_stub !gdb_debug_enabled

standard_testfile

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.base/solib-display.exp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
# (and thus aren't affected by shared library unloading) are not
# disabled prematurely.

require allow_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
# use something else (kill + gdb_run_cmd with a manual breakpoint at main).
Expand All @@ -43,7 +41,7 @@ require allow_shlib_tests
# This is because the initial stop is done before the shared libraries are
# loaded.

require !use_gdb_stub
require allow_shlib_tests !use_gdb_stub

# Library file.
set libname "solib-display-lib"
Expand Down
10 changes: 4 additions & 6 deletions gdb/testsuite/gdb.base/solib-nodir.exp
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */

require allow_shlib_tests
# 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
# running.
require allow_shlib_tests !use_gdb_stub

# The testcase assumes the target can access the OBJDIR.
if [is_remote target] {
return
}

# 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
# running.
require !use_gdb_stub

set testfile "solib-nodir"
# Arbitrary file, possibly not containing main, even an empty one.
set srclibfile foo.c
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.base/sym-file.exp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
# 13) Check that the execution can continue without error.
# 14) Regression test for a stale breakpoints bug.

require is_elf_target

require allow_shlib_tests
require is_elf_target allow_shlib_tests

set target_size TARGET_UNKNOWN
if {[is_lp64_target]} {
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
# watchpoint-hw-attach.exp -- Test if hardware watchpoints are used
# when attaching to a target.

require allow_hw_watchpoint_tests

require can_spawn_for_attach
require allow_hw_watchpoint_tests can_spawn_for_attach

standard_testfile

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.base/watchpoint-hw.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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/>.

require !use_gdb_stub

require allow_hw_watchpoint_tests
require !use_gdb_stub allow_hw_watchpoint_tests

standard_testfile

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.btrace/multi-inferior.exp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#
# Each inferior can be recorded separately.

require allow_btrace_tests

require !use_gdb_stub
require allow_btrace_tests !use_gdb_stub

standard_testfile
if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
Expand Down
3 changes: 1 addition & 2 deletions gdb/testsuite/gdb.btrace/reconnect.exp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

load_lib gdbserver-support.exp

require allow_btrace_tests
require allow_gdbserver_tests
require allow_btrace_tests allow_gdbserver_tests

standard_testfile
if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
Expand Down
10 changes: 4 additions & 6 deletions gdb/testsuite/gdb.cp/annota2.exp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
# test running programs
#

require allow_cplus_tests
# This testcase cannot use runto_main because of the different prompt
# we get when using annotation level 2.
#
require allow_cplus_tests target_can_use_run_cmd

standard_testfile .cc

Expand All @@ -29,11 +32,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}

# This testcase cannot use runto_main because of the different prompt
# we get when using annotation level 2.
#
require target_can_use_run_cmd

set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
set frames_invalid "\r\n\032\032frames-invalid\r\n"

Expand Down
10 changes: 4 additions & 6 deletions gdb/testsuite/gdb.cp/annota3.exp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
# test running programs
#

require allow_cplus_tests
# This testcase cannot use runto_main because of the different prompt
# we get when using annotation level 2.
#
require allow_cplus_tests target_can_use_run_cmd

standard_testfile .cc

Expand All @@ -29,11 +32,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
return -1
}

# This testcase cannot use runto_main because of the different prompt
# we get when using annotation level 2.
#
require target_can_use_run_cmd

#
# line number where we need to stop in main
#
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support

require allow_cplus_tests
require dwarf2_support allow_cplus_tests

standard_testfile .S

Expand Down
5 changes: 2 additions & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-common-block.exp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
# It requires fortran.
require dwarf2_support allow_fortran_tests

# This test can only be run on x86-64 targets.
if {![istarget x86_64-*] || ![is_lp64_target]} {
return 0
}

# It requires fortran.
require allow_fortran_tests

standard_testfile .S

Expand Down
7 changes: 3 additions & 4 deletions gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
# Check that GDB can call C++ functions whose parameters or return values have
# type containing a static member of the same type.

# Still no C++ compiler is used.
require allow_cplus_tests

load_lib dwarf.exp

# Still no C++ compiler is used.
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
require allow_cplus_tests dwarf2_support

standard_testfile .S -main.c

Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support

# The .c files use __attribute__.
require is_c_compiler_gcc
require dwarf2_support is_c_compiler_gcc

# Reuse many of the test source files from dw2-inline-header-1.exp.
standard_testfile dw2-inline-header-lbls.c dw2-inline-header.S \
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support

# The .c files use __attribute__.
require is_c_compiler_gcc
require dwarf2_support is_c_compiler_gcc

# Prepare and run the test.
proc do_test { start_label func_name tag } {
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support

# The .c files use __attribute__.
require is_c_compiler_gcc
require dwarf2_support is_c_compiler_gcc

standard_testfile dw2-inline-header-lbls.c dw2-inline-header.S \
dw2-inline-header.c dw2-inline-header.h
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support

# The .c files use __attribute__.
require is_c_compiler_gcc
require dwarf2_support is_c_compiler_gcc

standard_testfile dw2-inline-header-lbls.c dw2-inline-header.S \
dw2-inline-header.c dw2-inline-header.h
Expand Down
4 changes: 1 addition & 3 deletions gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support

# The .c files use __attribute__.
require is_c_compiler_gcc
require dwarf2_support is_c_compiler_gcc

standard_testfile .c .S

Expand Down
Loading

0 comments on commit 1f2c4bb

Please sign in to comment.