2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # Test noatime mount option.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18 # get standard environment, filters and checks
22 # real QA test starts here
28 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
30 _compare_access_times()
32 original_access_time="`cat $tmp.out | sed -n '5p'|awk '{ print substr($0,0,32)}'`"
33 accessed_time="`$here/src/lstat64 $1 | sed -n '5p'| awk '{ print substr($0,0,32)}'`"
34 echo "*** compare access times ***"
35 if [ "$original_access_time" != "$accessed_time" ]
37 echo "*** file access time updated on $2 (unexpected) ***"
39 echo "---------------------------------------------------"
41 mount | grep $SCRATCH_MNT
46 if ! _try_scratch_mount "-o noatime" >$tmp.out 2>&1
49 echo "!!! mount failed"
54 echo "*** copying file ***"
55 cp $here/src/lstat64 $SCRATCH_MNT
56 $here/src/lstat64 $SCRATCH_MNT/lstat64 >$tmp.out
58 echo "*** executing file ***"
59 $SCRATCH_MNT/lstat64 $SCRATCH_MNT/lstat64 >/dev/null
60 _compare_access_times $SCRATCH_MNT/lstat64 "executing file"
63 echo "*** creating file ***"
64 touch $SCRATCH_MNT/testfile
65 $here/src/lstat64 $SCRATCH_MNT/testfile >$tmp.out
67 echo "*** reading file ***"
68 cat $SCRATCH_MNT/testfile >/dev/null
69 _compare_access_times $SCRATCH_MNT/testfile "reading file"
72 echo "*** creating file ***"
73 touch $SCRATCH_MNT/testfile2
74 $here/src/lstat64 $SCRATCH_MNT/testfile2 >$tmp.out
76 echo "*** writing to file ***"
77 echo "asdf" >> $SCRATCH_MNT/testfile2
78 _compare_access_times $SCRATCH_MNT/testfile2 "writing file"