From patchwork Wed Oct 22 05:43:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 3321 Received: (qmail 9416 invoked by alias); 22 Oct 2014 05:47:54 -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 9311 invoked by uid 89); 22 Oct 2014 05:47:53 -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, RCVD_IN_DNSWL_NONE 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; Wed, 22 Oct 2014 05:47:52 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1Xgolx-0007Ww-FK from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 21 Oct 2014 22:47:49 -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.3.181.6; Tue, 21 Oct 2014 22:47:48 -0700 From: Yao Qi To: Subject: [PATCH 2/2] Prepare directory in case test_system fails Date: Wed, 22 Oct 2014 13:43:37 +0800 Message-ID: <1413956617-3979-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1413956617-3979-1-git-send-email-yao@codesourcery.com> References: <1413956617-3979-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes In gdb.base/fileio.c, some functions may depend on others. For example, test_rename renames a file to one directory which is created in test_system. That is means, if test_system fails, test_rename fails too, which is not a good practise, IMO. In test_system, system ("mkdir -p XX") is used to create directories needed for test_rename. In this patch, we use dejagnu remote_exec proc to create these directories on host. In my gdb testing, mingw32 host and arm-none-eabi target, system ("mkdir -p XX") doesn't work properly (this issue can be addressed separately), and this patch fixes the following fails. FAIL: gdb.base/fileio.exp: Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST FAIL: gdb.base/fileio.exp: Unlink a file FAIL: gdb.base/fileio.exp: Unlinking a file in a directory w/o write access returns EACCES gdb/testsuite: 2014-10-22 Yao Qi * gdb.base/fileio.exp: Make directories on host. --- gdb/testsuite/gdb.base/fileio.exp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp index 89f0997..00c2b16 100644 --- a/gdb/testsuite/gdb.base/fileio.exp +++ b/gdb/testsuite/gdb.base/fileio.exp @@ -210,6 +210,13 @@ gdb_test continue \ "Continuing\\..*system 4:.*OK$stop_msg" \ "System with invalid command returns 127" +# Prepare the directory for rename tests in case that test_system +# failed to create. +set dir1 [file join $outdir "dir1.fileio.test" "subdir.fileio.test"] +remote_exec host "mkdir -p $dir1" +set dir1 [file join $outdir "dir2.fileio.test"] +remote_exec host "mkdir $dir1" + gdb_test continue \ "Continuing\\..*rename 1:.*OK$stop_msg" \ "Rename a file"