xfstests: 219: fix awk filter for duplicate users
[xfstests-dev.git] / 196
1 #! /bin/bash
2 # FS QA Test No. 196
3 #
4 # Make sure renames accross project boundaries are properly rejected
5 # and that we don't use the wrong lock flags internally.
6 #
7 # Based on a report and testcase from Arkadiusz Miskiewicz <arekm@maven.pl>
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2008 Christoph Hellwig.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #-----------------------------------------------------------------------
25 #
26 # creator
27 owner=hch@lst.de
28
29 seq=`basename $0`
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35
36 _cleanup()
37 {
38         cd /
39         umount $SCRATCH_MNT
40         rm -f $tmp.*
41 }
42 trap "_cleanup; exit \$status" 0 1 2 3 15
43
44 # get standard environment, filters and checks
45 . ./common.rc
46 . ./common.filter
47 . ./common.quota
48
49 # real QA test starts here
50 _supported_fs xfs
51 _supported_os Linux
52
53 _require_scratch
54 _require_xfs_quota
55
56 #
57 # Setup temporary replacements for /etc/projects and /etc/projid
58 #
59 cat >$tmp.projects <<EOF
60 42:$SCRATCH_MNT/t
61 EOF
62
63 cat >$tmp.projid <<EOF
64 answer:42
65 EOF
66
67 #
68 # And make sure we always use our replacements
69 #
70 quota_cmd="xfs_quota -D $tmp.projects -P $tmp.projid"
71
72 _scratch_mkfs_xfs >/dev/null 2>&1
73 _qmount_option "pquota"
74 _qmount
75
76 #
77 # Create the project root
78 #
79 mkdir $SCRATCH_MNT/t
80
81 $quota_cmd -x -c 'project -s answer' $SCRATCH_MNT >/dev/null 2>&1
82 $quota_cmd -x -c 'limit -p bhard=100m answer' $SCRATCH_MNT
83
84 touch $SCRATCH_MNT/test
85
86 #
87 # Try renaming a file into the project.  This should fail.
88 #
89 # We repeat this a couple thousand times as a single rename couldn't
90 # always trigger the wrong unlock flags bug we had in older kernels.
91 #
92 for i in `seq 1 2000`; do
93     src/rename test t/test
94 done
95
96 # success, all done
97 echo "*** done"
98 rm -f $seq.full
99 status=0