fstests: use _require_symlinks on all necessary tests
[xfstests-dev.git] / tests / generic / 365
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 365
6 #
7 # RichACL chmod 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 _supported_os Linux
34
35 _require_scratch
36 _require_scratch_richacl
37 _require_richacl_prog
38 _require_runas
39
40 _scratch_mkfs_richacl >> $seqres.full
41 _scratch_mount
42
43 cd $SCRATCH_MNT
44
45 r()
46 {
47         echo "--- runas -u 99 -g 99 $*"
48         _runas -u 99 -g 99 -- "$@"
49 }
50
51 s()
52 {
53         echo "--- runas -u 99 -g 99 setrichacl $*"
54         _runas -u 99 -g 99 -- $SETRICHACL_PROG "$@"
55 }
56
57 # Create file as root
58 touch a
59
60 # We cannot set the acl as another user
61 s --set 'u:99:rwc::allow' a
62
63 # We cannot chmod as another user
64 r chmod 666 a
65
66 # Give user 99 the write_acl permission
67 $SETRICHACL_PROG --set 'u:99:rwpC::allow' a
68
69 # Now user 99 can setrichacl and chmod ...
70 s --set 'u:99:rwpC::allow' a
71 r chmod 666 a
72
73 # ... but chmod disables the write_acl permission
74 s --set 'u:99:rwpC::allow' a
75
76 # success, all done
77 status=0
78 exit