From patchwork Tue Sep 2 14:53:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 2627 Received: (qmail 2338 invoked by alias); 2 Sep 2014 14:53:58 -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 2328 invoked by uid 89); 2 Sep 2014 14:53:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f54.google.com Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 02 Sep 2014 14:53:55 +0000 Received: by mail-pa0-f54.google.com with SMTP id fb1so14908868pad.27 for ; Tue, 02 Sep 2014 07:53:54 -0700 (PDT) X-Received: by 10.70.90.3 with SMTP id bs3mr48423422pdb.42.1409669634137; Tue, 02 Sep 2014 07:53:54 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id to4sm4245496pbc.39.2014.09.02.07.53.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Sep 2014 07:53:53 -0700 (PDT) From: Doug Evans To: Yao Qi Cc: Subject: Re: [PATCH] Another board file for remote host References: <1409232690-24185-1-git-send-email-yao@codesourcery.com> <87y4u2d9ic.fsf@codesourcery.com> Date: Tue, 02 Sep 2014 07:53:08 -0700 In-Reply-To: <87y4u2d9ic.fsf@codesourcery.com> (Yao Qi's message of "Tue, 2 Sep 2014 10:46:51 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Yao Qi writes: > Hi, here is the V2 to address comments I've got from Jan and Pedro: > > - Add more comments in the board file. > - Rename variable tmp_gdb to host_dir, and set it to > $build/gdb/testsuite/remote-host. > - I also tried to copy file to $build/gdb/testsuite/remote-host with > the directory, say copy file $src/gdb/testsuite/gdb.dwarf2/file1.txt > to $build/gdb/testsuite/remote-host/gdb.dwarf2/file1.txt. This > is suggested by Jan but GDB is unable to find file1.txt, because GDB > test harness doesn't set search directories for remote host, see > gdb_reinitialize_dir in lib/gdb.exp: > > proc gdb_reinitialize_dir { subdir } { > global gdb_prompt > > if [is_remote host] { > return "" > } > > so we have to set the search directory in the board file like > > set_board_info gdb_opts "-d \"${host_dir}\"" > > and copy file there without directory. > [...] Hi. Some comments inline. 2014-09-02 Yao Qi * boards/local-remote-host-native.exp: New file. I realize /usr/share/dejagnu/remote.exp:remote_download checks for whether the third parameter can be a list, but remote_download is a varargs function (the name of the last variable is "args") and is not a "board" function. Other ${foo}_download functions that are actual "board" functions, e.g., /usr/share/dejagnu/remote.exp:standard_download, or gdb/testsuite/boards/remote-stdio-gdbserver.exp, don't treat the third parameter as if it can be a list. + + if { ![file exists $host_dir] } { + file mkdir $host_dir + } + + set destfile [file join $host_dir $destfile] + file copy -force $src $destfile + + return $destfile +} 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..b2a0b31 --- /dev/null +++ b/gdb/testsuite/boards/local-remote-host-native.exp @@ -0,0 +1,86 @@ +# 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" +# +# We set both target board and host board together to test a native gdb +# (host == target) on a remote host (host != build). + +if { $board_type == "target" } { + set_board_info compiler gcc +} + +global GDB +set GDB [file join [pwd] "../gdb"] Check if GDB has been set first, allow the user to pass this in from the command line. + +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" + +# The directory to copy files to. In default, we choose ./remote-host, to +# avoiding messing up your HOME. You can choose other directory as +# you like. +set host_dir [file join [pwd] "remote-host"] How about allowing the user to pass this in from the command line? By convention such variables are then uppercase. + +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 env board_type + global host_dir + + if { [llength $dest] > 0 } { + set destfile [lindex $dest 0] + } else { + set destfile [file tail $src] + } This doesn't feel right.