4aa8966d7e1fe08449949b3989a41f491d79840a
[xfstests-dev.git] / tests / xfs / 067
1 #! /bin/bash
2 # FS QA Test No. 067
3 #
4 # Test out acl/dacls which fit in shortform in the inode
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
33
34 # get standard environment, filters and checks
35 . ./common/rc
36 . ./common/filter
37 . ./common/attr
38
39 # real QA test starts here
40 _supported_fs xfs
41 _supported_os Linux
42
43 _require_attrs
44 _require_acls
45 _require_scratch
46
47 # set up fs for 1K inodes
48 isize=0
49 _scratch_mkfs_xfs | _filter_mkfs >$seqres.full 2>$tmp.mkfs
50 [ $? -eq 0 ] && source $tmp.mkfs
51 if [ "$isize" -lt 1024 ]; then
52     _scratch_mkfs_xfs -i size=1024 >>$seqres.full \
53         || _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
54 fi
55 _scratch_mount
56 $XFS_INFO_PROG $SCRATCH_MNT >>$seqres.full
57 cd $SCRATCH_MNT
58
59 echo ""
60 echo "=== Test out large ACLs  ==="
61
62 mkdir largeacldir
63
64 # John Trostel reported probs with going from 20 to 21 aces
65 # 20 ace ACL = 20*12+4 = 244 bytes
66 # 21 ace ACL = 21*12+4 = 256 bytes - too big for shortform
67 # the 21 ace ACL can not be shortform
68 #
69 acl20=`_create_n_aces 20`
70 acl21=`_create_n_aces 21`
71
72 echo "try 20 aces for access acl"
73 chacl $acl20 largeacldir
74 getfacl --numeric largeacldir | _filter_aces
75
76 echo "try 20 aces for default acl"
77 chacl -d $acl20 largeacldir
78 getfacl --numeric largeacldir | _filter_aces
79
80 echo "try 21 aces for access acl"
81 chacl $acl21 largeacldir
82 getfacl --numeric largeacldir | _filter_aces
83
84 echo "try 21 aces for default acl"
85 chacl -d $acl21 largeacldir
86 getfacl --numeric largeacldir | _filter_aces
87
88 # success, all done
89 status=0
90 exit