xfstests: remove stale machine configs
[xfstests-dev.git] / 234
1 #! /bin/bash
2 # FS QA Test No. 234
3 #
4 # Stress setquota and setinfo handling.
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2010 Jan Kara.  All Rights Reserved.
8 #
9 # Based on test 219,
10 # Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
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 #
27
28 seq=`basename $0`
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39 . ./common.quota
40
41 test_setting()
42 {
43         echo; echo "### test limits and info setting"
44         count=2000
45         procs=5
46         idmod=200000
47         seed=$RANDOM
48         RANDOM=$seed
49         echo "Starting test with procs=$procs, idmod=$idmod, and seed=$seed" >>$seq.full
50
51         for (( i = 0; i < $procs; i++ )); do
52                 ( SETUCOUNT=1; SETGCOUNT=1; SETUIDS[0]=0; SETGIDS[0]=0
53                 for (( j = 0; j < $count; j++ )); do
54                         OP=$(($RANDOM%22))
55                         UG=$(($OP%2))
56                         OP=$(($OP/2))
57                         if [ $UG -eq 1 ]; then
58                                 type='u'
59                         else
60                                 type='g'
61                         fi
62                         if [ $OP -eq 10 ]; then
63                                 setquota -t -$type $j $j $SCRATCH_MNT
64                         elif [ $OP -lt 5 ]; then
65                                 ID=$((($RANDOM*32768+$RANDOM)%$idmod))
66                                 if [ $UG -eq 1 ]; then
67                                         SETUIDS[$SETUCOUNT]=$ID
68                                         SETUCOUNT=$(($SETUCOUNT+1))
69                                 else
70                                         SETGIDS[$SETGCOUNT]=$ID
71                                         SETGCOUNT=$(($SETGCOUNT+1))
72                                 fi
73                                 setquota -$type $ID $j $j $j $j $SCRATCH_MNT
74                         else
75                                 if [ $UG -eq 1 ]; then
76                                         ID=${SETUIDS[$(($RANDOM%$SETUCOUNT))]}
77                                 else
78                                         ID=${SETGIDS[$(($RANDOM%$SETGCOUNT))]}
79                                 fi
80                                 setquota -$type $ID 0 0 0 0 $SCRATCH_MNT
81                         fi
82                 done )&
83         done
84         wait
85         echo "### done with testing"
86 }
87
88 # real QA test starts here
89 _supported_fs generic
90 _supported_os Linux #IRIX
91 _require_scratch
92 _require_quota
93 _need_to_be_root
94
95 # real QA test starts here
96 rm -f $seq.full
97
98 _scratch_mkfs >> $seq.full 2>&1
99 _scratch_mount "-o usrquota,grpquota"
100 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
101 quotaon -u -g $SCRATCH_MNT 2>/dev/null
102 test_setting
103 umount $SCRATCH_DEV
104
105 status=0
106 exit