Files
apfstests/tests/generic/120
T

86 lines
2.0 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-06-09 11:35:42 +10:00
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
#
# FS QA Test No. 120
#
# Test noatime mount option.
2006-05-08 15:29:52 +00:00
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
2006-05-08 15:29:52 +00:00
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
2013-03-15 12:28:04 +00:00
. ./common/rc
. ./common/filter
2006-05-08 15:29:52 +00:00
# real QA test starts here
2011-08-01 12:31:19 +02:00
_supported_fs generic
_supported_os Linux
2006-05-08 15:29:52 +00:00
_require_scratch
_require_atime
2011-08-01 12:31:19 +02:00
_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
2006-05-08 15:29:52 +00:00
2006-07-05 15:48:28 +00:00
_compare_access_times()
2006-05-08 15:29:52 +00:00
{
original_access_time="`cat $tmp.out | sed -n '5p'|awk '{ print substr($0,0,32)}'`"
2019-10-21 21:35:46 +08:00
accessed_time="`$here/src/lstat64 $1 | sed -n '5p'| awk '{ print substr($0,0,32)}'`"
2006-05-08 15:29:52 +00:00
echo "*** compare access times ***"
if [ "$original_access_time" != "$accessed_time" ]
then
echo "*** file access time updated on $2 (unexpected) ***"
cat $tmp.out
echo "---------------------------------------------------"
2019-10-21 21:35:46 +08:00
$here/src/lstat64 $1
2006-05-08 15:29:52 +00:00
mount | grep $SCRATCH_MNT
fi
}
if ! _try_scratch_mount "-o noatime" >$tmp.out 2>&1
2006-05-08 15:29:52 +00:00
then
cat $tmp.out
echo "!!! mount failed"
exit
fi
#executable file
echo "*** copying file ***"
2019-10-21 21:35:46 +08:00
cp $here/src/lstat64 $SCRATCH_MNT
$here/src/lstat64 $SCRATCH_MNT/lstat64 >$tmp.out
2006-05-08 15:29:52 +00:00
sleep 5
echo "*** executing file ***"
$SCRATCH_MNT/lstat64 $SCRATCH_MNT/lstat64 >/dev/null
_compare_access_times $SCRATCH_MNT/lstat64 "executing file"
#reading file
echo "*** creating file ***"
touch $SCRATCH_MNT/testfile
2019-10-21 21:35:46 +08:00
$here/src/lstat64 $SCRATCH_MNT/testfile >$tmp.out
2006-05-08 15:29:52 +00:00
sleep 5
echo "*** reading file ***"
cat $SCRATCH_MNT/testfile >/dev/null
_compare_access_times $SCRATCH_MNT/testfile "reading file"
#writing file
echo "*** creating file ***"
touch $SCRATCH_MNT/testfile2
2019-10-21 21:35:46 +08:00
$here/src/lstat64 $SCRATCH_MNT/testfile2 >$tmp.out
2006-05-08 15:29:52 +00:00
sleep 5
echo "*** writing to file ***"
echo "asdf" >> $SCRATCH_MNT/testfile2
_compare_access_times $SCRATCH_MNT/testfile2 "writing file"
2015-12-21 18:07:43 +11:00
_scratch_unmount
2006-05-08 15:29:52 +00:00
# success, all done
status=0
exit