btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / generic / 363
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 363
6 #
7 # RichACL auto-inheritance test
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26
27 # remove previous $seqres.full before test
28 rm -f $seqres.full
29
30 # real QA test starts here
31
32 _supported_fs generic
33
34 _require_scratch
35 _require_scratch_richacl
36 _require_richacl_prog
37
38 _scratch_mkfs_richacl >> $seqres.full
39 _scratch_mount
40
41 cd $SCRATCH_MNT
42
43 umask 022
44
45 mkdir d1
46 $SETRICHACL_PROG --modify owner@:rwpxd:fd:allow,u:101:rw:fd:deny d1
47 $SETRICHACL_PROG --modify u:102:rw:f:deny d1
48 $SETRICHACL_PROG --modify u:103:rw:d:deny d1
49 $SETRICHACL_PROG --modify g:101:rw:fdi:deny d1
50
51 $SETRICHACL_PROG --modify flags:a d1
52
53 $GETRICHACL_PROG --numeric --raw d1
54
55 mkdir d1/d2
56 touch d1/d3
57
58 # Mode bits derived from inherited ACEs
59 $GETRICHACL_PROG --numeric --raw d1/d2
60
61 $GETRICHACL_PROG --numeric --raw d1/d3
62
63 mkdir d1/d2/d4
64 touch d1/d2/d4/d5
65
66 # Protected files
67 mkdir d1/d6
68 touch d1/d7
69
70 $GETRICHACL_PROG --numeric --raw d1/d2/d4
71
72 $GETRICHACL_PROG --numeric --raw d1/d2/d4/d5
73
74 # Clear protected flag from all the ACLs
75 $SETRICHACL_PROG --modify flags:a d1/d2
76 $SETRICHACL_PROG --modify flags:a d1/d3
77 $SETRICHACL_PROG --modify flags:a d1/d2/d4
78 $SETRICHACL_PROG --modify flags:a d1/d2/d4/d5
79
80 $GETRICHACL_PROG --numeric d1 | sed -e 's/:fd:deny/:fd:allow/' > acl.txt
81 cat acl.txt
82
83 $SETRICHACL_PROG --set-file acl.txt d1
84
85 $GETRICHACL_PROG --numeric --raw d1
86
87 $GETRICHACL_PROG --numeric --raw d1/d2
88
89 $GETRICHACL_PROG --numeric --raw d1/d3
90
91 $GETRICHACL_PROG --numeric --raw d1/d2/d4
92
93 $GETRICHACL_PROG --numeric --raw d1/d2/d4/d5
94
95 # No automatic inheritance for protected files
96 $GETRICHACL_PROG --numeric --raw d1/d6
97
98 $GETRICHACL_PROG --numeric --raw d1/d7
99
100 # success, all done
101 status=0
102 exit