xfstests: convert tests to use new results directory
[xfstests-dev.git] / tests / ext4 / 302
1 #! /bin/bash
2 # FSQA Test No. 302
3 #
4 # Ext4 defragmentation stress test
5 # Perform defragmentation on file under buffered io
6 # while third task does direct io to donor file
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 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
36
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
40 . ./common.defrag
41
42 # real QA test starts here
43 _supported_os Linux
44 _supported_fs ext4
45 _need_to_be_root
46 _require_scratch
47 _require_defrag
48
49 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
50 # We need space for 2 files (test file, and donor one)
51 # reserve 30% in order to avoid ENOSPC
52 FILE_SIZE=$((BLK_DEV_SIZE * (512 / (2 + 1))))
53
54 cat >$tmp-$seq.fio <<EOF
55 # Common e4defrag regression tests
56 [global]
57 ioengine=ioe_e4defrag
58 iodepth=1
59 directory=${SCRATCH_MNT}
60 filesize=${FILE_SIZE}
61 size=999G
62 buffered=0
63 fadvise_hint=0
64 group_reporting
65
66 ##########################################
67 # Test2
68 # Perform defragmentation on file under buffered io
69 # while third task does direct io to donor file
70 #
71 # Continuous sequential defrag activity
72 [defrag-4k]
73 stonewall
74 ioengine=e4defrag
75 iodepth=1
76 bs=128k
77 donorname=test2.def
78 filename=test2
79 inplace=0
80 rw=write
81 numjobs=${LOAD_FACTOR}
82 runtime=30*${TIME_FACTOR}
83 time_based
84
85 # Run DIO/AIO for donor file
86 [donor-file-fuzzer]
87 ioengine=libaio
88 iodepth=128*${LOAD_FACTOR}
89 numjobs=${LOAD_FACTOR}
90 verify=0
91 direct=1
92 bs=64k
93 rw=randwrite
94 filename=test2.def
95 runtime=30*${TIME_FACTOR}
96 time_based
97
98 # Verifier thread
99 [aio-dio-verifier]
100 ioengine=libaio
101 iodepth=128*${LOAD_FACTOR}
102 numjobs=1
103 verify=crc32c-intel
104 verify_fatal=1
105 verify_dump=1
106 verify_backlog=1024
107 verify_async=1
108 verifysort=1
109 buffered=1
110 bs=64k
111 rw=randrw
112 filename=test2
113 runtime=30*${TIME_FACTOR}
114 time_based
115
116 EOF
117
118 _workout()
119 {
120         echo ""
121         echo " Start defragment activity"
122         echo ""
123         cat $tmp-$seq.fio >>  $seqres.full
124         run_check $FIO_PROG $tmp-$seq.fio
125 }
126
127 _require_fio $tmp-$seq.fio
128
129 _scratch_mkfs  >> $seqres.full 2>&1
130 _scratch_mount
131
132 if ! _workout; then
133         umount $SCRATCH_DEV 2>/dev/null
134         exit
135 fi
136
137 if ! _scratch_unmount; then
138         echo "failed to umount"
139         status=1
140         exit
141 fi
142 _check_scratch_fs
143 status=$?
144 exit