generic/405: test mkfs against thin provision device
[xfstests-dev.git] / tests / generic / 307
1 #! /bin/bash
2 # FS QA Test No. 307
3 #
4 # Check if ctime is updated and written to disk after setfacl
5 #
6 # Regression test for the following extN commits
7 # c6ac12a ext4: update ctime when changing the file's permission by setfacl
8 # 30e2bab ext3: update ctime when changing the file's permission by setfacl
9 # 523825b ext2: update ctime when changing the file's permission by setfacl
10 #
11 # Based on test 277
12 #
13 #-----------------------------------------------------------------------
14 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
15 #
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
19 #
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28 #-----------------------------------------------------------------------
29 #
30
31 seq=`basename $0`
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
34
35 status=1        # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 _cleanup()
39 {
40         cd /
41         rm -f $testfile
42 }
43
44 # get standard environment, filters and checks
45 . ./common/rc
46 . ./common/filter
47
48 testfile=$SCRATCH_MNT/testfile.$seq
49
50 # real QA test starts here
51 _supported_fs generic
52 _supported_os Linux
53 _require_scratch
54
55 echo "Silence is golden"
56
57 _scratch_mkfs >/dev/null 2>&1
58 _scratch_mount >/dev/null 2>&1
59
60 touch $testfile
61 _scratch_cycle_mount
62 ctime1=`stat -c %Z $testfile`
63
64 sleep 1
65 setfacl -m 'u::x,g::x,o::x' $testfile
66 ctime2=`stat -c %Z $testfile`
67
68 _scratch_cycle_mount
69 ctime3=`stat -c %Z $testfile`
70
71 if [ "$ctime1" == "$ctime2" ]; then
72         echo "error: ctime not updated after setfacl"
73 elif [ "$ctime1" == "$ctime3" ]; then
74         echo "error: on disk ctime not updated"
75 else
76         status=0
77 fi
78
79 exit