Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: gdb-patches@sources.redhat.com, dejagnu@gnu.org
Subject: DejaGnu: support nfsdir and nfsroot_server
Date: Wed, 05 Mar 2003 05:34:00 -0000	[thread overview]
Message-ID: <orptp6js03.fsf@free.redhat.lsd.ic.unicamp.br> (raw)

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dejagnu-nfsdir.patch --]
[-- Type: text/x-patch, Size: 2926 bytes --]

Index: dejagnu/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* 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];
 }
 

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
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

             reply	other threads:[~2003-03-05  5:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-05  5:34 Alexandre Oliva [this message]
2003-03-05 18:04 ` Rob Savoye
2003-03-05 18:36   ` Andrew Cagney
2003-03-05 19:39     ` Rob Savoye
2003-03-07 16:37       ` Andrew Cagney
2003-03-07 17:10         ` Rob Savoye
2003-03-07 19:15           ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=orptp6js03.fsf@free.redhat.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=dejagnu@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox