xfstests: move xfs specific tests out of top directory
[xfstests-dev.git] / 303
1 #! /bin/bash
2 # FSQA Test No. 303
3 #
4 # Ext4 defragmentation stress test
5 # Two defrag tasks use common donor file
6 #
7 #-----------------------------------------------------------------------
8 # (c) 2013 Dmitry Monakhov
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.defrag
38
39 # real QA test starts here
40 _supported_os Linux
41 _supported_fs ext4
42 _need_to_be_root
43 _require_scratch
44 _require_defrag
45
46 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
47 # We need space for 3 files (one donor file and two test files)
48 # Reserve space for 4 files in order to avoid ENOSPC
49 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (3+1))))
50
51 cat >$tmp-$seq.fio <<EOF
52 # Common e4defrag regression tests
53 [global]
54 ioengine=ioe_e4defrag
55 iodepth=1
56 directory=${SCRATCH_MNT}
57 filesize=${FILE_SIZE}
58 size=999G
59 buffered=0
60 fadvise_hint=0
61 group_reporting
62
63 #################################
64 # Test3
65 # Two defrag tasks use common donor file
66 [defrag-1]
67 ioengine=e4defrag
68 iodepth=1
69 bs=128k
70 donorname=test3.def
71 filename=test31
72 inplace=0
73 rw=write
74 numjobs=${LOAD_FACTOR}
75 runtime=30*${TIME_FACTOR}
76 time_based
77
78 [defrag-2]
79 ioengine=e4defrag
80 iodepth=1
81 bs=128k
82 donorname=test3.def
83 filename=test32
84 inplace=0
85 rw=write
86 numjobs=${LOAD_FACTOR}
87 runtime=30*${TIME_FACTOR}
88 time_based
89
90 [aio-dio-verifier-1]
91 ioengine=libaio
92 iodepth=128*${LOAD_FACTOR}
93 numjobs=1
94 verify=crc32c-intel
95 verify_fatal=1
96 verify_dump=1
97 verify_backlog=1024
98 verify_async=1
99 verifysort=1
100 direct=1
101 bs=64k
102 rw=write
103 filename=test31
104 runtime=30*${TIME_FACTOR}
105 time_based
106
107 [aio-buffer-verifier-2]
108 ioengine=libaio
109 numjobs=1
110 verify=crc32c-intel
111 verify_fatal=1
112 verify_dump=1
113 verify_backlog=1024
114 verify_async=1
115 verifysort=1
116 buffered=1
117 bs=64k
118 rw=randrw
119 filename=test32
120 runtime=30*${TIME_FACTOR}
121 time_based
122
123 EOF
124
125 _workout()
126 {
127         echo ""
128         echo " Start defragment activity"
129         echo ""
130         cat $tmp-$seq.fio >>  $seq.full
131         run_check $FIO_PROG $tmp-$seq.fio
132 }
133
134 _require_fio $tmp-$seq.fio
135
136 _scratch_mkfs  >> $seq.full 2>&1
137 _scratch_mount
138
139 if ! _workout; then
140         umount $SCRATCH_DEV 2>/dev/null
141         exit
142 fi
143
144 if ! _scratch_unmount; then
145         echo "failed to umount"
146         status=1
147         exit
148 fi
149 _check_scratch_fs
150 status=$?
151 exit