generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
12 _begin_fstest auto quota stress
13
14 # Import common functions.
15 . ./common/filter
16 . ./common/quota
17
18 _filter_num()
19 {
20         tee -a $seqres.full |\
21         sed -e 's/[0-9][0-9]* inodes/I inodes/g' \
22             -e 's/[0-9][0-9]* paths/P paths/g' \
23             -e 's/seed = [0-9][0-9]*/seed = S/'
24 }
25
26 _fsstress()
27 {
28         echo ""
29         echo "Testing fsstress"
30         echo ""
31
32         out=$SCRATCH_MNT/fsstress.$$
33         count=5000
34         args=`_scale_fsstress_args -z \
35 -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 \
36 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
37 -n $count -d $out -p 7`
38
39         # io_uring accounts memory it needs under the rlimit memlocked option,
40         # which can be quite low on some setups (especially 64K pagesize). root
41         # isn't under this restriction, but regular users are. To avoid the
42         # io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
43         # temporarily.
44         ulimit -l unlimited
45         echo "fsstress $args" >> $seqres.full
46         if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $seqres.full | _filter_num
47         then
48                 echo "    fsstress $args returned $?"
49                 cat $tmp.out | tee -a $seqres.full
50                 status=1
51         fi
52 }
53
54 # real QA test starts here
55 _supported_fs generic
56 _require_scratch
57 _require_quota
58 _require_user
59
60 _scratch_mkfs > $seqres.full 2>&1
61 _scratch_mount "-o usrquota,grpquota"
62 chmod 777 $SCRATCH_MNT
63 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
64 quotaon -u -g $SCRATCH_MNT 2>/dev/null
65 setquota -u $qa_user 32000 32000 1000 1000 $SCRATCH_MNT 2>/dev/null
66
67 _fsstress
68 _check_quota_usage
69 _scratch_unmount
70 status=0
71 exit