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
29 _scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
31 _compare_access_times()
33 original_access_time="`cat $tmp.out | sed -n '5p'|awk '{ print substr($0,0,32)}'`"
34 accessed_time="`src/lstat64 $1 | sed -n '5p'| awk '{ print substr($0,0,32)}'`"
35 echo "*** compare access times ***"
36 if [ "$original_access_time" != "$accessed_time" ]
38 echo "*** file access time updated on $2 (unexpected) ***"
40 echo "---------------------------------------------------"
42 mount | grep $SCRATCH_MNT
47 if ! _try_scratch_mount "-o noatime" >$tmp.out 2>&1
50 echo "!!! mount failed"
55 echo "*** copying file ***"
56 cp src/lstat64 $SCRATCH_MNT
57 src/lstat64 $SCRATCH_MNT/lstat64 >$tmp.out
59 echo "*** executing file ***"
60 $SCRATCH_MNT/lstat64 $SCRATCH_MNT/lstat64 >/dev/null
61 _compare_access_times $SCRATCH_MNT/lstat64 "executing file"
64 echo "*** creating file ***"
65 touch $SCRATCH_MNT/testfile
66 src/lstat64 $SCRATCH_MNT/testfile >$tmp.out
68 echo "*** reading file ***"
69 cat $SCRATCH_MNT/testfile >/dev/null
70 _compare_access_times $SCRATCH_MNT/testfile "reading file"
73 echo "*** creating file ***"
74 touch $SCRATCH_MNT/testfile2
75 src/lstat64 $SCRATCH_MNT/testfile2 >$tmp.out
77 echo "*** writing to file ***"
78 echo "asdf" >> $SCRATCH_MNT/testfile2
79 _compare_access_times $SCRATCH_MNT/testfile2 "writing file"