From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] xfstests: make 258 more forgiving of timestamp rounding
Date: Mon, 03 Oct 2011 11:52:33 -0500 [thread overview]
Message-ID: <4E89E851.80203@redhat.com> (raw)
Rather than testing for an exact timestamp, which could vary
due to rounding, just check that it is not positive,
which is the failure case we're looking for.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/258 b/258
index 6fadca0..ad73494 100644
--- a/258
+++ b/258
@@ -53,8 +53,12 @@ TESTFILE=$TEST_DIR/timestamp-test.txt
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
+echo "Testing for negative seconds since epoch"
+ts=`stat -c %X $TESTFILE`
+if [ "$ts" -ge 0 ]; then
+ echo "Timestamp wrapped: $ts"
+ _fail "Timestamp wrapped"
+fi
# unmount, remount, and check the timestamp
echo "Remounting to flush cache"
@@ -62,7 +66,12 @@ umount $TEST_DEV
mount $TEST_DEV $TEST_DIR
# Should yield -315593940 (prior to epoch)
-echo -n "Stat of file yields: "
-stat -c %X $TESTFILE
+echo "Testing for negative seconds since epoch"
+ts=`stat -c %X $TESTFILE`
+if [ "$ts" -ge 0 ]; then
+ echo "Timestamp wrapped: $ts"
+ _fail "Timestamp wrapped"
+fi
status=0 ; exit
+
diff --git a/258.out b/258.out
index 11b9168..87fae0f 100644
--- a/258.out
+++ b/258.out
@@ -1,5 +1,5 @@
QA output created by 258
Creating file with timestamp of Jan 1, 1960
-Stat of file yields: -315593940
+Testing for negative seconds since epoch
Remounting to flush cache
-Stat of file yields: -315593940
+Testing for negative seconds since epoch
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2011-10-03 16:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 16:52 Eric Sandeen [this message]
2011-10-05 12:20 ` [PATCH] xfstests: make 258 more forgiving of timestamp rounding Alex Elder
2011-10-06 19:47 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E89E851.80203@redhat.com \
--to=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.