xfstests: introduce a common directory
[xfstests-dev.git] / tests / generic / 223
1 #! /bin/bash
2 # FS QA Test No. 223
3 #
4 # File alignment tests
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2010 Eric Sandeen.  All Rights Reserved.
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 seqres=$RESULT_DIR/$seq
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34
35 _cleanup()
36 {
37     rm -f $tmp.*
38 }
39
40 trap "_cleanup ; exit \$status" 0 1 2 3 15
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 # real QA test starts here
47 _supported_fs generic
48 _supported_os Linux
49
50 _require_scratch
51 _require_xfs_io_falloc
52
53 rm -f $seqres.full
54
55 BLOCKSIZE=4096
56
57 for SUNIT_K in 8 16 32 64 128; do
58         let SUNIT_BYTES=$SUNIT_K*1024
59         let SUNIT_BLOCKS=$SUNIT_BYTES/$BLOCKSIZE
60
61         echo "=== mkfs with su $SUNIT_BLOCKS blocks x 4 ==="
62         export MKFS_OPTIONS=""
63         _scratch_mkfs_geom $SUNIT_BYTES 4 $BLOCKSIZE >> $seqres.full 2>&1
64         _scratch_mount
65
66         for SIZE_MULT in 1 2 8 64 256; do
67                 let SIZE=$SIZE_MULT*$SUNIT_BYTES
68
69                 echo "=== Testing size ${SIZE_MULT}*${SUNIT_K}k on ${SUNIT_K}k stripe ==="
70                 for FILE in 1 2 3 4; do
71                         xfs_io -F -f -c "falloc 0 $SIZE" \
72                                 $SCRATCH_MNT/file-$FILE-$SIZE-falloc \
73                                         >> $seqres.full 2>&1
74                         xfs_io -F -f -c "pwrite 0 $SIZE" \
75                                 $SCRATCH_MNT/file-$FILE-$SIZE-write \
76                                         >> $seqres.full 2>&1
77                         src/t_stripealign $SCRATCH_MNT/file-$FILE-$SIZE-falloc \
78                                 $SUNIT_BLOCKS | _filter_scratch
79                         src/t_stripealign $SCRATCH_MNT/file-$FILE-$SIZE-write \
80                                 $SUNIT_BLOCKS | _filter_scratch
81                 done
82         done
83
84         echo "=== Testing size 1g falloc on ${SUNIT_K}k stripe ==="
85         xfs_io -F -f -c "falloc 0 1g" \
86             $SCRATCH_MNT/file-1g-falloc >> $seqres.full 2>&1
87         src/t_stripealign $SCRATCH_MNT/file-1g-falloc $SUNIT_BLOCKS \
88             | _filter_scratch
89
90         rm -f $SCRATCH_MNT/file-1g-falloc | _filter_scratch
91
92         echo "=== Testing size 1073745920 falloc on ${SUNIT_K}k stripe ==="
93         xfs_io -F -f -c "falloc 0 1073745920" \
94                 $SCRATCH_MNT/file-1073745920-falloc >> $seqres.full 2>&1
95         src/t_stripealign $SCRATCH_MNT/file-1073745920-falloc \
96                 $SUNIT_BLOCKS | _filter_scratch
97
98         _scratch_unmount
99 done
100
101 status=0
102 exit