4 |
# it under the terms of the GNU General Public License as published by |
# it under the terms of the GNU General Public License as published by |
5 |
# the Free Software Foundation; either version 2 of the License, or |
# the Free Software Foundation; either version 2 of the License, or |
6 |
# (at your option) any later version. |
# (at your option) any later version. |
7 |
# |
# |
8 |
# This program is distributed in the hope that it will be useful, |
# This program is distributed in the hope that it will be useful, |
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 |
# GNU General Public License for more details. |
# GNU General Public License for more details. |
12 |
# |
# |
13 |
# You should have received a copy of the GNU General Public License |
# You should have received a copy of the GNU General Public License |
14 |
# along with this program; if not, write to the Free Software |
# along with this program; if not, write to the Free Software |
15 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 |
|
|
17 |
# Please email any bugs, comments, and/or additions to this file to: |
# Please email any bugs, comments, and/or additions to this file to: |
18 |
# bug-dejagnu@gnu.org |
# bug-dejagnu@gnu.org |
30 |
load_lib "rsh.exp" |
load_lib "rsh.exp" |
31 |
load_lib "ftp.exp" |
load_lib "ftp.exp" |
32 |
|
|
33 |
# |
# |
34 |
# Open a connection to a remote host or target. This requires the target_info |
# Open a connection to a remote host or target. This requires the target_info |
35 |
# array be filled in with the proper info to work. |
# array be filled in with the proper info to work. |
36 |
# |
# |
37 |
# type is either "build", "host", "target", or the name of a board loaded |
# type is either "build", "host", "target", or the name of a board loaded |
38 |
# into the board_info array. The default is target if no name is supplied. |
# into the board_info array. The default is target if no name is supplied. |
39 |
# It returns the spawn id of the process that is the connection. |
# It returns the spawn id of the process that is the connection. |
40 |
# |
# |
124 |
} |
} |
125 |
# Why do we use tee? Because open can't redirect both input and output. |
# Why do we use tee? Because open can't redirect both input and output. |
126 |
if { $use_tee } { |
if { $use_tee } { |
127 |
set result [catch {open "| ${commandline} $inp |& tee $outpf" RDONLY} id] |
set result [catch {open "| ${commandline} $inp |& tee $outpf" RDONLY} id] |
128 |
} else { |
} else { |
129 |
set result [catch {open "| ${commandline} $inp $outp" $mode} id] |
set result [catch {open "| ${commandline} $inp $outp" $mode} id] |
130 |
} |
} |
131 |
|
|
132 |
if { $result != 0 } { |
if { $result != 0 } { |
175 |
|
|
176 |
# Uuuuuuugh. Now I'm getting really sick. |
# Uuuuuuugh. Now I'm getting really sick. |
177 |
# If we didn't get an EOF, we have to kill the poor defenseless program. |
# If we didn't get an EOF, we have to kill the poor defenseless program. |
178 |
# However, Tcl has no kill primitive, so we have to execute an external |
# However, Tcl has no kill primitive, so we have to execute an external |
179 |
# command in order to execute the execution. (English. Gotta love it.) |
# command in order to execute the execution. (English. Gotta love it.) |
180 |
if { ! $got_eof } { |
if { ! $got_eof } { |
181 |
verbose "killing $pid $pgid" |
verbose "killing $pid $pgid" |
221 |
} |
} |
222 |
} |
} |
223 |
|
|
224 |
# |
# |
225 |
# Execute the supplied program on HOSTNAME. There are four optional arguments |
# Execute the supplied program on HOSTNAME. There are four optional arguments |
226 |
# the first is a set of arguments to pass to PROGRAM, the second is an |
# the first is a set of arguments to pass to PROGRAM, the second is an |
227 |
# input file to feed to stdin of PROGRAM, the third is the name of an |
# input file to feed to stdin of PROGRAM, the third is the name of an |
240 |
} else { |
} else { |
241 |
set pargs "" |
set pargs "" |
242 |
} |
} |
243 |
|
|
244 |
if { [llength $args] > 1 } { |
if { [llength $args] > 1 } { |
245 |
set inp "[lindex $args 1]" |
set inp "[lindex $args 1]" |
246 |
} else { |
} else { |
262 |
|
|
263 |
verbose -log "Executing on $hostname: $program $pargs $inp $outp (timeout = $timeout)" 2 |
verbose -log "Executing on $hostname: $program $pargs $inp $outp (timeout = $timeout)" 2 |
264 |
|
|
265 |
# Run it locally if appropriate. |
# Run it locally if appropriate. |
266 |
if { ![is_remote $hostname] } { |
if { ![is_remote $hostname] } { |
267 |
return [local_exec "$program $pargs" $inp $outp $timeout] |
return [local_exec "$program $pargs" $inp $outp $timeout] |
268 |
} else { |
} else { |
586 |
proc remote_raw_transmit { dest file } { |
proc remote_raw_transmit { dest file } { |
587 |
return [call_remote raw transmit "$dest" "$file"] |
return [call_remote raw transmit "$dest" "$file"] |
588 |
} |
} |
589 |
|
|
590 |
# |
# |
591 |
# The default transmit procedure if no other exists. This feeds the |
# The default transmit procedure if no other exists. This feeds the |
592 |
# supplied file directly into the connection. |
# supplied file directly into the connection. |
593 |
# |
# |
667 |
return [eval call_remote raw file \"$dest\" $args] |
return [eval call_remote raw file \"$dest\" $args] |
668 |
} |
} |
669 |
|
|
670 |
# |
# |
671 |
# Perform the specified file op on a remote Unix board. |
# Perform the specified file op on a remote Unix board. |
672 |
# |
# |
673 |
|
|
798 |
return -1 |
return -1 |
799 |
} |
} |
800 |
} else { |
} else { |
801 |
set result [catch {open "| ${commandline}" "w"} id] |
set result [catch {open "| ${commandline}" "w"} id] |
802 |
if { $result != 0 } { |
if { $result != 0 } { |
803 |
return -1 |
return -1 |
804 |
} |
} |
1019 |
if [board_info $dest exists remote_link] { |
if [board_info $dest exists remote_link] { |
1020 |
if [[board_info $dest remote_link] $remotefile] { |
if [[board_info $dest remote_link] $remotefile] { |
1021 |
verbose -log "Couldn't do remote link" |
verbose -log "Couldn't do remote link" |
1022 |
remote_file target delete $remotefile |
remote_file target delete $remotefile |
1023 |
return "unresolved" |
return "unresolved" |
1024 |
} |
} |
1025 |
} |
} |
1142 |
# status message, then the absence of it means that the program |
# status message, then the absence of it means that the program |
1143 |
# crashed, regardless of status found elsewhere (e.g. simulator exit |
# crashed, regardless of status found elsewhere (e.g. simulator exit |
1144 |
# code). |
# code). |
1145 |
if { [target_info needs_status_wrapper] != "" } then { |
if { [target_info needs_status_wrapper] != "" } then { |
1146 |
set nomatch_return 2 |
set nomatch_return 2 |
1147 |
} else { |
} else { |
1148 |
set nomatch_return -1 |
set nomatch_return -1 |
1149 |
} |
} |