From: Eric Sandeen Date: Mon, 3 Oct 2011 16:52:33 +0000 (+0000) Subject: xfstests: make 258 more forgiving of timestamp rounding X-Git-Tag: v1.1.0~11 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=2e0c5f8439cfb1da5657c0c8835747c52bec131a;hp=818df50cdf9eaa7d9bfd0e7f77a227b6fa231d2e xfstests: make 258 more forgiving of timestamp rounding 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 Reviewed-by: Christoph Hellwig Signed-off-by: Alex Elder --- diff --git a/258 b/258 index 6fadca0f..e0441a54 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,11 @@ 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 11b91685..87fae0ff 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