This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] new board file 'remote-host-native.exp'
On Tuesday, July 24, 2012 05:08:26 PM Pedro Alves wrote:
> Why natively? I'd think you could use both this host board with e.g.,
> a gdbserver target board file. I suggest:
>
> +# This file is a dejagnu "board file" and is used to run the testsuite
> +# against local host, in remote host mode.
>
> I'd even rename the file to local-remote-host.exp.
>
Looks term "native" can be used for target board file, while term
"local/remote" can be used for host board file. Comment is fixed.
I thought of 'local-remote-host.exp' before, but gave it up since I
was afraid people are confused by its name. I am fine with it.
> > +#
> > +# To use this file:
> > +# bash$ touch ${my_dejagnu_dir}/my-dejagnu.exp
> > +# bash$ export DEJAGNU=${my_dejagnu_dir}/my-dejagnu.exp
> > +# bash$ mkdir ${my_dejagnu_dir}/boards
> > +# bash$ cp ${src_dir}/gdb/testsuite/boards/remote-host-native.exp \
> > +# ${my_dejagnu_dir}/boards
> > +
> > +# Modify the location of GDB and the username to access your box
> > +# below.
> > +
> > +# bash$ cd ${build_dir}/gdb
> > +# bash$ make check RUNTESTFLAGS="--host_board=remote-host-native"
> > +
> > +load_generic_config "gdb"
>
> Why is this necessary? Why "gdb", and not "unix" ? What is "gdb"
> actually loading? Isn't this "gdb" the reason remote_download maps
> to gdb_download ? Otherwise, that gdb_download issue should have tripped
> up other configurations doing remote host testing, I'd think.
Yes, this line causes remote_donwload map to gdb_download. This line
is removed, and existing gdb_download doesn't have to be renamed.
>
> > +
> > +set_board_info gdb_protocol "standard"
>
> Why is this necessary? A host board file should only specify the bits
> for downloading and executing bits on the host, I think.
>
We don't have to set this in host board file. Removed.
> > +
> > +global GDB
> > +# Specify the location of GDB binary.
> > +set GDB "/your/built/gdb"
>
> How about we make this pick up the just built GDB ?
>
> set GDB [file join [pwd] "../gdb"]
>
Done.
> > +
> > +set_board_info compiler "[find_gcc]"
>
> Is this necessary in a host board file?
>
Again, we don't have to set this either in host board file. It should
be set in target board file.
> > +set_board_info hostname 127.0.0.1
> > +
> > +set_board_info username YOUR.USER.NAME
>
> We can make this pick up the current user by default on at least GNU/Linux,
> and probably other Unixen:
>
> set_board_info username $::env(USER)
>
What does these double colons mean? I use $env(USER), and it works fine.
> > +
> > +# 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"
> >
> > +
> > +proc ${board}_download { board src dest } {
> > +
> > + # If file name is a relative, convert it to absolute, otherwise file
> > can't + # be found on host, because the current directory usually is
> > /home/$USER. + if { [file pathtype $src] == "relative" } {
> > + return [file join [pwd] $src]
> > + } else {
> > + return $src
> > + }
> > +}
>
> Hmm, so the intention is to bypass the download to the host. I'd like a
> small comment above the function that says something to the effect.
Yes, with ${board}_download, files are not copied to somewhere else through
ssh, so the test is faster. One line of comment is added. How about the
new one?
--
Yao (éå)
gdb/testsuite:
2012-07-25 Yao Qi <yao@codesourcery.com>
Pedro Alves <palves@redhat.com>
* boards/local-remote-host.exp: New.
---
gdb/testsuite/boards/local-remote-host.exp | 55 ++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
create mode 100644 gdb/testsuite/boards/local-remote-host.exp
diff --git a/gdb/testsuite/boards/local-remote-host.exp b/gdb/testsuite/boards/local-remote-host.exp
new file mode 100644
index 0000000..d9f6372
--- /dev/null
+++ b/gdb/testsuite/boards/local-remote-host.exp
@@ -0,0 +1,55 @@
+# Copyright 2012 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 <http://www.gnu.org/licenses/>.
+
+# This file is a dejagnu "board file" and is used to run the testsuite
+# against local host, in remote host mode.
+#
+# To use this file:
+# bash$ touch ${my_dejagnu_dir}/my-dejagnu.exp
+# bash$ export DEJAGNU=${my_dejagnu_dir}/my-dejagnu.exp
+# bash$ mkdir ${my_dejagnu_dir}/boards
+# bash$ cp ${src_dir}/gdb/testsuite/boards/local-remote-host.exp \
+# ${my_dejagnu_dir}/boards
+
+# Modify the location of GDB and the username to access your box
+# below.
+
+# bash$ cd ${build_dir}/gdb
+# bash$ make check RUNTESTFLAGS="--host_board=local-remote-host"
+
+global GDB
+set GDB [file join [pwd] "../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"
+
+proc ${board}_download { board src dest } {
+
+ # If file name is a relative, convert it to absolute, otherwise file can't
+ # be found on host, because the current directory usually is /home/$USER.
+ # This also bypasses the real download to the host.
+ if { [file pathtype $src] == "relative" } {
+ return [file join [pwd] $src]
+ } else {
+ return $src
+ }
+}
--
1.7.7.6