This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] new board file 'remote-host-native.exp'
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 24 Jul 2012 21:10:26 +0800
- Subject: [RFC] new board file 'remote-host-native.exp'
Hi, when fixing other PR, I need to make sure test case running well on
'remote host' as well. I write a new board file remote-host-native.exp
so that we can run gdb testsuite in 'remote-host' locally.
When run testsuite for 'remote-host', I get following error,
ERROR: tcl error sourcing ../../../../git/gdb/testsuite/gdb.base/break.exp.
ERROR: wrong # args: should be "gdb_download filename"
while executing
"gdb_download "remote-host" ../../../../git/gdb/testsuite/gdb.base/break.c break.c"
("eval" body line 1)
invoked from within
"eval ${try}_${proc} \"$dest\" $args"
(procedure "call_remote" line 66)
invoked from within
"call_remote "" download $dest $file $destfile"
(procedure "remote_download" line 30)
invoked from within
"remote_download host $x"
(procedure "default_target_compile" line 323)
invoked from within
"default_target_compile $source $destfile $type $options"
(procedure "target_compile" line 6)
invoked from within
"target_compile $source $dest $type $options"
(procedure "gdb_compile" line 142)
invoked from within
"gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options"
As we can see, dejagnu looks proc ${board}_download, and matches gdb_download. However,
we can't simply change the parameters of gdb_download to meet the required parameters.
This will cause an endless recurisive call "remote_download->call_remote->gdb_download
->remote_download". This patch simply renames this proc to gdb_download_1.
As this patch applied, there are a lot of fails when running testsuite with
board file remote-host-native.exp. Some of them are intermittent, and
some of them reflect the flaws in test cases.
gdb/testsuite:
2012-07-24 Yao Qi <yao@codesourcery.com>
* boards/remote-host-native.exp: New board file.
* lib/gdb.exp: Rename gdb_downlad to gdb_download_1.
(gdb_load_shlibs): Caller update.
* lib/gdbserver-support.exp (gdbserver_download_current_prog):
Likewise.
* lib/mi-support.exp (mi_load_shlibs): Likewise.
* gdb.base/jit-so.exp, gdb.base/jit.exp: Likewise.
---
gdb/testsuite/boards/remote-host-native.exp | 60 +++++++++++++++++++++++++++
gdb/testsuite/gdb.base/jit-so.exp | 2 +-
gdb/testsuite/gdb.base/jit.exp | 2 +-
gdb/testsuite/lib/gdb.exp | 6 +-
gdb/testsuite/lib/gdbserver-support.exp | 2 +-
gdb/testsuite/lib/mi-support.exp | 2 +-
6 files changed, 67 insertions(+), 7 deletions(-)
create mode 100644 gdb/testsuite/boards/remote-host-native.exp
diff --git a/gdb/testsuite/boards/remote-host-native.exp b/gdb/testsuite/boards/remote-host-native.exp
new file mode 100644
index 0000000..cdb0684
--- /dev/null
+++ b/gdb/testsuite/boards/remote-host-native.exp
@@ -0,0 +1,60 @@
+# 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
+# natively in remote host.
+#
+# 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"
+
+set_board_info gdb_protocol "standard"
+
+global GDB
+# Specify the location of GDB binary.
+set GDB "/your/built/gdb"
+
+set_board_info compiler "[find_gcc]"
+set_board_info hostname 127.0.0.1
+
+set_board_info username YOUR.USER.NAME
+
+# 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
+ }
+}
diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp
index 36f18ad..95c2eac 100644
--- a/gdb/testsuite/gdb.base/jit-so.exp
+++ b/gdb/testsuite/gdb.base/jit-so.exp
@@ -61,7 +61,7 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
return -1
}
-set solib_binfile_target [gdb_download ${solib_binfile}]
+set solib_binfile_target [gdb_download_1 ${solib_binfile}]
proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index 3034e6a..699b336 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -49,7 +49,7 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
return -1
}
-set solib_binfile_target [gdb_download ${solib_binfile}]
+set solib_binfile_target [gdb_download_1 ${solib_binfile}]
proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
global verbose testfile solib_binfile_target solib_binfile_test_msg
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4f2b7c9..257e76e 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2964,12 +2964,12 @@ proc gdb_touch_execfile { binfile } {
}
}
-# gdb_download
+# gdb_download_1
#
# Copy a file to the remote target and return its target filename.
# Schedule the file to be deleted at the end of this test.
-proc gdb_download { filename } {
+proc gdb_download_1 { filename } {
global cleanfiles
set destname [remote_download target $filename]
@@ -2987,7 +2987,7 @@ proc gdb_load_shlibs { args } {
}
foreach file $args {
- gdb_download [shlib_target_file $file]
+ gdb_download_1 [shlib_target_file $file]
}
# Even if the target supplies full paths for shared libraries,
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index ee66e48..63933b7 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -177,7 +177,7 @@ proc gdbserver_download_current_prog { } {
set gdbserver_host_exec $host_exec
set gdbserver_host_mtime [file mtime $host_exec]
if [is_remote target] {
- set gdbserver_server_exec [gdb_download $host_exec]
+ set gdbserver_server_exec [gdb_download_1 $host_exec]
} else {
set gdbserver_server_exec $host_exec
}
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 401565d..28199bd 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1908,7 +1908,7 @@ proc mi_load_shlibs { args } {
}
foreach file $args {
- gdb_download [shlib_target_file $file]
+ gdb_download_1 [shlib_target_file $file]
}
# Even if the target supplies full paths for shared libraries,
--
1.7.7.6