From patchwork Fri Aug 15 03:59:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 2398 Received: (qmail 6971 invoked by alias); 15 Aug 2014 04:04:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 6952 invoked by uid 89); 15 Aug 2014 04:04:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Aug 2014 04:04:01 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1XI8kA-0005XA-Ic from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 14 Aug 2014 21:03:58 -0700 Received: from SVR-ORW-FEM-06.mgc.mentorg.com ([147.34.97.120]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 14 Aug 2014 21:03:58 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.2.247.3; Thu, 14 Aug 2014 21:03:57 -0700 From: Yao Qi To: Subject: [PATCH 1/3] Extend cleanfiles for multiple hosts Date: Fri, 15 Aug 2014 11:59:42 +0800 Message-ID: <1408075184-25947-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1408075184-25947-1-git-send-email-yao@codesourcery.com> References: <1408075184-25947-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes 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 * 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.