xfstests: make install support common/ and tests/ dirs
[xfstests-dev.git] / tests / generic / 083
1 #! /bin/bash
2 # FS QA Test No. 083
3 #
4 # Exercise filesystem full behaviour - run numerous fsstress
5 # processes in write mode on a small filesystem.  NB: delayed
6 # allocate flushing is quite deadlock prone at the filesystem
7 # full boundary due to the fact that we will retry allocation
8 # several times after flushing, before giving back ENOSPC.
9 #
10 # Note that this test will intentionally cause console msgs of form:
11 #     dksc0d1s4: Process [fsstress] ran out of disk space
12 #     dksc0d1s4: Process [fsstress] ran out of disk space
13 #     dksc0d1s4: Process [fsstress] ran out of disk space
14 #
15 #-----------------------------------------------------------------------
16 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
17 #
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License as
20 # published by the Free Software Foundation.
21 #
22 # This program is distributed in the hope that it would be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 # GNU General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write the Free Software Foundation,
29 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30 #
31 #-----------------------------------------------------------------------
32 #
33
34 seq=`basename $0`
35 seqres=$RESULT_DIR/$seq
36 echo "QA output created by $seq"
37
38 here=`pwd`
39 tmp=/tmp/$$
40 status=1
41
42 _cleanup()
43 {
44         echo "*** unmount"
45         umount $SCRATCH_MNT 2>/dev/null
46         rm -f $tmp.*
47 }
48 trap "_cleanup; exit \$status" 0 1 2 3 15
49
50 # get standard environment, filters and checks
51 . ./common/rc
52 . ./common/filter
53
54 # real QA test starts here
55 _supported_fs generic
56 _supported_os IRIX Linux
57
58 _require_scratch
59 _require_no_large_scratch_dev
60
61 rm -f $seqres.full
62
63 workout()
64 {
65         fsz=$1
66         ags=$2
67         procs=$3
68         nops=$4
69
70         umount $SCRATCH_DEV >/dev/null 2>&1
71         echo "*** mkfs -dsize=$fsz,agcount=$ags"    >>$seqres.full
72         echo ""                                     >>$seqres.full
73         if [ $FSTYP = xfs ]
74         then
75                 _scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seqres.full 2>&1 \
76                         || _fail "size=$fsz,agcount=$ags mkfs failed"
77         else
78                 _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
79                         || _fail "size=$fsz mkfs failed"
80         fi
81         _scratch_mount                              >>$seqres.full 2>&1 \
82                 || _fail "mount failed"
83
84         # -w ensures that the only ops are ones which cause write I/O
85         FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs -n $nops $FSSTRESS_AVOID`
86         $FSSTRESS_PROG $FSSTRESS_ARGS >>$seqres.full
87         _check_scratch_fs
88 }
89
90 echo "*** test out-of-space handling for random write operations"
91
92 filesize=`expr 100 \* 1024 \* 1024`
93 agcount=6
94 numprocs=15
95 numops=1500
96
97 workout $filesize $agcount $numprocs $numops
98
99 echo "*** done"
100 status=0
101 exit