Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 1/3] Extend cleanfiles for multiple hosts
Date: Fri, 15 Aug 2014 04:04:00 -0000	[thread overview]
Message-ID: <1408075184-25947-2-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1408075184-25947-1-git-send-email-yao@codesourcery.com>

Nowadays, GDB testsuite has a list cleanfiles which includes files copies
to target.  This patch is to extend it to an array, in which the key is
the host name, and the value is a list of file names.  In this way,
cleanfiles can be used to keep track of files copied to multiple hosts.
No functionality is changed.

gdb/testsuite:

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

	* lib/gdb.exp (gdb_download): Find the value in 'cleanfiles' by
	key 'target' and append $destname to it.
	(default_gdb_init): Clear array cleanfiles.
	(gdb_finish): Remove all files in 'cleanfiles' and clear it.
---
 gdb/testsuite/lib/gdb.exp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 92069c9..e175833 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3537,7 +3537,7 @@ proc gdb_download { filename } {
     global cleanfiles
 
     set destname [remote_download target $filename]
-    lappend cleanfiles $destname
+    lappend cleanfiles(target) $destname
     return $destname
 }
 
@@ -3595,7 +3595,7 @@ proc default_gdb_init { test_file_name } {
     global cleanfiles
     global pf_prefix
     
-    set cleanfiles {}
+    array unset cleanfiles
 
     gdb_clear_suppressed
 
@@ -3862,10 +3862,15 @@ proc gdb_finish { } {
     # Exit first, so that the files are no longer in use.
     gdb_exit
 
-    if { [llength $cleanfiles] > 0 } {
-	eval remote_file target delete $cleanfiles
-	set cleanfiles {}
+    # CLEANFILES is an array, in which the key is host name, such as
+    # 'target' or 'host' etc, and the value is a list of files copied
+    # to the machine represented by the key.
+    foreach dest [array names cleanfiles] {
+	foreach filename $cleanfiles($dest) {
+	    eval remote_file $dest delete $filename
+	}
     }
+    array unset cleanfiles
 
     # Unblock write access to the banned variables.  Dejagnu typically
     # resets some of them between testcases.
-- 
1.9.0


  reply	other threads:[~2014-08-15  4:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-15  4:04 [PATCH 0/3] Keep track of files copied to host and target Yao Qi
2014-08-15  4:04 ` Yao Qi [this message]
2014-08-15  4:04 ` [PATCH 2/3] Keep track of downloaded file in gdb_remote_download Yao Qi
2014-08-15  4:04 ` [PATCH 3/3] Copy .py files to remote host Yao Qi
2014-08-15  5:00 ` [PATCH 0/3] Keep track of files copied to host and target Doug Evans
2014-08-15  6:08   ` Yao Qi
2014-08-16  0:38     ` Doug Evans
2014-08-20  6:54       ` Yao Qi
2014-08-20 15:17         ` Pedro Alves
2014-08-20 15:48         ` Doug Evans
2014-08-21  0:35           ` Yao Qi
2014-08-21 17:32             ` Doug Evans
2014-08-22  6:14               ` Yao Qi

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=1408075184-25947-2-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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