From patchwork Mon Oct 10 22:26:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 118849 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B4968B6F7C for ; Tue, 11 Oct 2011 09:27:00 +1100 (EST) Received: (qmail 1353 invoked by alias); 10 Oct 2011 22:26:58 -0000 Received: (qmail 1345 invoked by uid 22791); 10 Oct 2011 22:26:57 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Oct 2011 22:26:43 +0000 Received: by gyg8 with SMTP id 8so6942585gyg.20 for ; Mon, 10 Oct 2011 15:26:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.147.5.21 with SMTP id h21mr4038323yai.26.1318285602591; Mon, 10 Oct 2011 15:26:42 -0700 (PDT) Received: by 10.147.116.13 with HTTP; Mon, 10 Oct 2011 15:26:42 -0700 (PDT) Date: Tue, 11 Oct 2011 00:26:42 +0200 Message-ID: Subject: [PATCH, testsuite]: Close and unlink test file before exit From: Uros Bizjak To: gcc-patches@gcc.gnu.org Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello! Remove another orphan file from the testsuite directory. 2011-10-11 Uros Bizjak * lib/target-supports.exp (check_effective_target_fd_truncate): Close and unlink test file before exit. Tested on x86_64-pc-linux-gnu, committed to mainline SVN. Uros. Index: lib/target-supports.exp =================================================================== --- lib/target-supports.exp (revision 179773) +++ lib/target-supports.exp (working copy) @@ -3739,16 +3739,25 @@ int fd; const char t[] = "test writing more than ten characters"; char s[11]; - fd = fileno (f); + int status = 0; + fd = fileno (f); write (fd, t, sizeof (t) - 1); lseek (fd, 0, 0); if (ftruncate (fd, 10) != 0) - exit (1); + status = 1; close (fd); + fclose (f); + if (status) + { + unlink ("tst.tmp"); + exit (status); + } f = fopen ("tst.tmp", "rb"); if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0) - exit (1); - exit (0); + status = 1; + fclose (f); + unlink ("tst.tmp"); + exit (status); } }