From patchwork Tue Oct 10 22:39:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dilger X-Patchwork-Id: 824104 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yBXHD4Hr5z9t5C for ; Wed, 11 Oct 2017 09:44:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932316AbdJJWoj (ORCPT ); Tue, 10 Oct 2017 18:44:39 -0400 Received: from smtp-out-no.shaw.ca ([64.59.134.12]:35243 "EHLO smtp-out-no.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932114AbdJJWoj (ORCPT ); Tue, 10 Oct 2017 18:44:39 -0400 X-Greylist: delayed 343 seconds by postgrey-1.27 at vger.kernel.org; Tue, 10 Oct 2017 18:44:39 EDT Received: from cabot.adilger.int ([70.77.216.213]) by shaw.ca with SMTP id 23BoeIOGDI8mC23BpevgoN; Tue, 10 Oct 2017 16:39:53 -0600 X-Authority-Analysis: v=2.2 cv=HahkdmM8 c=1 sm=1 tr=0 a=BQvS1EmAg2ttxjPVUuc1UQ==:117 a=BQvS1EmAg2ttxjPVUuc1UQ==:17 a=RPJ6JBhKAAAA:8 a=xnZFGlbHvd4Em3DJCiIA:9 a=fa_un-3J20JGBB2Tu-mn:22 From: Andreas Dilger To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Andreas Dilger Subject: [PATCH] tests: don't leave temporary files at end of test Date: Tue, 10 Oct 2017 16:39:52 -0600 Message-Id: <1507675192-70000-1-git-send-email-adilger@dilger.ca> X-Mailer: git-send-email 1.8.0 X-CMAE-Envelope: MS4wfH22Adyfn+MggAsrb74gXRXLJ8AOOD/MjJdgUED5KxKas5APm5/c6CUE6n1MUrlkFY6kJ5QbTzDshHRWxHJ1u5lmyZDaBVph/THqIVSrJe5bZB1sC+4G 1rCXxFm41Vsma2VmR7Ybr1AjPTjHUSv1NR5pi53St6F4MK6HsHB8qswLhFGOsHz2CRv2x8+Nq415MGpP30iUJxAolesZ4jFWKQgfH6BD1KVyXsKwtxPrKfZo Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Don't leave temp files around after test has completed successfully. Some test scripts were creating their own temporary files, and in some cases test_one was skipping a test completely (e.g. slow) after the temp file had been created. Signed-off-by: Andreas Dilger --- tests/d_fallocate/script | 2 +- tests/d_fallocate_bigalloc/script | 2 +- tests/d_xattr_edits/script | 2 +- tests/test_one.in | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/d_fallocate/script b/tests/d_fallocate/script index ae8956e..b3982a3 100644 --- a/tests/d_fallocate/script +++ b/tests/d_fallocate/script @@ -165,8 +165,8 @@ if [ "$status" = 0 ] ; then else echo "$test_name: $test_description: failed" diff $DIFF_OPTS $EXP $OUT > $test_name.failed - rm -f $test_name.tmp fi +rm -f $EXP unset IMAGE FSCK_OPT OUT EXP diff --git a/tests/d_fallocate_bigalloc/script b/tests/d_fallocate_bigalloc/script index 6b6bf97..9022a2b 100644 --- a/tests/d_fallocate_bigalloc/script +++ b/tests/d_fallocate_bigalloc/script @@ -166,8 +166,8 @@ if [ "$status" = 0 ] ; then else echo "$test_name: $test_description: failed" diff $DIFF_OPTS $EXP $OUT > $test_name.failed - rm -f $test_name.tmp fi +rm -f $EXP unset IMAGE FSCK_OPT OUT EXP diff --git a/tests/d_xattr_edits/script b/tests/d_xattr_edits/script index df2a530..cd9d039 100644 --- a/tests/d_xattr_edits/script +++ b/tests/d_xattr_edits/script @@ -122,7 +122,7 @@ sed -f $cmd_dir/filter.sed $OUT.new >> $OUT # Do the verification # -rm -f $TMPFILE $OUT.new +rm -f $TMPFILE $OUT.new $TEST_DATA $VERIFY_DATA cmp -s $OUT $EXP status=$? diff --git a/tests/test_one.in b/tests/test_one.in index 9bf1185..c1f18dc 100644 --- a/tests/test_one.in +++ b/tests/test_one.in @@ -36,9 +36,6 @@ fi test_name=`echo $test_dir | sed -e 's;.*/;;'` -TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX) -trap 'rm -f $TMPFILE ; exit' 1 2 15 - if [ -f $test_dir ] ; then exit 0; fi @@ -63,6 +60,9 @@ fi rm -f $test_name.ok $test_name.failed #echo -e -n "$test_name: $test_description:\r" +TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX) +trap 'rm -f $TMPFILE ; exit' 1 2 15 + start=$SECONDS if [ -f $test_dir/script ]; then . $test_dir/script