mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
91c239fae9
exFAT's access time has 2s granularity and is rounded down. This can cause problems, e.g.: if real access times are: time1=2 and time2=7, then 7 - 2 = 5; but exfat_atime(7) - exfat_atime(2) => 6 - 2 = 4 which is less than expected delay. To fix this, even (delay - 1s) should be considered as a valid result for exFAT. Signed-off-by: Pavel Reichl <preichl@redhat.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
67 lines
1.3 KiB
Bash
Executable File
67 lines
1.3 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 192
|
|
#
|
|
# Simple test of atime
|
|
# - ensure it is persistent after unmount
|
|
# - check updated time by correct amount
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "exit \$status" 0 1 2 3 15
|
|
|
|
_access_time()
|
|
{
|
|
stat -c %X $1
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
|
|
_supported_fs generic
|
|
_require_test
|
|
_require_atime
|
|
delay=5
|
|
|
|
testfile=$TEST_DIR/testfile
|
|
rm -f $testfile
|
|
rm -f $seqres.full
|
|
|
|
echo test >$testfile
|
|
time1=`_access_time $testfile | tee -a $seqres.full`
|
|
|
|
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`
|
|
|
|
cd /
|
|
_test_cycle_mount
|
|
time3=`_access_time $testfile | tee -a $seqres.full`
|
|
|
|
delta1=`expr $time2 - $time1`
|
|
delta2=`expr $time3 - $time1`
|
|
|
|
min_tol=0
|
|
if [ "$FSTYP" = "exfat" ]; then
|
|
min_tol=1
|
|
fi
|
|
|
|
# tolerate an atime up to 2s later than the ideal case
|
|
_within_tolerance "delta1" $delta1 $delay $min_tol 2 -v
|
|
_within_tolerance "delta2" $delta2 $delta1 0 0 -v
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|