Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / boards / local-remote-host-native.exp
CommitLineData
88b9d363 1# Copyright 2014-2022 Free Software Foundation, Inc.
666d413c
YQ
2
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.
7#
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.
12#
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/>.
15
16# This file is a dejagnu "board file" and is used to run the testsuite
17# against local host, in remote host mode.
18#
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}.
22#
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/"
26#
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.
31
32if { $board_type == "target" } {
33 set_board_info compiler gcc
34}
35
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.
40set GDB [file join [pwd] "../gdb"]
41verbose -log "Overriding setting of GDB to $GDB"
42
43set_board_info hostname 127.0.0.1
44
45set_board_info username $env(USER)
46
47# The ssh key should be correctly set up that you ssh to 127.0.0.1
48# without having to type password.
49set_board_info rsh_prog /usr/bin/ssh
50set_board_info rcp_prog /usr/bin/scp
51set_board_info file_transfer "rsh"
52
53if { ![info exists HOST_DIR] } {
54 set HOST_DIR [file join [pwd] "remote-host"]
55}
56
57if { $board_type == "host" } {
58 set_board_info gdb_opts "-d \"${HOST_DIR}\""
59}
60
61proc ${board}_spawn { board cmd } {
62 global board_info
63
64 set remote [board_info $board hostname]
65 set username [board_info $board username]
66 set RSH [board_info $board rsh_prog]
67
68 spawn $RSH -t -l $username $remote $cmd
69 set board_info($board,fileid) $spawn_id
70 return $spawn_id
71}
72
73proc ${board}_download { board src dest } {
74 global HOST_DIR
75
76 if { ![file exists $HOST_DIR] } {
77 file mkdir $HOST_DIR
78 }
79
80 set destfile [file join $HOST_DIR $dest]
81 verbose -log "${board}_download: file copy -force $src $destfile"
82 file copy -force $src $destfile
83
84 return $destfile
85}
This page took 0.823557 seconds and 4 git commands to generate.