Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* DejaGnu: support nfsdir and nfsroot_server
@ 2003-03-05  5:34 Alexandre Oliva
  2003-03-05 18:04 ` Rob Savoye
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Oliva @ 2003-03-05  5:34 UTC (permalink / raw)
  To: gdb-patches, dejagnu

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-03-07 19:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-05  5:34 DejaGnu: support nfsdir and nfsroot_server Alexandre Oliva
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox