]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/boards/local-remote-host.exp
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / boards / local-remote-host.exp
1 # Copyright 2012-2024 Free Software Foundation, Inc.
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 # To use this file:
20 # bash$ cd ${build_dir}/gdb
21 # bash$ make check RUNTESTFLAGS="--host_board=local-remote-host"
22
23 # Like local-remote-host-notty, but with readline/editing enabled.
24
25 set GDB [file normalize [file join [pwd] "../gdb"]]
26
27 set_board_info hostname localhost
28
29 if { [info exists REMOTE_HOST_USERNAME] } {
30 set_board_info username $REMOTE_HOST_USERNAME
31 } else {
32 set_board_info username $env(USER)
33 }
34
35 # The ssh key should be correctly set up that you ssh to localhost
36 # without having to type password.
37 set_board_info rsh_prog /usr/bin/ssh
38 set_board_info rcp_prog /usr/bin/scp
39 set_board_info file_transfer "rsh"
40
41 save_vars {rsh_cmd res} {
42 set rsh_cmd \
43 [join \
44 [list \
45 [board_info $board rsh_prog] \
46 -l [board_info $board username] \
47 [board_info $board hostname]]]
48
49 # Handle separate test account.
50 if { [board_info $board username] != $env(USER) } {
51 # We're pretending that some local user account is remote host.
52 # Make things a bit more realistic by restricting file permissions.
53
54 # Make sure remote host can't see files on build.
55 set res [remote_exec build "chmod go-rx $objdir"]
56 if { [lindex $res 0] != 0 } {
57 error "Couldn't remove permissions for $objdir on build"
58 }
59
60 # Make sure build can't see files on remote host.
61 set res [remote_exec build $rsh_cmd "chmod go-rx ."]
62 if { [lindex $res 0] != 0 } {
63 error "Couldn't remove permissions for . on host"
64 }
65 }
66 }
67
68 # Like standard_spawn, but force pseudo-tty allocation, with 'ssh -t'.
69
70 proc ${board}_spawn { board cmd } {
71 global board_info
72
73 set remote [board_info $board hostname]
74 set username [board_info $board username]
75 set RSH [board_info $board rsh_prog]
76
77 spawn $RSH -t -l $username $remote $cmd
78 set board_info($board,fileid) $spawn_id
79 return $spawn_id
80 }
81
82 set GDBFLAGS "${GDBFLAGS} -iex \"set style enabled off\""