misc: move exit status into trap handler
[xfstests-dev.git] / tests / generic / 389
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 389
6 #
7 # Test if O_TMPFILE files inherit POSIX Default ACLs when they are linked into
8 # the namespace.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/attr
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs generic
32
33 _require_test
34 _require_xfs_io_command "-T"
35 _require_xfs_io_command "flink"
36 _require_acls
37
38 # remove previous $seqres.full before test
39 rm -f $seqres.full
40
41 testdir="${TEST_DIR}/d.$seq"
42 testfile="${testdir}/tst-tmpfile-flink"
43
44 umask 022
45 rm -rf ${testdir}
46 mkdir -p ${testdir}
47 setfacl -d -m u::rwx,g::rwx,o::rx ${testdir}
48 $XFS_IO_PROG -T -m 0666 \
49         -c "pwrite 0 4096" \
50         -c "pread 0 4096" \
51         -c "flink ${testfile}" \
52         ${testdir} | _filter_xfs_io
53 stat -c '%a' ${testfile}
54
55 # success, all done
56 status=0
57 exit