4 # Test access time update issue for directories in upper layer.
6 # Upstream Commit cd91304e7190 ("ovl: fix relatime for directories")
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2017 Huawei. All Rights Reserved.
11 # Author: zhangyi (F) <yi.zhang@huawei.com>
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
47 # remove previous $seqres.full before test
50 # real QA test starts here
56 # remove all files from previous runs
59 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
60 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
61 mkdir -p $upperdir/test
63 _scratch_mount "-o relatime"
65 # access test dir, it's access time will be updated normally
68 pre_access_time=`stat -c "%X" $SCRATCH_MNT/test`
70 # In relatime mode, access time is only updated if the previous
71 # access time was earlier than the current modify or change time,
72 # so trigger modify and change time update.
73 touch $SCRATCH_MNT/test/foo
76 # access test dir again
77 ls $SCRATCH_MNT/test > /dev/null 2>&1
79 cur_access_time=`stat -c "%X" $SCRATCH_MNT/test`
81 # compare the results, current access time should later than the previous one
82 if [ $cur_access_time -le $pre_access_time ] ; then
83 echo "Access time is not updated correctly."
87 echo "Silence is golden"