From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25969 invoked by alias); 5 Mar 2003 05:34:58 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25962 invoked from network); 5 Mar 2003 05:34:58 -0000 Received: from unknown (HELO lacrosse.corp.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 5 Mar 2003 05:34:58 -0000 Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id h255Yro04640; Wed, 5 Mar 2003 00:34:54 -0500 Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [127.0.0.1]) by free.redhat.lsd.ic.unicamp.br (8.12.8/8.12.8) with ESMTP id h255YqhW009332; Wed, 5 Mar 2003 02:34:52 -0300 Received: (from aoliva@localhost) by free.redhat.lsd.ic.unicamp.br (8.12.8/8.12.8/Submit) id h255Yq26009328; Wed, 5 Mar 2003 02:34:52 -0300 To: gdb-patches@sources.redhat.com, dejagnu@gnu.org Subject: DejaGnu: support nfsdir and nfsroot_server From: Alexandre Oliva Organization: GCC Team, Red Hat Date: Wed, 05 Mar 2003 05:34:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2003-03/txt/msg00120.txt.bz2 --=-=-= Content-length: 317 When a remote board supports rsh but not rcp, and it mounts its root filesystem from the test host, or from another host that supports rcp, we can take advantage of file sharing to upload and download files to/from the board. This patch implements this feature. Ok to install in the sources.redhat.com repository? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=dejagnu-nfsdir.patch Content-length: 2926 Index: dejagnu/ChangeLog from Alexandre Oliva * lib/remote.exp (standard_download, standard_upload): Support nfsdir and nfsroot_server. Index: dejagnu/lib/remote.exp =================================================================== RCS file: /cvs/src/src/dejagnu/lib/remote.exp,v retrieving revision 1.5 diff -u -p -r1.5 remote.exp --- dejagnu/lib/remote.exp 21 Apr 2002 08:47:07 -0000 1.5 +++ dejagnu/lib/remote.exp 5 Mar 2003 05:27:45 -0000 @@ -1,4 +1,4 @@ -# Copyright (C) 1992 - 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1992 - 2001, 2002, 2003 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 @@ -411,7 +411,42 @@ proc remote_download { dest file args } # proc standard_download {dest file destfile} { - return [rsh_download $dest $file $destfile]; + set orig_destfile $destfile + + if [board_info $dest exists nfsdir] { + set destdir [board_info $dest nfsdir] + if [board_info $dest exists nfsroot_server] { + set dest [board_info $dest nfsroot_server]; + } else { + set dest ""; + } + set destfile "$destdir/$destfile"; + } + + if { "$dest" != "" } { + set result [rsh_download $dest $file $destfile]; + if { $result == $destfile } { + return $orig_destfile; + } else { + return $result; + } + } + + set result [catch "exec cp -p $file $destfile" output]; + if [regexp "same file|are identical" $output] { + set result 0 + set output "" + } else { + # try to make sure we can read it + # and write it (in case we copy onto it again) + catch {exec chmod u+rw $destfile} + } + if { $result != 0 || $output != "" } { + perror "remote_download to $dest of $file to $destfile: $output" + return ""; + } else { + return $orig_destfile; + } } proc remote_upload {dest srcfile args} { @@ -433,6 +468,38 @@ proc remote_upload {dest srcfile args} { } proc standard_upload { dest srcfile destfile } { + set orig_srcfile $srcfile + + if [board_info $dest exists nfsdir] { + set destdir [board_info $dest nfsdir] + if [board_info $dest exists nfsroot_server] { + set dest [board_info $dest nfsroot_server]; + } else { + set dest ""; + } + set srcfile "$destdir/$srcfile"; + } + + if { "$dest" != "" } { + return [rsh_upload $dest $srcfile $destfile]; + } + + set result [catch "exec cp -p $srcfile $destfile" output]; + if [regexp "same file|are identical" $output] { + set result 0 + set output "" + } else { + # try to make sure we can read it + # and write it (in case we copy onto it again) + catch {exec chmod u+rw $destfile} + } + if { $result != 0 || $output != "" } { + perror "remote_upload to $dest of $file to $destfile: $output" + return ""; + } else { + return $destfile; + } + return [rsh_upload $dest $srcfile $destfile]; } --=-=-= Content-length: 289 -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist Professional serial bug killer --=-=-=--