generic: shutdown fs after log recovery
[xfstests-dev.git] / tests / generic / 080
1 #! /bin/bash
2 # FS QA Test No. 080
3 #
4 # Verify that mtime is updated when writing to mmap-ed pages
5 #
6 #-----------------------------------------------------------------------
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation.
10 #
11 # This program is distributed in the hope that it would be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write the Free Software Foundation,
18 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 #-----------------------------------------------------------------------
20 #
21
22 seq=`basename $0`
23 seqres=$RESULT_DIR/$seq
24 echo "QA output created by $seq"
25
26 here=`pwd`
27 tmp=/tmp/$$
28 status=0
29 trap "_cleanup; exit \$status" 0 1 2 3 15
30
31 _cleanup()
32 {
33         cd /
34         rm -f $tmp.*
35         rm -f $testfile
36 }
37
38 # get standard environment, filters and checks
39 . ./common/rc
40 . ./common/filter
41
42 # real QA test starts here
43 _supported_fs generic
44 _supported_os IRIX Linux
45 _require_test
46
47 echo "Silence is golden."
48 rm -f $seqres.full
49
50 # pattern the file.
51 testfile=$TEST_DIR/mmap_mtime_testfile
52 $XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $testfile >> $seqres.full
53
54 # sample timestamps.
55 mtime1=`stat -c %Y $testfile`
56 ctime1=`stat -c %Z $testfile`
57 echo "before mwrite: $mtime1 $ctime1" >> $seqres.full
58
59 # map read followed by map write to trigger timestamp change
60 sleep 2
61 $XFS_IO_PROG -c "mmap 0 4k" -c "mread 0 4k" -c "mwrite 0 4k" $testfile \
62         >> $seqres.full
63
64 # sample and verify that timestamps have changed.
65 mtime2=`stat -c %Y $testfile`
66 ctime2=`stat -c %Z $testfile`
67 echo "after mwrite : $mtime2 $ctime2" >> $seqres.full
68
69 if [ "$mtime1" == "$mtime2" ]; then
70         echo "mtime not updated"
71         let status=$status+1
72 fi
73 if [ "$ctime1" == "$ctime2" ]; then
74         echo "ctime not updated"
75         let status=$status+1
76 fi
77
78 exit