2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # Test noatime mount option.
10 _begin_fstest other atime auto quick
12 # Import common functions.
15 # real QA test starts here
21 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
23 _compare_access_times()
25 original_access_time="`cat $tmp.out | sed -n '5p'|awk '{ print substr($0,0,32)}'`"
26 accessed_time="`$here/src/lstat64 $1 | sed -n '5p'| awk '{ print substr($0,0,32)}'`"
27 echo "*** compare access times ***"
28 if [ "$original_access_time" != "$accessed_time" ]
30 echo "*** file access time updated on $2 (unexpected) ***"
32 echo "---------------------------------------------------"
34 mount | grep $SCRATCH_MNT
39 if ! _try_scratch_mount "-o noatime" >$tmp.out 2>&1
42 echo "!!! mount failed"
47 echo "*** copying file ***"
48 cp $here/src/lstat64 $SCRATCH_MNT
49 $here/src/lstat64 $SCRATCH_MNT/lstat64 >$tmp.out
51 echo "*** executing file ***"
52 $SCRATCH_MNT/lstat64 $SCRATCH_MNT/lstat64 >/dev/null
53 _compare_access_times $SCRATCH_MNT/lstat64 "executing file"
56 echo "*** creating file ***"
57 touch $SCRATCH_MNT/testfile
58 $here/src/lstat64 $SCRATCH_MNT/testfile >$tmp.out
60 echo "*** reading file ***"
61 cat $SCRATCH_MNT/testfile >/dev/null
62 _compare_access_times $SCRATCH_MNT/testfile "reading file"
65 echo "*** creating file ***"
66 touch $SCRATCH_MNT/testfile2
67 $here/src/lstat64 $SCRATCH_MNT/testfile2 >$tmp.out
69 echo "*** writing to file ***"
70 echo "asdf" >> $SCRATCH_MNT/testfile2
71 _compare_access_times $SCRATCH_MNT/testfile2 "writing file"