[1/3] Extend cleanfiles for multiple hosts
Commit Message
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(-)
@@ -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.