}
set_board_info hostname localhost
-# Handle separate test account.
-if { [board_info $board username] != $env(USER) } {
- # We're pretending that some local user account is remote target.
- # Make things a bit more realistic by restricting file permissions.
-
- # Make sure remote target can't see files on build.
- remote_exec build "chmod go-rx $objdir"
-
- # Make sure build can't see files on remote target. We can't use
- # remote_exec target, because we're in the middle of parsing the
- # target board.
- remote_exec build \
- "[board_info $board rsh_prog] \
- -l [board_info $board username] \
- [board_info $board hostname] \
- chmod go-rx ."
+save_vars {rsh_cmd res} {
+ set rsh_cmd \
+ [join \
+ [list \
+ [board_info $board rsh_prog] \
+ -l [board_info $board username] \
+ [board_info $board hostname]]]
+
+ # Handle separate test account.
+ if { [board_info $board username] != $env(USER) } {
+ # We're pretending that some local user account is remote target.
+ # Make things a bit more realistic by restricting file permissions.
+
+ # Make sure remote target can't see files on build.
+ remote_exec build "chmod go-rx $objdir"
+
+ # Make sure build can't see files on remote target. We can't use
+ # remote_exec target, because we're in the middle of parsing the
+ # target board.
+ remote_exec build $rsh_cmd chmod go-rx ."
+ }
+
+ # Set remotedir by default, to force remote_download target to give an
+ # absolute file name.
+ set res [remote_exec build $rsh_cmd pwd]
+ if { [lindex $res 0] != 0 } {
+ error "Couldn't set remotedir using pwd"
+ }
+ set_board_info remotedir [string trim [lindex $res 1]]
}
proc ${board}_file { dest op args } {
# Some remote machines don't have writable home directories.
if [info exists REMOTE_TMPDIR] {
set_board_info remotedir $REMOTE_TMPDIR
+} else {
+ # Set remotedir by default, to force remote_download target to give an
+ # absolute file name.
+ save_vars {rsh_cmd res} {
+ set rsh_cmd \
+ [join \
+ [list \
+ [board_info $board rsh_prog] \
+ -l [board_info $board username] \
+ [board_info $board hostname]]]
+ set res [remote_exec build $rsh_cmd pwd]
+ if { [lindex $res 0] != 0 } {
+ error "Couldn't set remotedir using pwd"
+ }
+ set_board_info remotedir [string trim [lindex $res 1]]
+ }
}
if [info exists GDBSERVER] {
test_remote $remote $host_is_target
}
}
+
+proc_with_prefix gdb_simple_compile_and_run {} {
+ set src {
+ int main() {
+ return 0;
+ }
+ }
+
+ set test "compile"
+ if {![gdb_simple_compile board-sanity $src executable]} {
+ fail $test
+ return
+ }
+ pass $test
+
+ set target_obj [gdb_remote_download target $obj]
+ set result [remote_exec target $target_obj]
+ set status [lindex $result 0]
+ set output [lindex $result 1]
+
+ if { [host_info name] == "local-remote-host-native"
+ && [target_info name] == "local-remote-host-native" } {
+ # Setting remotedir on this board has effect on both host and
+ # target, and it seems to broken for host. Xfail this for now.
+ setup_xfail *-*-*
+ }
+ gdb_assert { $status == 0 && $output == "" }
+
+ remote_file build delete $obj
+}
+
+gdb_simple_compile_and_run