misc: move exit status into trap handler
[xfstests-dev.git] / tests / generic / 364
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 364
6 #
7 # RichACL basic 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 . ./common/attr
27
28 # remove previous $seqres.full before test
29 rm -f $seqres.full
30
31 # real QA test starts here
32
33 _supported_fs generic
34
35 _require_scratch
36 _require_scratch_richacl
37 _require_richacl_prog
38
39 _scratch_mkfs_richacl >> $seqres.full
40 _scratch_mount
41
42 cd $SCRATCH_MNT
43
44 umask 022
45
46 touch x
47
48 $SETRICHACL_PROG --set 'everyone@:rwp::allow' x
49 stat -c %A x
50 $GETRICHACL_PROG x
51
52 chmod 664 x
53 stat -c %A x
54 $GETRICHACL_PROG x
55
56 # Note that unlike how the test cases look at first sight, we do *not* require
57 # a richacl-enabled version of ls here ...
58
59 mkdir sub
60 $SETRICHACL_PROG --set 'everyone@:rwpxd:fd:allow' sub
61 stat -c %A+ sub
62 _getfattr -m system\.richacl sub
63
64 chmod 775 sub
65 stat -c %A+ sub
66 _getfattr -m system\.richacl sub
67 $GETRICHACL_PROG sub
68
69 touch sub/f
70 stat -c %A sub/f
71 $GETRICHACL_PROG sub/f
72
73 mkdir sub/sub2
74 stat -c %A+ sub/sub2
75 $GETRICHACL_PROG sub/sub2
76
77 mkdir -m 750 sub/sub3
78 stat -c %A+ sub/sub3
79 $GETRICHACL_PROG sub/sub3
80
81 # success, all done
82 status=0
83 exit