From patchwork Tue Jun 11 19:30:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1114195 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Ng8l36Ymz9sND for ; Wed, 12 Jun 2019 05:31:02 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 937A33EB0C4 for ; Tue, 11 Jun 2019 21:30:55 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) by picard.linux.it (Postfix) with ESMTP id 1E8CD3EA9E9 for ; Tue, 11 Jun 2019 21:30:44 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 2D9D3200B2B for ; Tue, 11 Jun 2019 21:30:43 +0200 (CEST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C64EFAF79; Tue, 11 Jun 2019 19:30:42 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Tue, 11 Jun 2019 21:30:19 +0200 Message-Id: <20190611193021.17651-3-pvorel@suse.cz> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190611193021.17651-1-pvorel@suse.cz> References: <20190611193021.17651-1-pvorel@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Cc: linux-integrity@vger.kernel.org, Mimi Zohar , Mimi Zohar , Ignaz Forster Subject: [LTP] [PATCH v3 2/4] shell: Add $TST_DEVICE as default parameter to tst_umount X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" + use it directly as a cleanup function in df01.sh Acked-by: Mimi Zohar Signed-off-by: Petr Vorel --- doc/test-writing-guidelines.txt | 4 ++-- testcases/commands/df/df01.sh | 7 +------ testcases/commands/mkfs/mkfs01.sh | 2 +- testcases/kernel/security/integrity/ima/tests/ima_setup.sh | 2 +- testcases/lib/tst_test.sh | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt index f1912dc12..fc64b418b 100644 --- a/doc/test-writing-guidelines.txt +++ b/doc/test-writing-guidelines.txt @@ -2115,8 +2115,8 @@ The 'tst_mount' mounts '$TST_DEVICE' of '$TST_FS_TYPE' (optional) to '$TST_MNT_PARAMS'. The '$TST_MNTPOINT' directory is created if it didn't exist prior to the function call. -If the path passed to the 'tst_umount' is not mounted (present in '/proc/mounts') -it's noop. +If the path passed (optional, defaults to '$TST_DEVICE') to the 'tst_umount' is +not mounted (present in '/proc/mounts') it's noop. Otherwise it retries to umount the filesystem a few times on a failure, which is a workaround since there are a daemons dumb enough to probe all newly mounted filesystems, which prevents them from umounting shortly after they diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh index 9b0be76fe..3876816dc 100755 --- a/testcases/commands/df/df01.sh +++ b/testcases/commands/df/df01.sh @@ -18,7 +18,7 @@ TST_CNT=12 TST_SETUP=setup -TST_CLEANUP=cleanup +TST_CLEANUP=tst_umount TST_TESTFUNC=test TST_OPTS="f:" TST_USAGE=usage @@ -54,11 +54,6 @@ setup() DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk '{print $5}') } -cleanup() -{ - tst_umount $TST_DEVICE -} - df_test() { local cmd="$1 -P" diff --git a/testcases/commands/mkfs/mkfs01.sh b/testcases/commands/mkfs/mkfs01.sh index 88f7f0baa..28af890b3 100755 --- a/testcases/commands/mkfs/mkfs01.sh +++ b/testcases/commands/mkfs/mkfs01.sh @@ -71,7 +71,7 @@ mkfs_verify_size() { tst_mount local blocknum=`df -P -B 1k mntpoint | tail -n1 | awk '{print $2}'` - tst_umount "$TST_DEVICE" + tst_umount if [ $blocknum -gt "$2" ]; then return 1 diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh index cbded42c2..da49eb1b2 100644 --- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh +++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh @@ -105,7 +105,7 @@ ima_cleanup() if [ "$TST_NEEDS_DEVICE" = 1 ]; then cd $TST_TMPDIR - tst_umount $TST_DEVICE + tst_umount fi } diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index 512732315..740253df1 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -259,7 +259,7 @@ tst_mount() tst_umount() { - local device="$1" + local device="${1:-$TST_DEVICE}" local i=0 if ! grep -q "$device" /proc/mounts; then