From patchwork Mon Sep 15 07:54:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 2843 Received: (qmail 25013 invoked by alias); 15 Sep 2014 07:59:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 25003 invoked by uid 89); 15 Sep 2014 07:59:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Sep 2014 07:59:18 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1XTRBr-0002Jn-JW from Yao_Qi@mentor.com ; Mon, 15 Sep 2014 00:59:15 -0700 Received: from GreenOnly (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.181.6; Mon, 15 Sep 2014 00:59:14 -0700 From: Yao Qi To: Doug Evans CC: Subject: Re: [PATCH] Another board file for remote host References: <1409232690-24185-1-git-send-email-yao@codesourcery.com> <87y4u2d9ic.fsf@codesourcery.com> <87d2bbcyn8.fsf@codesourcery.com> Date: Mon, 15 Sep 2014 15:54:59 +0800 In-Reply-To: (Doug Evans's message of "Sun, 14 Sep 2014 22:34:29 -0700") Message-ID: <8761gp48to.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Doug Evans writes: > With those two issues addressed I'm happy. They are fixed in the updated patch below. I'll commit it tomorrow if no other objections. > [I'm sure more issues will arise as I'm seeing failures > I wouldn't have expected. I didn't spend much time on them > and at any rate I think we can get this checked in so that > we can start addressing them collectively.] That sounds good to me too. diff --git a/gdb/testsuite/boards/local-remote-host-native.exp b/gdb/testsuite/boards/local-remote-host-native.exp new file mode 100644 index 0000000..69d40d9 --- /dev/null +++ b/gdb/testsuite/boards/local-remote-host-native.exp @@ -0,0 +1,85 @@ +# Copyright 2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file is a dejagnu "board file" and is used to run the testsuite +# against local host, in remote host mode. +# +# This board file is used to emulate the real remote host testing, in +# which file system of host and build are not shared. This is achieved +# by copying files from source directory to ${host_dir}. +# +# To use this file: +# bash$ cd ${build_dir}/gdb +# bash$ make check RUNTESTFLAGS="--host_board=local-remote-host-native --target_board=local-remote-host-native HOST_DIR=/tmp/foo/" +# +# We set both target board and host board together to test a native gdb +# (host == target) on a remote host (host != build). $HOST_DIR is the +# directory for copying files to, to avoid messing up your HOME. When +# it is absent, files are copied to ./remote-host. + +if { $board_type == "target" } { + set_board_info compiler gcc +} + +# We have to explicitly specify GDB with the path to the copy in +# the build directory because otherwise it will be set to the +# result of "transform GDB" since the harness thinks we're using +# a remote host. See lib/gdb.exp. +set GDB [file join [pwd] "../gdb"] +verbose -log "Overriding setting of GDB to $GDB" + +set_board_info hostname 127.0.0.1 + +set_board_info username $env(USER) + +# 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 { ![info exists HOST_DIR] } { + set HOST_DIR [file join [pwd] "remote-host"] +} + +if { $board_type == "host" } { + set_board_info gdb_opts "-d \"${HOST_DIR}\"" +} + +proc ${board}_spawn { board cmd } { + global board_info + + set remote [board_info $board hostname] + set username [board_info $board username] + set RSH [board_info $board rsh_prog] + + spawn $RSH -t -l $username $remote $cmd + set board_info($board,fileid) $spawn_id + return $spawn_id +} + +proc ${board}_download { board src dest } { + global HOST_DIR + + if { ![file exists $HOST_DIR] } { + file mkdir $HOST_DIR + } + + set destfile [file join $HOST_DIR $dest] + verbose -log "${board}_download: file copy -force $src $destfile" + file copy -force $src $destfile + + return $destfile +}