From patchwork Fri May 4 18:38:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yixin Zhang X-Patchwork-Id: 908416 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 40cZT01wSSz9s0q for ; Fri, 4 May 2018 11:39:59 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 534933E75D6 for ; Fri, 4 May 2018 03:39:56 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) by picard.linux.it (Postfix) with ESMTP id 8312B3E75D4 for ; Fri, 4 May 2018 03:39:52 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 2D88F14010C5 for ; Fri, 4 May 2018 03:39:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 18:39:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,360,1520924400"; d="scan'208";a="46633124" Received: from yixin-desktop.sh.intel.com ([10.239.161.27]) by FMSMGA003.fm.intel.com with ESMTP; 03 May 2018 18:39:42 -0700 From: Yixin Zhang To: ltp@lists.linux.it Date: Sat, 5 May 2018 02:38:42 +0800 Message-Id: <20180504183842.32501-1-yixin.zhang@intel.com> X-Mailer: git-send-email 2.14.1 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.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-6.smtp.seeweb.it Cc: Yixin Zhang Subject: [LTP] [PATCH v2 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 device at do_setup(), TBROK if it's mounted 2. Replace umount to tst_umount to handle umount failed due to device busy 3. Fix typo error Signed-off-by: Yixin Zhang --- .../ext4_nsec_timestamps_test.sh | 34 ++++++++-------------- .../kernel/fs/ext4-new-features/ext4_funcs.sh | 3 ++ 2 files changed, 15 insertions(+), 22 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..69ae74c42 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 @@ -56,15 +56,10 @@ ext4_test_sec_timestamps() if [ $atime -ne 0 -o $mtime -ne 0 -o $ctime -ne 0 ]; then tst_resm TFAIL "Timestamp is not second(atime: $atime, mtime: \ $mtime, ctime: $ctime)" - umount mnt_point - return - fi - - umount mnt_point - if [ $? -ne 0 ]; then - tst_resm TFAIL "failed to umount ext4 filesystem" + tst_umount mnt_point return fi + tst_umount mnt_point tst_resm TPASS "Ext4 nanosecond timestamps test with 128 inode size pass" } @@ -76,8 +71,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,10 +100,9 @@ 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 + tst_mount mnt_point return fi @@ -122,15 +116,11 @@ ext4_test_nsec_timestamps() than the current time we got.(sec_atime: $sec_atime, \ sec_mtime: $sec_mtime, sec_ctime: $sec_ctime, \ cur_time[s]: $sec)" - umount mnt_point + tst_umount mnt_point return fi - umount mnt_point - if [ $? -ne 0 ]; then - tst_resm TFAIL "failed to umount ext4 filesystem" - return - fi + tst_umount mnt_point # Test mount to ext3 and then mount back to ext4 mount -t ext3 $EXT4_DEV mnt_point @@ -138,7 +128,7 @@ ext4_test_nsec_timestamps() tst_resm TFAIL "failed to mount to ext3" return fi - umount mnt_point + tst_umount mnt_point mount -t ext4 $EXT4_DEV mnt_point if [ $? -ne 0 ]; then @@ -148,7 +138,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 @@ -156,11 +146,11 @@ ext4_test_nsec_timestamps() unexpected. Before[atime mtime ctime]: $nsec_atime \ $nsec_mtime $nsec_ctime, After[atime mtime ctime]: \ $nsec_atime2 $nsec_mtime2 $nsec_ctime2)" - umount mnt_point + tst_umount mnt_point return fi - umount mnt_point + tst_umount mnt_point tst_resm TPASS "Ext4 nanosecond timestamps test with 256 inode size pass" } diff --git a/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh b/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh index a9eb54e8d..1514da5a2 100755 --- a/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh +++ b/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh @@ -45,6 +45,9 @@ 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 + tst_brkm TBROK "$EXT4_DEV should be umounted before test" + fi fi tst_tmpdir