]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
258: test timestamps before the epoch
authorEric Sandeen <sandeen@redhat.com>
Mon, 19 Sep 2011 18:39:13 +0000 (18:39 +0000)
committerAlex Elder <aelder@sgi.com>
Fri, 23 Sep 2011 15:56:44 +0000 (10:56 -0500)
ext2/3/4 was sign-extending times before the timestamp when read
from disk on 64-bit systems.  This was fixed by:

4d7bf11d649c72621ca31b8ea12b9c94af380e63
ext2/3/4: fix file date underflow on ext2 3 filesystems on 64 bit systems

Here's a generic regression test.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
258 [new file with mode: 0644]
258.out [new file with mode: 0644]
group

diff --git a/258 b/258
new file mode 100644 (file)
index 0000000..6fadca0
--- /dev/null
+++ b/258
@@ -0,0 +1,68 @@
+#! /bin/bash
+# FS QA Test No. 258
+#
+# Test timestamps prior to epoch
+# On 64-bit, ext2/3/4 was sign-extending when read from disk
+# See also commit 4d7bf11d649c72621ca31b8ea12b9c94af380e63
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2011 Red Hat, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=sandeen@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+
+_cleanup()
+{
+    rm -f $tmp.*
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+TESTFILE=$TEST_DIR/timestamp-test.txt
+
+# Create a file with a timestamp prior to the epoch
+echo "Creating file with timestamp of Jan 1, 1960"
+touch -t 196001010101 $TESTFILE
+# Should yield -315593940 (prior to epoch)
+echo -n "Stat of file yields: "
+stat -c %X $TESTFILE
+
+# unmount, remount, and check the timestamp
+echo "Remounting to flush cache"
+umount $TEST_DEV
+mount $TEST_DEV $TEST_DIR
+
+# Should yield -315593940 (prior to epoch)
+echo -n "Stat of file yields: "
+stat -c %X $TESTFILE
+
+status=0 ; exit
diff --git a/258.out b/258.out
new file mode 100644 (file)
index 0000000..11b9168
--- /dev/null
+++ b/258.out
@@ -0,0 +1,5 @@
+QA output created by 258
+Creating file with timestamp of Jan 1, 1960
+Stat of file yields: -315593940
+Remounting to flush cache
+Stat of file yields: -315593940
diff --git a/group b/group
index a7424956f261d502246bed8a3b628bb310284217..24d4286dc0555457965df4ebd3020ee2ac1504cd 100644 (file)
--- a/group
+++ b/group
@@ -371,3 +371,4 @@ deprecated
 255 auto quick prealloc
 256 auto quick
 257 dir auto quick
+258 auto quick