1 1.11 christos # Copyright 2012-2024 Free Software Foundation, Inc. 2 1.1 christos 3 1.1 christos # This program is free software; you can redistribute it and/or modify 4 1.1 christos # it under the terms of the GNU General Public License as published by 5 1.1 christos # the Free Software Foundation; either version 3 of the License, or 6 1.1 christos # (at your option) any later version. 7 1.1 christos # 8 1.1 christos # This program is distributed in the hope that it will be useful, 9 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 1.1 christos # GNU General Public License for more details. 12 1.1 christos # 13 1.1 christos # You should have received a copy of the GNU General Public License 14 1.1 christos # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 1.1 christos 16 1.10 christos # This file is a dejagnu "board file" and is used to run the testsuite 17 1.10 christos # against local host, in remote host mode. 18 1.10 christos # 19 1.10 christos # To use this file: 20 1.10 christos # bash$ cd ${build_dir}/gdb 21 1.10 christos # bash$ make check RUNTESTFLAGS="--host_board=local-remote-host" 22 1.10 christos 23 1.3 christos # Like local-remote-host-notty, but with readline/editing enabled. 24 1.3 christos 25 1.11 christos set GDB [file normalize [file join [pwd] "../gdb"]] 26 1.10 christos 27 1.11 christos set_board_info hostname localhost 28 1.10 christos 29 1.11 christos if { [info exists REMOTE_HOST_USERNAME] } { 30 1.11 christos set_board_info username $REMOTE_HOST_USERNAME 31 1.11 christos } else { 32 1.11 christos set_board_info username $env(USER) 33 1.11 christos } 34 1.10 christos 35 1.11 christos # The ssh key should be correctly set up that you ssh to localhost 36 1.10 christos # without having to type password. 37 1.10 christos set_board_info rsh_prog /usr/bin/ssh 38 1.10 christos set_board_info rcp_prog /usr/bin/scp 39 1.10 christos set_board_info file_transfer "rsh" 40 1.10 christos 41 1.11 christos save_vars {rsh_cmd res} { 42 1.11 christos set rsh_cmd \ 43 1.11 christos [join \ 44 1.11 christos [list \ 45 1.11 christos [board_info $board rsh_prog] \ 46 1.11 christos -l [board_info $board username] \ 47 1.11 christos [board_info $board hostname]]] 48 1.11 christos 49 1.11 christos # Handle separate test account. 50 1.11 christos if { [board_info $board username] != $env(USER) } { 51 1.11 christos # We're pretending that some local user account is remote host. 52 1.11 christos # Make things a bit more realistic by restricting file permissions. 53 1.11 christos 54 1.11 christos # Make sure remote host can't see files on build. 55 1.11 christos set res [remote_exec build "chmod go-rx $objdir"] 56 1.11 christos if { [lindex $res 0] != 0 } { 57 1.11 christos error "Couldn't remove permissions for $objdir on build" 58 1.11 christos } 59 1.11 christos 60 1.11 christos # Make sure build can't see files on remote host. 61 1.11 christos set res [remote_exec build $rsh_cmd "chmod go-rx ."] 62 1.11 christos if { [lindex $res 0] != 0 } { 63 1.11 christos error "Couldn't remove permissions for . on host" 64 1.11 christos } 65 1.10 christos } 66 1.10 christos } 67 1.3 christos 68 1.3 christos # Like standard_spawn, but force pseudo-tty allocation, with 'ssh -t'. 69 1.3 christos 70 1.3 christos proc ${board}_spawn { board cmd } { 71 1.3 christos global board_info 72 1.3 christos 73 1.3 christos set remote [board_info $board hostname] 74 1.3 christos set username [board_info $board username] 75 1.3 christos set RSH [board_info $board rsh_prog] 76 1.3 christos 77 1.3 christos spawn $RSH -t -l $username $remote $cmd 78 1.3 christos set board_info($board,fileid) $spawn_id 79 1.3 christos return $spawn_id 80 1.1 christos } 81 1.10 christos 82 1.10 christos set GDBFLAGS "${GDBFLAGS} -iex \"set style enabled off\"" 83