Home | History | Annotate | Line # | Download | only in boards
remote-stdio-gdbserver.exp revision 1.8
      1  1.8  christos # Copyright 2011-2019 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.1  christos # This file is a dejagnu "board file" and is used to run the testsuite
     17  1.1  christos # with a remotehost and gdbserver using stdio for communicating through
     18  1.1  christos # ssh. Certain firewalls prevent gdbserver from using the usual mechanism of
     19  1.1  christos # listening on a remote port, so use stdio via ssh instead.
     20  1.1  christos #
     21  1.1  christos # To use this file:
     22  1.1  christos # bash$ cd ${build_dir}/gdb
     23  1.1  christos # bash$ make check RUNTESTFLAGS="--target_board=remote-stdio-gdbserver \
     24  1.1  christos #    REMOTE_USERNAME=... REMOTE_HOSTNAME=... REMOTE_PORTNUM=... \
     25  1.1  christos #    [REMOTE_TMPDIR=${remote_dir}] [GDBSERVER=${remote_gdbserver}]"
     26  1.1  christos 
     27  1.8  christos load_board_description "stdio-gdbserver-base"
     28  1.1  christos 
     29  1.1  christos # Test machine info. The generic_config gdbserver reads some of these
     30  1.1  christos # values from board_info, so this file must set them there.
     31  1.1  christos if [info exists REMOTE_USERNAME] {
     32  1.1  christos     set_board_info username $REMOTE_USERNAME
     33  1.1  christos } else {
     34  1.1  christos     set_board_info username unspecified_username
     35  1.1  christos }
     36  1.1  christos if [info exists REMOTE_HOSTNAME] {
     37  1.1  christos     set_board_info hostname $REMOTE_HOSTNAME
     38  1.1  christos } else {
     39  1.1  christos     set_board_info hostname unspecified_hostname
     40  1.1  christos }
     41  1.1  christos 
     42  1.1  christos # The two programs have different syntax to set the remote port, so
     43  1.1  christos # set it as part of the program name rather than in get_remote_login.
     44  1.1  christos 
     45  1.1  christos if [info exists REMOTE_PORTNUM] {
     46  1.1  christos     set_board_info portnum $REMOTE_PORTNUM
     47  1.1  christos     set_board_info rsh_prog "/usr/bin/ssh -p$REMOTE_PORTNUM"
     48  1.1  christos     set_board_info rcp_prog "/usr/bin/scp -P$REMOTE_PORTNUM"
     49  1.1  christos } else {
     50  1.1  christos     set_board_info rsh_prog /usr/bin/ssh
     51  1.1  christos     set_board_info rcp_prog /usr/bin/scp
     52  1.1  christos }
     53  1.1  christos 
     54  1.1  christos # Some remote machines don't have writable home directories.
     55  1.1  christos if [info exists REMOTE_TMPDIR] {
     56  1.1  christos     set_board_info remotedir $REMOTE_TMPDIR
     57  1.1  christos }
     58  1.1  christos 
     59  1.1  christos proc get_remote_login { } {
     60  1.1  christos     set result ""
     61  1.1  christos     if {[board_info [target_info name] exists username]} {
     62  1.1  christos 	append result "[board_info [target_info name] username]@"
     63  1.1  christos     }
     64  1.1  christos     if {[board_info [target_info name] exists hostname]} {
     65  1.1  christos 	append result "[board_info [target_info name] hostname]"
     66  1.1  christos     }
     67  1.1  christos     return $result
     68  1.1  christos }
     69  1.1  christos 
     70  1.8  christos proc get_target_remote_pipe_cmd { } {
     71  1.8  christos     set target_exec [gdbserver_download_current_prog]
     72  1.1  christos     set rsh_cmd "[board_info [target_info name] rsh_prog] [get_remote_login]"
     73  1.8  christos     return "$rsh_cmd /usr/bin/gdbserver --once stdio $target_exec"
     74  1.1  christos }
     75  1.1  christos 
     76  1.1  christos proc ${board}_file { dest op args } {
     77  1.1  christos     if { $op == "delete" } {
     78  1.8  christos 	return [remote_exec target "rm -f $args"]
     79  1.1  christos     }
     80  1.1  christos     return [eval [list standard_file $dest $op] $args]
     81  1.1  christos }
     82