From patchwork Sun Apr 29 00:02:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yixin Zhang X-Patchwork-Id: 906065 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=213.254.12.146; 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=intel.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Y1ws5Z04z9ry1 for ; Sat, 28 Apr 2018 17:03:22 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0D6293E6338 for ; Sat, 28 Apr 2018 09:03:19 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 213913E6328 for ; Sat, 28 Apr 2018 09:03:16 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 44E026009F5 for ; Sat, 28 Apr 2018 09:03:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2018 00:03:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,338,1520924400"; d="scan'208";a="35906756" Received: from yixin-desktop.sh.intel.com ([10.239.161.27]) by fmsmga008.fm.intel.com with ESMTP; 28 Apr 2018 00:03:09 -0700 From: Yixin Zhang To: ltp@lists.linux.it Date: Sun, 29 Apr 2018 08:02:13 +0800 Message-Id: <20180429000213.685-1-yixin.zhang@intel.com> X-Mailer: git-send-email 2.14.1 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=2.5 required=7.0 tests=DATE_IN_FUTURE_12_24, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Cc: Yixin Zhang Subject: [LTP] [PATCH ltp] fs/ext4: enhance logic of ext4_nsec_timestamps_test 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: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 1. Check the big block devices at setup stage, umount it if it's mounted 2. Add "sleep 1" between mount and umount, to avoid umount failed due to device busy (accessed by system service like systemd-udev) 3. Add TFAIL if umount failed 4. Fix typo error Signed-off-by: Yixin Zhang --- .../ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh | 14 +++++++++----- testcases/kernel/fs/ext4-new-features/ext4_funcs.sh | 6 ++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh index c6ff7c2ba..5d561adf3 100755 --- a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh +++ b/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh @@ -76,8 +76,8 @@ ext4_test_nsec_timestamps() mkfs.ext3 -I 256 $EXT4_DEV >/dev/null 2>&1 if [ $? -ne 0 ]; then - tst_resm TFAIL "failed to create ext4 filesystem" - return + tst_resm TFAIL "failed to create ext3 filesystem" + return fi mount -t ext4 $EXT4_DEV mnt_point @@ -105,8 +105,7 @@ ext4_test_nsec_timestamps() nsec_ctime=`ext4_file_time mnt_point/tmp_file ctime nsec` # Test nanosecond - if [ $nsec_atime -eq 0 -a $nsec_mtime -eq 0 -a $nsec_ctime -eq 0 ] - then + if [ $nsec_atime -eq 0 -a $nsec_mtime -eq 0 -a $nsec_ctime -eq 0 ]; then tst_resm TFAIL "The timestamp is not nanosecond(nsec_atime: $nsec_atime, nsec_mtime: $nsec_mtime, nsec_ctime: $nsec_ctime)" umount mnt_point return @@ -138,7 +137,12 @@ ext4_test_nsec_timestamps() tst_resm TFAIL "failed to mount to ext3" return fi + sleep 1 umount mnt_point + if [ $? -ne 0 ]; then + tst_resm TFAIL "failed to umount ext3 filesystem" + return + fi mount -t ext4 $EXT4_DEV mnt_point if [ $? -ne 0 ]; then @@ -148,7 +152,7 @@ ext4_test_nsec_timestamps() nsec_atime2=`ext4_file_time mnt_point/tmp_file atime nsec` nsec_mtime2=`ext4_file_time mnt_point/tmp_file mtime nsec` - nsec_ctime2=`ext4_file_time mnt_point/tmp_file mtime nsec` + nsec_ctime2=`ext4_file_time mnt_point/tmp_file ctime nsec` if [ $nsec_atime -ne $nsec_atime2 -o $nsec_ctime -ne $nsec_ctime2 -o \ $nsec_mtime -ne $nsec_mtime2 ]; then diff --git a/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh b/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh index a9eb54e8d..4de7899e4 100755 --- a/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh +++ b/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh @@ -45,6 +45,12 @@ ext4_setup() tst_brkm TCONF "tests need a big block device(5G-10G)" else export EXT4_DEV=$LTP_BIG_DEV + if mount | cut -d' ' -f1 | grep -q ^$EXT4_DEV$ ; then + umount $EXT4_DEV >/dev/null 2>&1 + if [ $? -ne 0 ]; then + tst_brkm TCONF "umount $EXT4_DEV failed" + fi + fi fi tst_tmpdir