generic: convert tests to SPDX license tags
[xfstests-dev.git] / tests / generic / 233
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 233
6 #
7 # Run fsstress with quotas enabled and limits set low and verify accounted
8 # quotas in the end
9 #
10 # Derived from test 231
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19
20 # get standard environment, filters and checks
21 . ./common/rc
22 . ./common/filter
23 . ./common/quota
24
25 _filter_num()
26 {
27         tee -a $seqres.full |\
28         sed -e 's/[0-9][0-9]* inodes/I inodes/g' \
29             -e 's/[0-9][0-9]* paths/P paths/g' \
30             -e 's/seed = [0-9][0-9]*/seed = S/'
31 }
32
33 _fsstress()
34 {
35         echo ""
36         echo "Testing fsstress"
37         echo ""
38
39         out=$SCRATCH_MNT/fsstress.$$
40         count=5000
41         args=`_scale_fsstress_args -z \
42 -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 \
43 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
44 -n $count -d $out -p 7`
45
46         echo "fsstress $args" >> $seqres.full
47         if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $seqres.full | _filter_num
48         then
49                 echo "    fsstress $args returned $?"
50                 cat $tmp.out | tee -a $seqres.full
51                 status=1
52         fi
53 }
54
55 # real QA test starts here
56 _supported_fs generic
57 _supported_os Linux
58 _require_scratch
59 _require_quota
60 _require_user
61
62 _scratch_mkfs > $seqres.full 2>&1
63 _scratch_mount "-o usrquota,grpquota"
64 chmod 777 $SCRATCH_MNT
65 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
66 quotaon -u -g $SCRATCH_MNT 2>/dev/null
67 setquota -u $qa_user 32000 32000 1000 1000 $SCRATCH_MNT 2>/dev/null
68
69 _fsstress
70 _check_quota_usage
71 _scratch_unmount
72 status=0
73 exit