overlay: run unionmount testsuite test cases
[xfstests-dev.git] / tests / generic / 307
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 307
6 #
7 # Check if ctime is updated and written to disk after setfacl
8 #
9 # Regression test for the following extN commits
10 # c6ac12a ext4: update ctime when changing the file's permission by setfacl
11 # 30e2bab ext3: update ctime when changing the file's permission by setfacl
12 # 523825b ext2: update ctime when changing the file's permission by setfacl
13 #
14 # Based on test 277
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -f $testfile
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32 . ./common/attr
33
34 testfile=$SCRATCH_MNT/testfile.$seq
35
36 # real QA test starts here
37 _supported_fs generic
38 _supported_os Linux
39 _require_scratch
40 _require_acls
41
42 echo "Silence is golden"
43
44 _scratch_mkfs >/dev/null 2>&1
45 _scratch_mount >/dev/null 2>&1
46
47 touch $testfile
48 _scratch_cycle_mount
49 ctime1=`stat -c %Z $testfile`
50
51 sleep 1
52 setfacl -m 'u::x,g::x,o::x' $testfile
53 ctime2=`stat -c %Z $testfile`
54
55 _scratch_cycle_mount
56 ctime3=`stat -c %Z $testfile`
57
58 if [ "$ctime1" == "$ctime2" ]; then
59         echo "error: ctime not updated after setfacl"
60 elif [ "$ctime1" == "$ctime3" ]; then
61         echo "error: on disk ctime not updated"
62 else
63         status=0
64 fi
65
66 exit