Files
apfstests/tests/generic/080
T
Darrick J. Wong a860a167d8 common: kill _supported_os
fstests only supports Linux, so get rid of this unnecessary predicate.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2020-09-21 01:16:50 +08:00

65 lines
1.3 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# FS QA Test No. 080
#
# Verify that mtime is updated when writing to mmap-ed pages
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=0
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
rm -f $testfile
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# real QA test starts here
_supported_fs generic
_require_test
echo "Silence is golden."
rm -f $seqres.full
# pattern the file.
testfile=$TEST_DIR/mmap_mtime_testfile
$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $testfile >> $seqres.full
# sample timestamps.
mtime1=`stat -c %Y $testfile`
ctime1=`stat -c %Z $testfile`
echo "before mwrite: $mtime1 $ctime1" >> $seqres.full
# map read followed by map write to trigger timestamp change
sleep 2
$XFS_IO_PROG -c "mmap 0 4k" -c "mread 0 4k" -c "mwrite 0 4k" $testfile \
>> $seqres.full
# sample and verify that timestamps have changed.
mtime2=`stat -c %Y $testfile`
ctime2=`stat -c %Z $testfile`
echo "after mwrite : $mtime2 $ctime2" >> $seqres.full
if [ "$mtime1" == "$mtime2" ]; then
echo "mtime not updated"
let status=$status+1
fi
if [ "$ctime1" == "$ctime2" ]; then
echo "ctime not updated"
let status=$status+1
fi
exit