diff options
author | Ben Elliston <bje@gnu.org> | 2006-06-14 00:41:01 +0000 |
---|---|---|
committer | Ben Elliston <bje@gnu.org> | 2006-06-14 00:41:01 +0000 |
commit | 00f38dcd2828d39d9016cd23a690e5a9f20fb2c1 (patch) | |
tree | ee7d027a1c8eecc4623283fa8711ea207cc4b955 | |
parent | 3f5ac97eaccc317adf5bbdbe34771261a01420f4 (diff) | |
download | dejagnu-00f38dcd2828d39d9016cd23a690e5a9f20fb2c1.zip dejagnu-00f38dcd2828d39d9016cd23a690e5a9f20fb2c1.tar.gz dejagnu-00f38dcd2828d39d9016cd23a690e5a9f20fb2c1.tar.bz2 |
* rsh.exp (rsh_exec): Handle inp and outp arguments. Use
local_exec to run rsh. Return failure if rsh times out.
* remote.exp (local_exec): Handle "|& cat" we added when deciding
whether to return output.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/remote.exp | 4 | ||||
-rw-r--r-- | lib/rsh.exp | 31 |
3 files changed, 23 insertions, 19 deletions
@@ -1,3 +1,10 @@ +2006-03-30 Daniel Jacobowitz <dan@debian.org> + + * rsh.exp (rsh_exec): Handle inp and outp arguments. Use + local_exec to run rsh. Return failure if rsh times out. + * remote.exp (local_exec): Handle "|& cat" we added when deciding + whether to return output. + 2006-06-09 Ben Elliston <bje@gnu.org> * baseboards/cris-sim.exp: Use Tcl fall-through syntax for diff --git a/lib/remote.exp b/lib/remote.exp index 4ccdb6f..4de8900 100644 --- a/lib/remote.exp +++ b/lib/remote.exp @@ -208,8 +208,8 @@ proc local_exec { commandline inp outp timeout } { } else { set status 0 } - verbose "output is $output" - if { $outp == "" } { + verbose "output is $output status $status" + if { $outp == "" || $outp == "|& cat" } { return [list $status $output] } else { return [list $status ""] diff --git a/lib/rsh.exp b/lib/rsh.exp index 1c08788..1a207a8 100644 --- a/lib/rsh.exp +++ b/lib/rsh.exp @@ -223,20 +223,10 @@ proc rsh_upload {desthost srcfile destfile} { # Execute CMD on BOARDNAME. # -proc rsh_exec { boardname cmd args } { - if { [llength $args] > 0 } { - set pargs [lindex $args 0] - if { [llength $args] > 1 } { - set inp [lindex $args 1] - } else { - set inp "" - } - } else { - set pargs "" - set inp "" - } +proc rsh_exec { boardname program pargs inp outp } { + global timeout - verbose "Executing $boardname:$cmd $pargs < $inp" + verbose "Executing $boardname:$program $pargs < $inp" if {![board_info $boardname exists rsh_prog]} { if { [which remsh] != 0 } { @@ -271,13 +261,20 @@ proc rsh_exec { boardname cmd args } { set inp "/dev/null" } - set status [catch "exec cat $inp | $RSH $rsh_useropts $hostname sh -c '$cmd $pargs \\; echo XYZ\\\${?}ZYX' |& cat" output] - verbose "$RSH output is $output" + set ret [local_exec "$RSH $rsh_useropts $hostname sh -c '$program $pargs \\; echo XYZ\\\${?}ZYX'" $inp $outp $timeout] + set status [lindex $ret 0] + set output [lindex $ret 1] + + verbose "$RSH status is $status, output is $output" + # `status' doesn't mean much here other than rsh worked ok. - # What we want is whether $cmd ran ok. + # What we want is whether $program ran ok. Return $status; + # if the program timed out, status will be 1 indicating that + # rsh ran and failed. If rsh fails, we will get FAIL rather + # than UNRESOLVED - this will help the problem be noticed. if { $status != 0 } { regsub "XYZ(\[0-9\]*)ZYX\n?" $output "" output - return [list -1 "$RSH to $boardname failed for $cmd, $output"] + return [list $status "$RSH to $boardname failed for $program, $output"] } regexp "XYZ(\[0-9\]*)ZYX" $output junk status verbose "rsh_exec: status:$status text:$output" 4 |