Home | History | Annotate | Line # | Download | only in boards
local-remote-host.exp revision 1.10
      1  1.10  christos # Copyright 2012-2023 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.10  christos global GDB
     26  1.10  christos set GDB [file join [pwd] "../gdb"]
     27  1.10  christos 
     28  1.10  christos set_board_info hostname 127.0.0.1
     29  1.10  christos 
     30  1.10  christos set_board_info username $env(USER)
     31  1.10  christos 
     32  1.10  christos # The ssh key should be correctly set up that you ssh to 127.0.0.1
     33  1.10  christos # without having to type password.
     34  1.10  christos set_board_info rsh_prog /usr/bin/ssh
     35  1.10  christos set_board_info rcp_prog /usr/bin/scp
     36  1.10  christos set_board_info file_transfer "rsh"
     37  1.10  christos 
     38  1.10  christos proc ${board}_file { dest op args } {
     39  1.10  christos     if { $op == "delete" } {
     40  1.10  christos 	return 0
     41  1.10  christos     }
     42  1.10  christos     return [eval [list standard_file $dest $op] $args]
     43  1.10  christos }
     44  1.10  christos 
     45  1.10  christos proc ${board}_download { board src dest } {
     46  1.10  christos 
     47  1.10  christos     # If file name is a relative, convert it to absolute, otherwise file can't
     48  1.10  christos     # be found on host, because the current directory usually is /home/$USER.
     49  1.10  christos     # This also bypasses the real download to the host.
     50  1.10  christos     if { [file pathtype $src] == "relative" } {
     51  1.10  christos 	return [file join [pwd] $src]
     52  1.10  christos     } else {
     53  1.10  christos 	return $src
     54  1.10  christos     }
     55  1.10  christos }
     56   1.3  christos 
     57   1.3  christos # Like standard_spawn, but force pseudo-tty allocation, with 'ssh -t'.
     58   1.3  christos 
     59   1.3  christos proc ${board}_spawn { board cmd } {
     60   1.3  christos     global board_info
     61   1.3  christos 
     62   1.3  christos     set remote [board_info $board hostname]
     63   1.3  christos     set username [board_info $board username]
     64   1.3  christos     set RSH [board_info $board rsh_prog]
     65   1.3  christos 
     66   1.3  christos     spawn $RSH -t -l $username $remote $cmd
     67   1.3  christos     set board_info($board,fileid) $spawn_id
     68   1.3  christos     return $spawn_id
     69   1.1  christos }
     70  1.10  christos 
     71  1.10  christos set GDBFLAGS "${GDBFLAGS} -iex \"set style enabled off\""
     72