generic/192 would sleep 40 seconds, update a file's atime, and then
fail if the atime was not exactly 40 seconds later. This is
unreliable since things may be slow enough to cause an extra second
to elapse. "Fix" this by allowing for 2 seconds of delay. Also,
while we're at it shorten the sleep to a much more reasonable 5
seconds.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
_supported_os Linux
_require_test
_require_atime
-#delay=150
-#delay=75
-#delay=60
-#delay=45
-delay=40
+delay=5
testfile=$TEST_DIR/testfile
rm -f $testfile
echo test >$testfile
time1=`_access_time $testfile | tee -a $seqres.full`
-echo "sleep for $delay"
+echo "sleep for $delay seconds"
sleep $delay # sleep to allow time to move on for access
cat $testfile
time2=`_access_time $testfile | tee -a $seqres.full`
delta1=`expr $time2 - $time1`
delta2=`expr $time3 - $time1`
-echo "delta1 - access time after sleep in-core: $delta1"
-echo "delta2 - access time after sleep on-disk: $delta2"
+# tolerate an atime up to 2s later than the ideal case
+_within_tolerance "delta1" $delta1 $delay 0 2 -v
+_within_tolerance "delta2" $delta2 $delta1 0 0 -v
# success, all done
status=0
QA output created by 192
-sleep for 40
+sleep for 5 seconds
test
-delta1 - access time after sleep in-core: 40
-delta2 - access time after sleep on-disk: 40
+delta1 is in range
+delta2 is in range