[PATCH] Another board file for remote host

Yao Qi yao@codesourcery.com
Thu Aug 28 13:35:00 GMT 2014


In the recent review to my patch about copying files to remote host,
we find that we need a board file which is more closely mapped real
remote host testing to improve coverage.  With the board file
local-remote-host-native.exp, DejaGNU copies files to /tmp/gdb/ to
emulate the effect of remote host.  Is it OK?

gdb/testsuite:

2014-08-28  Yao Qi  <yao@codesourcery.com>

	* boards/local-remote-host-native.exp: New file.
---
 gdb/testsuite/boards/local-remote-host-native.exp | 79 +++++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 gdb/testsuite/boards/local-remote-host-native.exp

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..a3fd2dc
--- /dev/null
+++ b/gdb/testsuite/boards/local-remote-host-native.exp
@@ -0,0 +1,79 @@
+# 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 <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$ cd ${build_dir}/gdb
+# bash$ make check RUNTESTFLAGS="--host_board=local-remote-host-native --target_board=local-remote-host-native"
+
+if { $board_type == "target" } {
+    set_board_info compiler gcc
+}
+
+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"
+
+# The directory to copy files to.  In default, we choose /tmp/gdb, to
+# avoiding messing up your HOME.  You can choose other directory as
+# you like.
+set tmp_dir "/tmp/gdb"
+
+if { $board_type == "host" } {
+    set_board_info gdb_opts "-ex \"dir ${tmp_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 tmp_dir
+
+    if { [llength $dest] > 0 } {
+	set destfile [lindex $dest 0]
+    } else {
+	set destfile [file tail $src]
+    }
+
+    if { ![file exists $tmp_dir] } {
+	file mkdir $tmp_dir
+    }
+
+    set destfile [file join $tmp_dir $destfile]
+    file copy -force $src $destfile
+
+    return $destfile
+}
-- 
1.9.3



More information about the Gdb-patches mailing list