From patchwork Sun Mar 2 07:20:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrick Wong X-Patchwork-Id: 325541 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7CFFB2C00A7 for ; Sun, 2 Mar 2014 18:20:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbaCBHUK (ORCPT ); Sun, 2 Mar 2014 02:20:10 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:44506 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbaCBHUJ (ORCPT ); Sun, 2 Mar 2014 02:20:09 -0500 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s227K7iJ021418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 Mar 2014 07:20:08 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s227K6wT023722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 2 Mar 2014 07:20:07 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s227K61K005710; Sun, 2 Mar 2014 07:20:06 GMT Received: from localhost (/67.160.151.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 01 Mar 2014 23:20:06 -0800 Subject: [PATCH 32/32] tests: test date handling To: tytso@mit.edu, darrick.wong@oracle.com From: "Darrick J. Wong" Cc: linux-ext4@vger.kernel.org Date: Sat, 01 Mar 2014 23:20:05 -0800 Message-ID: <20140302072005.28217.57465.stgit@birch.djwong.org> In-Reply-To: <20140302071639.28217.57302.stgit@birch.djwong.org> References: <20140302071639.28217.57302.stgit@birch.djwong.org> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Test our ability to handle the entire range of valid dates. Signed-off-by: Darrick J. Wong --- tests/metadata-checksum-test.sh | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tests/metadata-checksum-test.sh b/tests/metadata-checksum-test.sh index 05b88bc..7887d1a 100755 --- a/tests/metadata-checksum-test.sh +++ b/tests/metadata-checksum-test.sh @@ -3746,6 +3746,65 @@ ${fsck_cmd} -C0 -f -n "${DEV}" ${E2FSPROGS}/debugfs/debugfs -R 'ex /fragfile' "${DEV}" | tail -n 15 } +##################################### +function date_test { +msg "date_test" + +rm -rf /tmp/ls.before /tmp/ls.after /tmp/debugfs.diff + +INODE_SIZE="$(${E2FSPROGS}/misc/dumpe2fs -h "${DEV}" | grep 'Inode size:' | awk '{print $3}')" +if [ "${INODE_SIZE}" -gt 128 ]; then + LAST_YEAR=2430 +else + LAST_YEAR=2030 +fi + +# Write dates +${mount_cmd} ${MOUNT_OPTS} "${DEV}" "${MNT}" -t ext4 -o journal_checksum +seq 1910 20 "${LAST_YEAR}" | while read year; do + DATE="${year}-01-01 00:00:00.000000000" + FNAME="$(echo "${DATE}" | tr '[ \-:.]' '____')" + touch -d "${DATE}" "${MNT}/${FNAME}" + echo "${FNAME} ${DATE}" >> /tmp/ls.before +done +umount "${MNT}" +${fsck_cmd} -C0 -f -n "${DEV}" + +# debugfs +seq 1910 20 "${LAST_YEAR}" | while read year; do + DATE="${year}-01-01 00:00:00.000000000" + FNAME="$(echo "${DATE}" | tr '[ \-:.]' '____')" + echo "${FNAME}" "$(${E2FSPROGS}/debugfs/debugfs -R "stat ${FNAME}" "${DEV}" | grep 'mtime:')" +done > /tmp/debugfs.before + +# Re-read from kernel +${mount_cmd} ${MOUNT_OPTS} "${DEV}" "${MNT}" -t ext4 -o journal_checksum +seq 1910 20 "${LAST_YEAR}" | while read year; do + DATE="${year}-01-01 00:00:00.000000000" + FNAME="$(echo "${DATE}" | tr '[ \-:.]' '____')" + FDATE="$(stat -c '%y' "${MNT}/${FNAME}" | sed -e 's/......$//g')" + echo "${FNAME}" "${FDATE}" >> /tmp/ls.after +done +umount "${MNT}" + +# Did the kernel work? +diff -u /tmp/ls.before /tmp/ls.after > /tmp/ls.diff || true + +# Does debugfs work? +touch /tmp/debugfs.diff +cat /tmp/debugfs.before | sed -e 's/^\(....\).*\(....\)$/\1 \2/g' | while read date fdate crap; do + if [ "${date}" != "${fdate}" ]; then + echo "${date} != ${fdate}" >> /tmp/debugfs.diff + fi +done + +if [ "$(cat /tmp/debugfs.diff /tmp/ls.diff | wc -l)" -gt 0 ]; then + echo "BROKEN DATE HANDLING" + cat /tmp/debugfs.diff /tmp/ls.diff + false +fi +} + # This test should be the last one (before speed tests, anyway) #### ALL SPEED TESTS GO AT THE END