fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 231
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. 231
6 #
7 # Run fsx with quotas enabled and verify accounted quotas in the end
8 #
9 # Derived from test 127
10 . ./common/preamble
11 _begin_fstest auto quota
12
13 # Import common functions.
14 . ./common/filter
15 . ./common/quota
16
17 FSX_FILE_SIZE=64000000
18 FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -N 20000"
19
20 _fsx()
21 {
22         tasks=$1
23         echo "=== FSX Standard Mode, Memory Mapping, $tasks Tasks ==="
24         for (( i = 1; i <= $tasks; i++ )); do
25                 SEED=$RANDOM
26                 echo "ltp/fsx $FSX_ARGS -S $SEED $SCRATCH_MNT/fsx_file$i" >>$seqres.full
27                 su $qa_user -c "ltp/fsx $FSX_ARGS -S $SEED \
28                         $FSX_AVOID $SCRATCH_MNT/fsx_file$i" >$tmp.output$i 2>&1 &
29         done
30
31         for (( i = 1; i <= $tasks; i++ )); do
32                 if ! wait %$i; then
33                         cat $tmp.output$i | tee -a $seqres.full
34                         wait
35                         return 1
36                 fi
37                 $XFS_IO_PROG -c 'fsync' $SCRATCH_MNT/fsx_file$i
38                 cat $tmp.output$i | tee -a $seqres.full
39         done
40         return 0
41 }
42
43 # real QA test starts here
44 _supported_fs generic
45 _require_scratch
46 _require_quota
47 _require_user
48
49 _scratch_mkfs >> $seqres.full 2>&1
50 _scratch_mount "-o usrquota,grpquota"
51 chmod 777 $SCRATCH_MNT
52 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
53 quotaon -u -g $SCRATCH_MNT 2>/dev/null
54
55 if ! _fsx 1; then
56         _scratch_unmount 2>/dev/null
57         status=1
58         exit
59 fi
60
61 if ! _check_quota_usage; then
62         _scratch_unmount 2>/dev/null
63         status=1
64         exit
65 fi
66
67 if ! _fsx 4; then
68         _scratch_unmount 2>/dev/null
69         status=1
70         exit
71 fi
72
73 if ! _check_quota_usage; then
74         _scratch_unmount 2>/dev/null
75         status=1
76         exit
77 fi
78
79 #flush cache after write
80 FSX_ARGS="-f $FSX_ARGS"
81 if ! _fsx 1; then
82         _scratch_unmount 2>/dev/null
83         status=1
84         exit
85 fi
86
87 if ! _check_quota_usage; then
88         _scratch_unmount 2>/dev/null
89         status=1
90         exit
91 fi
92
93 _scratch_unmount 2>/dev/null
94 status=0
95 exit