generic/554: hide permision warning on exfat
[xfstests-dev.git] / tests / generic / 215
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2009 Christoph Hellwig.
4 #
5 # FS QA Test No. 215
6 #
7 # Test out c/mtime updates after mapped writes.
8 #
9 # Based on the testcase in http://bugzilla.kernel.org/show_bug.cgi?id=2645
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 _cleanup()
16 {
17         cd /
18         rm -f $testfile
19 }
20
21 here=`pwd`
22 tmp=/tmp/$$
23 status=1        # failure is the default!
24 trap "_cleanup; exit \$status" 0 1 2 3 15
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs generic
32 _require_test
33
34 testfile=$TEST_DIR/tst.mmap
35
36 echo
37 echo "creating test file"
38 dd if=/dev/zero of=$testfile count=4096
39
40 mtime1=`stat -c "%Y" $testfile`
41 ctime1=`stat -c "%Z" $testfile`
42
43 sleep 2
44
45 echo
46 echo "writing via mmap"
47 $XFS_IO_PROG -f                 \
48         -c 'mmap 0 4096'        \
49         -c 'mwrite 0 4096'      \
50         $testfile | _filter_xfs_io_unique
51
52 mtime2=`stat -c "%Y" $testfile`
53 ctime2=`stat -c "%Z" $testfile`
54
55 let mtime_diff=$mtime2-$mtime1
56 let ctime_diff=$ctime2-$ctime1
57
58 if [ "$mtime_diff" -eq "0" ]; then
59    echo "FAIL: mtime not update after mapped write"
60 fi
61
62 if [ "$ctime_diff" -eq "0" ]; then
63    echo "FAIL: ctime not update after mapped write"
64 fi
65
66 # success, all done
67 echo "*** done"
68 rm -f $seqres.full
69 status=0