930a983f7157f0c73f3c12dc2986ec615bd81ab1
[xfstests-dev.git] / tests / xfs / 072
1 #! /bin/bash
2 # FS QA Test No. 072
3 #
4 # Check some unwritten extent boundary conditions
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  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 echo "QA output created by $seq"
27
28 _cleanup()
29 {
30         cd /
31         rm -f $tmp.*
32         umount $SCRATCH_MNT 2>/dev/null
33 }
34
35 here=`pwd`
36 tmp=/tmp/$$
37 status=1        # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
39
40 # get standard environment, filters and checks
41 . ./common.rc
42 . ./common.filter
43
44 # real QA test starts here
45 _supported_fs xfs
46 _supported_os IRIX Linux
47
48 [ -n "$XFS_IO_PROG" ] || _notrun "xfs_io executable not found"
49
50 _require_scratch
51
52 rm -f $seq.full
53 umount $SCRATCH_DEV >/dev/null 2>&1
54
55 _scratch_mkfs_xfs >/dev/null    || _fail "mkfs failed"
56 _scratch_mount >/dev/null       || _fail "mount failed"
57
58 # check there's enough freespace on $SCRATCH_MNT ... (1GiB + 1MiB)
59 avail=`df -P $SCRATCH_MNT | awk 'END {print $4}'`
60 [ "$avail" -ge 1049600 ] || _notrun "Scratch device is too small ($avail KiB)"
61
62 echo Silence is golden
63
64 # reserve 1GiB, truncate at 100bytes
65 $XFS_IO_PROG -f -c 'resvsp 0 1g' -c 'truncate 100' $SCRATCH_MNT/ouch
66 rm -f $SCRATCH_MNT/ouch
67
68 # reserve 1GiB, truncate at 1GiB
69 $XFS_IO_PROG -f -c 'resvsp 0 1g' -c 'truncate 1g' $SCRATCH_MNT/ouch
70 rm -f $SCRATCH_MNT/ouch
71
72 # reserve 1GiB, truncate at 2GiB
73 $XFS_IO_PROG -f -c 'resvsp 0 1g' -c 'truncate 2g' $SCRATCH_MNT/ouch
74 rm -f $SCRATCH_MNT/ouch
75
76 # reserve 1GiB, 1GiB hole, reserve 1MiB, truncate at 3GiB
77 $XFS_IO_PROG -f -c 'resvsp 0 1g' -c 'resvsp 2g 1m' -c 'truncate 3g' $SCRATCH_MNT/ouch
78 rm -f $SCRATCH_MNT/ouch
79
80 # success, all done
81 status=0
82 exit