* [PATCH] xfstests: make 258 more forgiving of timestamp rounding
@ 2011-10-03 16:52 Eric Sandeen
2011-10-05 12:20 ` Alex Elder
2011-10-06 19:47 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2011-10-03 16:52 UTC (permalink / raw)
To: xfs-oss
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfstests: make 258 more forgiving of timestamp rounding
2011-10-03 16:52 [PATCH] xfstests: make 258 more forgiving of timestamp rounding Eric Sandeen
@ 2011-10-05 12:20 ` Alex Elder
2011-10-06 19:47 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Alex Elder @ 2011-10-05 12:20 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Mon, 2011-10-03 at 11:52 -0500, Eric Sandeen wrote:
> 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>
Looks good.
Reviewed-by: Alex Elder <aelder@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfstests: make 258 more forgiving of timestamp rounding
2011-10-03 16:52 [PATCH] xfstests: make 258 more forgiving of timestamp rounding Eric Sandeen
2011-10-05 12:20 ` Alex Elder
@ 2011-10-06 19:47 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2011-10-06 19:47 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Mon, Oct 03, 2011 at 11:52:33AM -0500, Eric Sandeen wrote:
> 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>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-06 19:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 16:52 [PATCH] xfstests: make 258 more forgiving of timestamp rounding Eric Sandeen
2011-10-05 12:20 ` Alex Elder
2011-10-06 19:47 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox