public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Set remotedir in local-remote-host-native.exp
@ 2023-03-21 10:07 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-03-21 10:07 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7c872c903c772ca6b269e5dbe2880dd084240ae6

commit 7c872c903c772ca6b269e5dbe2880dd084240ae6
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Mar 21 11:07:19 2023 +0100

    [gdb/testsuite] Set remotedir in local-remote-host-native.exp
    
    In commit ff581559f9d ("[gdb/testsuite] Add gdb.testsuite/board-sanity.exp") I
    removed handling of HOST_DIR in local-remote-host-native.exp to fix FAILs
    in test-case gdb.testsuite/board-sanity.exp.
    
    Reintroduce handling of HOST_DIR using remotedir, now that using remotedir for
    a host board no longer make compilation fail due to commit 80d6c79866f
    ("[gdb/testsuite] Handle remotedir in remote_upload").
    
    This fixes an XFAIL in gdb.testsuite/board-sanity.exp, introduced in commit
    3741934fdb0 ("[gdb/testsuite] Set remotedir by default in some boards").
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/boards/local-remote-host-native.exp | 25 +++++++++++++++++++++++
 gdb/testsuite/gdb.testsuite/board-sanity.exp      |  7 -------
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/boards/local-remote-host-native.exp b/gdb/testsuite/boards/local-remote-host-native.exp
index 911310b3072..2851eb09324 100644
--- a/gdb/testsuite/boards/local-remote-host-native.exp
+++ b/gdb/testsuite/boards/local-remote-host-native.exp
@@ -44,12 +44,37 @@ set_board_info hostname 127.0.0.1
 
 set_board_info username $env(USER)
 
+save_vars {rsh_cmd res} {
+    set rsh_cmd \
+	[join \
+	     [list \
+		  [board_info $board rsh_prog] \
+		  -l [board_info $board username] \
+		  [board_info $board hostname]]]
+
+    if [info exists HOST_DIR] {
+	set_board_info remotedir $HOST_DIR
+    } else {
+	# 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]]
+    }
+}
+
 # The ssh key should be correctly set up that you ssh to 127.0.0.1
 # without having to type password.
 set_board_info rsh_prog /usr/bin/ssh
 set_board_info rcp_prog /usr/bin/scp
 set_board_info file_transfer "rsh"
 
+if { $board_type == "host" } {
+    set_board_info gdb_opts "-d \"${HOST_DIR}\""
+}
+
 proc ${board}_spawn { board cmd } {
     global board_info
 
diff --git a/gdb/testsuite/gdb.testsuite/board-sanity.exp b/gdb/testsuite/gdb.testsuite/board-sanity.exp
index eb19db8699b..835707c9187 100644
--- a/gdb/testsuite/gdb.testsuite/board-sanity.exp
+++ b/gdb/testsuite/gdb.testsuite/board-sanity.exp
@@ -137,13 +137,6 @@ proc_with_prefix gdb_simple_compile_and_run {} {
     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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-21 10:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 10:07 [binutils-gdb] [gdb/testsuite] Set remotedir in local-remote-host-native.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).