generic/395: remove workarounds for wrong error codes
[xfstests-dev.git] / tests / generic / 384
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 384
6 #
7 # test to reproduce PV951636:
8 #   project quotas not updated if a file is mv'd into that directory
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
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21 . ./common/quota
22
23 _cleanup()
24 {
25         cd /
26         _scratch_unmount 2>/dev/null
27         rm -f $tmp.*
28 }
29 trap "_cleanup; exit \$status" 0 1 2 3 15
30
31 # real QA test starts here
32 _supported_fs generic
33
34 _require_test
35 _require_quota
36 _require_xfs_quota_foreign
37 _require_xfs_io_command "chproj"
38
39 # we can't run with group quotas (on v4 xfs); the mount options for group
40 # quotas will be filtered out by _qmount_option below.
41
42 dir=$SCRATCH_MNT/project
43
44 #project quota files
45 cat >$tmp.projects <<EOF
46 1:$dir
47 EOF
48
49 cat >$tmp.projid <<EOF
50 test:1
51 EOF
52
53 cp /dev/null $seqres.full
54 chmod a+rwx $seqres.full        # arbitrary users will write here
55
56 _require_scratch
57 _scratch_mkfs >/dev/null 2>&1
58 _scratch_enable_pquota
59
60 _qmount_option "prjquota"
61 _qmount
62 _require_prjquota $SCRATCH_DEV
63
64 report_quota()
65 {
66     $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
67                     -c "repquota -inN -p" $SCRATCH_DEV | \
68                     tr -s '[:space:]' | _filter_project_quota
69 }
70
71 mkdir $dir
72 $XFS_IO_PROG -r -c "chproj -R 1" -c "chattr -R +P" $dir
73
74 $XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid -x \
75     -c "limit -p bsoft=100m bhard=100m 1" $SCRATCH_DEV
76 report_quota
77
78 touch $dir/1
79 touch $dir/2
80 cp $dir/2 $dir/3
81 report_quota
82
83 xfs_mkfile 1M $TEST_DIR/6
84
85 #try cp to dir
86 cp $TEST_DIR/6 $dir/6
87 report_quota
88
89 #try mv to dir
90 mv $TEST_DIR/6 $dir/7
91 report_quota
92
93 # success, all done
94 status=0
95 exit