xfstests: remove 285.full and 286.full
[xfstests-dev.git] / 270
1 #! /bin/bash
2 # FSQA Test No. 270
3 #
4 # Run fsstress and ENSPC hitters in parallel, check quota and 
5 # fs consistency an the end
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 #-----------------------------------------------------------------------
24 #
25
26 seq=`basename $0`
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 status=1        # failure is the default!
32 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
33
34 # get standard environment, filters and checks
35 . ./common.rc
36 . ./common.filter
37 . ./common.quota
38
39 # Disable all sync operations to get higher load
40 FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
41 _workout()
42 {
43         echo ""
44         echo "Run fsstress"
45         echo ""
46         num_iterations=10
47         enospc_time=2
48         out=$SCRATCH_MNT/fsstress.$$
49         args=`_scale_fsstress_args -p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out`
50         echo "fsstress $args" >> $here/$seq.full
51         # Grant chown capability 
52         cp $FSSTRESS_PROG  $tmp.fsstress.bin
53         if [ "`whereis setcap`" == "setcap:" ]; then
54             _notrun "setcap not installed."
55         fi
56         setcap cap_chown=epi  $tmp.fsstress.bin
57
58         (su $qa_user -c "$tmp.fsstress.bin $args" &) > /dev/null 2>&1
59         pid=$!
60
61         echo "Run dd writers in parallel"
62         for ((i=0; i < num_iterations; i++))
63         do
64                 # File will be opened with O_TRUNC each time
65                 su $qa_user -c "dd if=/dev/zero \
66                         of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M " \
67                         >> $here/$seq.full 2>&1
68                 sleep $enospc_time
69         done
70
71         killall $tmp.fsstress.bin
72         wait $pid
73 }
74
75 # real QA test starts here
76 _supported_fs generic
77 _supported_os Linux
78 _require_quota
79 _require_user
80 _need_to_be_root
81 _require_scratch
82
83 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seq.full 2>&1
84 _scratch_mount "-o usrquota,grpquota"
85 chmod 777 $SCRATCH_MNT
86 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
87 quotaon -u -g $SCRATCH_MNT 2>/dev/null
88
89 if ! _workout; then
90         _scratch_unmount 2>/dev/null
91         exit
92 fi
93
94 if ! _check_quota_usage; then
95         _scratch_unmount 2>/dev/null
96         status=1
97         exit
98 fi
99
100 echo Comparing filesystem consistency
101 if ! _scratch_unmount; then
102         echo "failed to umount"
103         status=1
104         exit
105 fi
106 _check_scratch_fs
107 status=$?
108 exit