Remove obsolete test from gdb.cp/var-tag.exp
[binutils-gdb.git] / gdb / testsuite / boards / local-remote-host-native.exp
blob204f646263fffaa4645ff30f266e5382b3329510
1 # Copyright 2014-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # This file is a dejagnu "board file" and is used to run the testsuite
17 # against local host, in remote host mode.
19 # This board file is used to emulate the real remote host testing, in
20 # which file system of host and build are not shared.  This is achieved
21 # by copying files from source directory to ${host_dir}.
23 # To use this file:
24 # bash$ cd ${build_dir}/gdb
25 # bash$ make check RUNTESTFLAGS="--host_board=local-remote-host-native --target_board=local-remote-host-native HOST_DIR=/tmp/foo/"
27 # We set both target board and host board together to test a native gdb
28 # (host == target) on a remote host (host != build).  $HOST_DIR is the
29 # directory for copying files to, to avoid messing up your HOME.  When
30 # it is absent, files are copied to ./remote-host.
32 if { $board_type == "target" } {
33     set_board_info compiler gcc
36 # We have to explicitly specify GDB with the path to the copy in
37 # the build directory because otherwise it will be set to the
38 # result of "transform GDB" since the harness thinks we're using
39 # a remote host.  See lib/gdb.exp.
40 set GDB [file join [pwd] "../gdb"]
41 verbose -log "Overriding setting of GDB to $GDB"
43 set_board_info hostname localhost
45 set_board_info username $env(USER)
47 save_vars {rsh_cmd res} {
48     set rsh_cmd \
49         [join \
50              [list \
51                   [board_info $board rsh_prog] \
52                   -l [board_info $board username] \
53                   [board_info $board hostname]]]
55     if [info exists HOST_DIR] {
56         set_board_info remotedir $HOST_DIR
57     } else {
58         # Set remotedir by default, to force remote_download target to give an
59         # absolute file name.
60         set res [remote_exec build $rsh_cmd pwd]
61         if { [lindex $res 0] != 0 } {
62             error "Couldn't set remotedir using pwd"
63         }
64         set_board_info remotedir [string trim [lindex $res 1]]
65     }
68 # The ssh key should be correctly set up that you ssh to localhost
69 # without having to type password.
70 set_board_info rsh_prog /usr/bin/ssh
71 set_board_info rcp_prog /usr/bin/scp
72 set_board_info file_transfer "rsh"
74 if { $board_type == "host" } {
75     set_board_info gdb_opts "-d \"${HOST_DIR}\""
78 proc ${board}_spawn { board cmd } {
79     global board_info
81     set remote [board_info $board hostname]
82     set username [board_info $board username]
83     set RSH [board_info $board rsh_prog]
85     spawn $RSH -t -l $username $remote $cmd
87     if { [string match "$::GDB*" $cmd] } {
88         set board_info($board,fileid) $spawn_id
89     }
91     return $spawn_id
94 if { $board_type == "host" } {
95     set GDBFLAGS "${GDBFLAGS} -iex \"set style enabled off\""