diff --git a/config/unix.exp b/config/unix.exp index c9d80dc..428f741 100644 --- a/config/unix.exp +++ b/config/unix.exp @@ -97,7 +97,7 @@ proc unix_load { dest prog args } { setenv SHLIB_PATH $orig_ld_library_path } } else { - set remotefile "/tmp/[file tail $prog].[pid]" + set remotefile [file tail $prog] set remotefile [remote_download $dest $prog $remotefile] if { $remotefile == "" } { verbose -log "Download of $prog to [board_info $dest name] failed." 3 diff --git a/lib/remote.exp b/lib/remote.exp index 043368b..b5f6006 100644 --- a/lib/remote.exp +++ b/lib/remote.exp @@ -277,6 +277,8 @@ proc local_exec { commandline inp outp timeout } { # redirected). # proc remote_exec { hostname program args } { + global remotedir + if { [llength $args] > 0 } { set pargs [lindex $args 0] } else { @@ -312,6 +314,9 @@ proc remote_exec { hostname program args } { if { ![is_remote $hostname] } { set result [local_exec "$program $pargs" $inp $outp $timeout] } else { + if { [info exists remotedir] } { + set program "cd $remotedir ; $program" + } set result [call_remote "" exec $hostname $program $pargs $inp $outp] } @@ -329,6 +334,11 @@ proc standard_exec { hostname args } { # or target, host or build. # proc remote_close { host } { + global remotedir + + if {[info exists remotedir]} { + remote_exec $host "/bin/rm" "-rf $remotedir" + } while { 1 } { set result [call_remote "" close "$host"] if { [remote_pop_conn $host] != "pass" } { @@ -422,6 +432,8 @@ proc standard_reboot { host } { # proc remote_download { dest file args } { + global remotedir + if { [llength $args] > 0 } { set destfile [lindex $args 0] } else { @@ -449,6 +461,16 @@ proc remote_download { dest file args } { } } } + if { ![info exists remotedir] } { + set rtmp "/tmp/runtest.[pid]" + set status [remote_exec $dest mkdir "-p $rtmp"] + if { [lindex $status 0] != 0 } { + verbose -log "Couldn't create remote directory $rtmp on $dest" 3 + return [list "unresolved" ""] + } + set remotedir $rtmp + } + set destfile "$remotedir/$destfile" return [call_remote "" download $dest $file $destfile] } @@ -1049,7 +1071,7 @@ proc standard_load { dest prog args } { } if {[is_remote $dest]} { - set remotefile "/tmp/[file tail $prog].[pid]" + set remotefile [file tail $prog] set remotefile [remote_download $dest $prog $remotefile] if { $remotefile == "" } { verbose -log "Download of $prog to [board_info $dest name] failed." 3