From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 936ED38515D7 for ; Fri, 17 Mar 2023 18:26:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 936ED38515D7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CADB021A8F for ; Fri, 17 Mar 2023 18:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679077571; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z6EutzOxzHPTklR7I89H849sDG+nZMbMtLcQzfwhhWU=; b=bpW8nKXJrdha3Az33GWe2U4s+ioNiK+AGgI4KDiEP7nsGNW3BMmPioL8OfU8Trb2GpB3Xs kKeJBmlNfEjbrZ8j/RaRBkPniaVtRrNflK65614vWy8m/5Cq7jSr86R436remrpG2RqUTZ JhCM6MzhEipsRuqzhEdvzo+UmdyoHpI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679077571; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z6EutzOxzHPTklR7I89H849sDG+nZMbMtLcQzfwhhWU=; b=uEV6pcFINYANkzhyEIyGKYr76DyAmyiufXkaF4Z7s50zNRG9L+jSMLOiZq8b3tLYTNJpPv NJYDhoAGKduYywAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A69C413428 for ; Fri, 17 Mar 2023 18:26:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4JVnJ8OwFGTobQAAMHmgww (envelope-from ) for ; Fri, 17 Mar 2023 18:26:11 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed 1/4] [gdb/testsuite] Handle REMOTE_HOST_USERNAME in local-remote-host Date: Fri, 17 Mar 2023 19:26:08 +0100 Message-Id: <20230317182611.11723-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230317182611.11723-1-tdevries@suse.de> References: <20230317182611.11723-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. --- gdb/testsuite/boards/local-remote-host.exp | 27 +++++++++++++++++++--- gdb/testsuite/lib/gdb.exp | 2 +- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host.exp index e2085047882..f265208ddd9 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. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 7ceb702b0bf..8f3bbd986f5 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -176,7 +176,7 @@ verbose "using GDB = $GDB" 2 # we're testing a non-installed GDB in the build directory. Users may # also explictly override the -data-directory from the command line. if ![info exists GDB_DATA_DIRECTORY] { - set GDB_DATA_DIRECTORY "[pwd]/../data-directory" + set GDB_DATA_DIRECTORY [file normalize "[pwd]/../data-directory"] } verbose "using GDB_DATA_DIRECTORY = $GDB_DATA_DIRECTORY" 2 -- 2.35.3