xfstests: introduce a common directory
[xfstests-dev.git] / tests / xfs / 259
1 #! /bin/bash
2 # FS QA Test No. 259
3 #
4 # Test fs creation on 4 TB minus few bytes partition
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2011 Red Hat.  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 status=1        # failure is the default!
32
33 _cleanup()
34 {
35     rm -f "$testfile"
36 }
37
38 trap "_cleanup ; exit \$status" 0 1 2 3 15
39
40 # get standard environment, filters and checks
41 . ./common/rc
42
43 # real QA test starts here
44 _supported_fs xfs
45 _supported_os Linux
46
47 _require_math
48
49 testfile=$TEST_DIR/259.image
50
51 # Test various sizes slightly less than 4 TB
52 four_TB=$(_math "2^42")
53 for del in 1 512 1024 1025 2048 4096; do
54         ddseek=$(_math "$four_TB - $del")
55         echo "Trying to make (4 TB - $del) B long xfs fs image"
56         rm -f "$testfile"
57         dd if=/dev/zero "of=$testfile" bs=1 count=0 seek=$ddseek \
58                                         >/dev/null 2>&1 || echo "dd failed"
59         lofile=$(losetup -f)
60         losetup $lofile "$testfile"
61         "$MKFS_XFS_PROG" -b size=512 $lofile >/dev/null || echo "mkfs failed!"
62         sync
63         losetup -d $lofile
64 done
65
66 status=0
67
68 exit