generic/402: Drop useless fail message
[xfstests-dev.git] / tests / generic / 385
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2008 Christoph Hellwig.
4 #
5 # FS QA Test No. 385
6 #
7 # Make sure renames accross project boundaries are properly rejected
8 # and that we don't use the wrong lock flags internally.
9 #
10 # Based on a report and testcase from Arkadiusz Miskiewicz <arekm@maven.pl>
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19
20 _cleanup()
21 {
22         cd /
23         _scratch_unmount
24         rm -f $tmp.*
25 }
26 trap "_cleanup; exit \$status" 0 1 2 3 15
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/quota
32
33 # real QA test starts here
34 _supported_fs generic
35
36 _require_scratch
37 _require_quota
38 _require_xfs_quota_foreign
39
40 #
41 # Setup temporary replacements for /etc/projects and /etc/projid
42 #
43 cat >$tmp.projects <<EOF
44 42:$SCRATCH_MNT/t
45 EOF
46
47 cat >$tmp.projid <<EOF
48 answer:42
49 EOF
50
51 #
52 # And make sure we always use our replacements
53 #
54 quota_cmd="$XFS_QUOTA_PROG -D $tmp.projects -P $tmp.projid"
55
56 _scratch_mkfs >/dev/null 2>&1
57 _scratch_enable_pquota
58 _qmount_option "prjquota"
59 _qmount
60 _require_prjquota $SCRATCH_DEV
61
62 #
63 # Create the project root
64 #
65 mkdir $SCRATCH_MNT/t
66
67 $quota_cmd -x -c 'project -s answer' $SCRATCH_MNT >/dev/null 2>&1
68 $quota_cmd -x -c 'limit -p bhard=100m answer' $SCRATCH_MNT
69
70 touch $SCRATCH_MNT/test
71
72 #
73 # Try renaming a file into the project.  This should fail.
74 #
75 # We repeat this a couple thousand times as a single rename couldn't
76 # always trigger the wrong unlock flags bug we had in older kernels.
77 #
78 for i in `seq 1 2000`; do
79     $here/src/rename test t/test
80 done
81
82 # success, all done
83 echo "*** done"
84 rm -f $seqres.full
85 status=0