diff options
author | Tom de Vries <tdevries@suse.de> | 2023-03-17 19:25:18 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-03-17 19:25:18 +0100 |
commit | 2a7d1e5ebbab35a6f3ff164653dfd0ba0e4448c0 (patch) | |
tree | 7f688e5fa951c1be0199c19762e56fe0398d30e3 /gdb/testsuite/boards | |
parent | 3741934fdb04cde6661335e160249f9a83e498a7 (diff) | |
download | binutils-2a7d1e5ebbab35a6f3ff164653dfd0ba0e4448c0.zip binutils-2a7d1e5ebbab35a6f3ff164653dfd0ba0e4448c0.tar.gz binutils-2a7d1e5ebbab35a6f3ff164653dfd0ba0e4448c0.tar.bz2 |
[gdb/testsuite] Handle REMOTE_HOST_USERNAME in local-remote-host
Handle REMOTE_HOST_USERNAME in local-remote-host, similar to how that's done for
REMOTE_TARGET_USERNAME in remote-gdbserver-on-localhost.
This helps to keep the home dir clean.
Since the setup makes $build/gdb/testsuite on build unreadable for the remote
host, we run into permission problems for GDB and the data-directory, so fix
this (as was done for gdbserver in gdbserver-base.exp) using file normalize.
Tested on x86_64-linux.
Diffstat (limited to 'gdb/testsuite/boards')
-rw-r--r-- | gdb/testsuite/boards/local-remote-host.exp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host.exp index e208504..f265208 100644 --- a/gdb/testsuite/boards/local-remote-host.exp +++ b/gdb/testsuite/boards/local-remote-host.exp @@ -22,12 +22,33 @@ # Like local-remote-host-notty, but with readline/editing enabled. -global GDB -set GDB [file join [pwd] "../gdb"] +set GDB [file normalize [file join [pwd] "../gdb"]] set_board_info hostname 127.0.0.1 -set_board_info username $env(USER) +if { [info exists REMOTE_HOST_USERNAME] } { + set_board_info username $REMOTE_HOST_USERNAME +} else { + set_board_info username $env(USER) +} + +# Handle separate test account. +if { [board_info $board username] != $env(USER) } { + # We're pretending that some local user account is remote host. + # Make things a bit more realistic by restricting file permissions. + + # Make sure remote host can't see files on build. + remote_exec build "chmod go-rx $objdir" + + # Make sure build can't see files on remote host. We can't use + # remote_exec host, because we're in the middle of parsing the + # host board. + remote_exec build \ + "[board_info $board rsh_prog] \ + -l [board_info $board username] \ + [board_info $board hostname] \ + chmod go-rx ." +} # The ssh key should be correctly set up that you ssh to 127.0.0.1 # without having to type password. |