sim: testsuite: rework sim_init usage
The sim_init function was called by runtest for each test when --tool was set to sim. When we changed to --tool '' to collapse the testsuite dir, the init function was no longer called on every test. However, it was still being called explicitly by config/default.exp. It's not clear why that explicit call ever existed since, in the past, it meant it was redundant. Lets drop the single sim_init call in config/default.exp and move it out to all our tests. This replicates the runtest behavior so we can setup variables on a per-test basis which allows us to recollapse the sim_path logic back. We'll also leverage this in the future for toolchain setup. Also add a few comments clarifying the overall runtime behavior.
This commit is contained in:
parent
4c721b266f
commit
c0d6a6e582
44 changed files with 109 additions and 26 deletions
|
@ -1,5 +1,7 @@
|
|||
# AArch64 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget aarch64*-*] {
|
||||
# all machines
|
||||
set all_machs "aarch64"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# ARM simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if { [istarget arm*-*-*] } {
|
||||
# all machines
|
||||
set all_machs "xscale"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Intel(r) Wireless MMX(tm) technology simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if { [istarget arm*-*-*] } {
|
||||
# all machines
|
||||
set all_machs "xscale"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Miscellaneous ARM simulator testcases
|
||||
|
||||
sim_init
|
||||
|
||||
if { [istarget arm*-*-*] } {
|
||||
# all machines
|
||||
set all_machs "arm7tdmi"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# ARM simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if { [istarget arm*-*-*] } {
|
||||
# all machines
|
||||
set all_machs "arm7tdmi"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# XSCALE simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if { [istarget arm*-*-*] } {
|
||||
# all machines
|
||||
set all_machs "xscale"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# avr simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget avr-*] {
|
||||
# all machines
|
||||
set all_machs "avr"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Analog Devices Blackfin simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget bfin-*-elf] {
|
||||
# all machines
|
||||
set all_machs "bfin"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# eBPF simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget bpf-unknown-none] {
|
||||
# all machines
|
||||
set all_machs "bpf"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# Simulator default dejagnu configuration file.
|
||||
|
||||
load_lib sim-defs.exp
|
||||
|
||||
sim_init
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# CR16 simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget cr16*-*-*] {
|
||||
# all machines
|
||||
set all_machs "cr16"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Miscellaneous CR16 simulator testcases
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget cr16*-*-*] {
|
||||
# all machines
|
||||
set all_machs "cr16"
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
# Miscellaneous CRIS simulator testcases in assembly code.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget cris*-*-*] {
|
||||
global ASFLAGS_FOR_TARGET
|
||||
# All machines we test and the corresponding assembler option. Needs
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
# Miscellaneous CRIS simulator testcases testing syscall sequences.
|
||||
|
||||
sim_init
|
||||
|
||||
if ![istarget cris*-*-*] {
|
||||
return
|
||||
}
|
||||
|
@ -69,6 +71,7 @@ proc anytarget { targets } {
|
|||
return 0
|
||||
}
|
||||
|
||||
global sim_path
|
||||
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
||||
set orig_ldflags ""
|
||||
|
||||
|
@ -94,7 +97,7 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
|||
continue
|
||||
}
|
||||
|
||||
if ![file exists [sim_tool_path]] {
|
||||
if ![file exists $sim_path] {
|
||||
untested $testname
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -16,15 +16,18 @@
|
|||
# Miscellaneous CRIS simulator testcases in assembly code, testing
|
||||
# dv-rv.c and dv-cris.c functions.
|
||||
|
||||
sim_init
|
||||
|
||||
# Check whether dv-rv and dv-cris are present.
|
||||
|
||||
proc sim_has_rv_and_cris {} {
|
||||
global srcdir
|
||||
global subdir
|
||||
global objdir
|
||||
global sim_path
|
||||
global SIMFLAGS_FOR_TARGET
|
||||
|
||||
if ![file exists [sim_tool_path]] {
|
||||
if ![file exists $sim_path] {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# d10v simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget d10v*-*] {
|
||||
# all machines
|
||||
set all_machs "d10v"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Example synacor simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget *] {
|
||||
# All machines.
|
||||
set all_machs "example"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# FRV simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "frv fr500 fr550 fr400 fr405 fr450"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# FRV simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "fr400 fr405 fr450 fr550"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# FRV simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "frv fr500 fr550"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# FRV simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "fr550"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# FRV simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "frv fr500 fr550 fr400"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Miscellaneous FRV simulator testcases.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "frv fr500 fr550 fr400 fr405 fr450"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# FRV simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget frv*-*] {
|
||||
# all machines
|
||||
set all_machs "frv fr500 fr550 fr400"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# ft32 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget ft32-*] {
|
||||
# all machines
|
||||
set all_machs "ft32"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Hitachi H8/300 (h, s, sx) simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if {[istarget h8300*-*-*] || [istarget h8sx*-*-*]} then {
|
||||
set all_machs "h8300 h8300h h8300s h8sx"
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# iq2000 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget iq2000-*] {
|
||||
# all machines
|
||||
set all_machs "iq2000"
|
||||
|
|
|
@ -7,12 +7,22 @@
|
|||
set sim_path "unknown-run"
|
||||
|
||||
# Initialize the testrun.
|
||||
# Required by dejagnu.
|
||||
#
|
||||
# Normally dejagnu will execute ${tool}_init automatically, but since we set
|
||||
# --tool '' (for a simpler testsuite/ layout), we have each test call this
|
||||
# itself.
|
||||
|
||||
proc sim_init { args } {
|
||||
global builddir
|
||||
global subdir
|
||||
global sim_path
|
||||
set sim_path [board_info target sim]
|
||||
# Need to return an empty string (copied from GAS).
|
||||
|
||||
# Find the path to the simulator for executing.
|
||||
set arch "$subdir"
|
||||
while { [file dirname $arch] != "." } {
|
||||
set arch [file dirname $arch]
|
||||
}
|
||||
set sim_path "$builddir/$arch/run"
|
||||
|
||||
# As gross as it is, we unset the linker script specified by the target
|
||||
# board. The simulator board file mips-sim.exp, sets ldscript to the
|
||||
|
@ -23,6 +33,8 @@ proc sim_init { args } {
|
|||
# all simulators.
|
||||
unset_currtarget_info ldscript
|
||||
|
||||
# Need to return an empty string. This tells dejagnu to *not* re-run us
|
||||
# with the exact test that we're about to run.
|
||||
return ""
|
||||
}
|
||||
|
||||
|
@ -35,22 +47,6 @@ proc sim_version {} {
|
|||
clone_output "$sim_path $version\n"
|
||||
}
|
||||
|
||||
# Find the path to the simulator for executing.
|
||||
proc sim_tool_path {} {
|
||||
global sim_path
|
||||
set sim "$sim_path"
|
||||
if [string equal "" $sim] {
|
||||
global builddir
|
||||
global subdir
|
||||
set arch "$subdir"
|
||||
while { [file dirname $arch] != "." } {
|
||||
set arch [file dirname $arch]
|
||||
}
|
||||
return "$builddir/$arch/run"
|
||||
}
|
||||
return "$sim"
|
||||
}
|
||||
|
||||
# Run a program on the simulator.
|
||||
# Required by dejagnu (at least ${tool}_run used to be).
|
||||
#
|
||||
|
@ -73,6 +69,8 @@ proc sim_tool_path {} {
|
|||
# simulator (not the simulated program, the simulator) with sim_load.
|
||||
|
||||
proc sim_run { prog sim_opts prog_opts redir options } {
|
||||
global sim_path
|
||||
|
||||
# Set the default value of the timeout.
|
||||
# FIXME: The timeout value we actually want is a function of
|
||||
# host, target, and testcase.
|
||||
|
@ -99,7 +97,7 @@ proc sim_run { prog sim_opts prog_opts redir options } {
|
|||
|
||||
verbose "testcase timeout is set to $testcase_timeout" 1
|
||||
|
||||
set sim [sim_tool_path]
|
||||
set sim $sim_path
|
||||
|
||||
if [is_remote host] {
|
||||
set prog [remote_download host $prog]
|
||||
|
@ -182,13 +180,14 @@ proc sim_run { prog sim_opts prog_opts redir options } {
|
|||
|
||||
proc run_sim_test { name requested_machs } {
|
||||
global subdir srcdir objdir
|
||||
global sim_path
|
||||
global opts
|
||||
global cpu_option
|
||||
global cpu_option_sep
|
||||
global SIMFLAGS_FOR_TARGET
|
||||
|
||||
if ![file exists [sim_tool_path]] {
|
||||
unsupported "$name: missing simulator [sim_tool_path]"
|
||||
if ![file exists $sim_path] {
|
||||
unsupported "$name: missing simulator $sim_path"
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# lm32 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget lm32-*] {
|
||||
# all machines
|
||||
set all_machs "lm32"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# M32C simulator testsuite.
|
||||
# TODO: Add support for .c tests.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget m32c*-*-*] {
|
||||
# all machines
|
||||
set all_machs "m32c"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# M32R simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget m32r*-*-*] {
|
||||
# all machines
|
||||
set all_machs "m32r"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Miscellaneous M32R simulator testcases
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget m32r*-*-*] {
|
||||
# all machines
|
||||
set all_machs "m32r"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# m68hc11 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget m68hc11-*] {
|
||||
# all machines
|
||||
set all_machs "m68hc11"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# mcore simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget mcore-*] {
|
||||
# all machines
|
||||
set all_machs "mcore"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# microblaze simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget microblaze-*] {
|
||||
# all machines
|
||||
set all_machs "microblaze"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# MIPS simulator instruction tests
|
||||
|
||||
sim_init
|
||||
|
||||
# Do "run_sim_test TESTFILE MODELS" for each combination of the
|
||||
# mf{lo,hi} -> mult/div/mt{lo,hi} hazard described in mips.igen.
|
||||
# Insert NOPS nops after the mflo or mfhi.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# mn10300 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget mn10300-*] {
|
||||
# all machines
|
||||
set all_machs "mn10300"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# moxie simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget moxie-*] {
|
||||
# all machines
|
||||
set all_machs "moxie"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# msp430 simulator testsuite
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget msp430-*] {
|
||||
# all machines
|
||||
set all_machs "msp430"
|
||||
|
|
|
@ -15,6 +15,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/>.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget or1k*-*-*] {
|
||||
set all_machs "or1k"
|
||||
|
||||
|
|
|
@ -18,6 +18,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/>.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget pru-*] {
|
||||
# all machines
|
||||
set all_machs "pru"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# RISC-V simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget riscv*-*] {
|
||||
# all machines
|
||||
set all_machs "riscv"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# sh tests
|
||||
|
||||
sim_init
|
||||
|
||||
set all_machs "sh shdsp"
|
||||
|
||||
global ASFLAGS_FOR_TARGET
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# v850 simulator testsuite.
|
||||
|
||||
sim_init
|
||||
|
||||
if [istarget v850*-*] {
|
||||
# All machines.
|
||||
# Should add more cpus if the testsuite adds coverage for their insns, but
|
||||
|
|
Loading…
Add table
Reference in a new issue