aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/lib
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-04-04 09:01:09 -0400
committerMike Frysinger <vapier@gentoo.org>2021-04-08 00:45:07 -0400
commit23cb7bac66bf6a24e71390ce7ead5d327ae85439 (patch)
treefeb5cb1d9c3ddb72b94c41cf32492a5af95dab39 /sim/testsuite/lib
parent0592e80bcf1bbab2fbbb110ea395f9608e4f594c (diff)
downloadgdb-23cb7bac66bf6a24e71390ce7ead5d327ae85439.zip
gdb-23cb7bac66bf6a24e71390ce7ead5d327ae85439.tar.gz
gdb-23cb7bac66bf6a24e71390ce7ead5d327ae85439.tar.bz2
sim: testsuite: calculate $arch from $subdir
Since we require ports to use a matching subdir name in the testsuite tree, we can use that to calculate the $arch value.
Diffstat (limited to 'sim/testsuite/lib')
-rw-r--r--sim/testsuite/lib/sim-defs.exp27
1 files changed, 17 insertions, 10 deletions
diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp
index e1254a3..1b40216 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -48,6 +48,22 @@ proc sim_compile { source dest type options } {
return $result
}
+# Find the path to the simulator for executing.
+proc sim_tool_path {} {
+ global sim_path
+ set sim "$sim_path"
+ if [string equal "" $sim] {
+ global objdir
+ global subdir
+ set arch "$subdir"
+ while { [file dirname $arch] != "." } {
+ set arch [file dirname $arch]
+ }
+ return "$objdir/$arch/run"
+ }
+ return "$sim"
+}
+
# Run a program on the simulator.
# Required by dejagnu (at least ${tool}_run used to be).
#
@@ -98,16 +114,7 @@ proc sim_run { prog sim_opts prog_opts redir options } {
verbose "testcase timeout is set to $testcase_timeout" 1
- set sim [board_info target sim]
- if [string equal "" $sim] {
- # Special case the simulator. These tests are designed to
- # be run inside of the simulator, not on the native host.
- # So if the sim target isn't set, default to the target run.
- # These global variables come from generated site.exp.
- global objdir
- global arch
- set sim "$objdir/$arch/run"
- }
+ set sim [sim_tool_path]
if [is_remote host] {
set prog [remote_download host $prog]