generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
10 _begin_fstest auto quick richacl
11
12 # Import common functions.
13
14 # real QA test starts here
15
16 _supported_fs generic
17
18 _require_scratch
19 _require_scratch_richacl
20 _require_richacl_prog
21 _require_runas
22
23 _scratch_mkfs_richacl >> $seqres.full
24 _scratch_mount
25
26 cd $SCRATCH_MNT
27
28 r()
29 {
30         echo "--- runas -u 99 -g 99 $*"
31         _runas -u 99 -g 99 -- "$@"
32 }
33
34 s()
35 {
36         echo "--- runas -u 99 -g 99 setrichacl $*"
37         _runas -u 99 -g 99 -- $SETRICHACL_PROG "$@"
38 }
39
40 # Create file as root
41 touch a
42
43 # We cannot set the acl as another user
44 s --set 'u:99:rwc::allow' a
45
46 # We cannot chmod as another user
47 r chmod 666 a
48
49 # Give user 99 the write_acl permission
50 $SETRICHACL_PROG --set 'u:99:rwpC::allow' a
51
52 # Now user 99 can setrichacl and chmod ...
53 s --set 'u:99:rwpC::allow' a
54 r chmod 666 a
55
56 # ... but chmod disables the write_acl permission
57 s --set 'u:99:rwpC::allow' a
58
59 # success, all done
60 status=0
61 exit