xfstests: remove 285.full and 286.full
[xfstests-dev.git] / 015
1 #! /bin/bash
2 # FS QA Test No. 015
3 #
4 # check out-of-space behaviour
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 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 here=`pwd`
29 tmp=/tmp/$$
30 status=1        # success is the default!
31
32 # get standard environment, filters and checks
33 . ./common.rc
34 . ./common.filter
35
36 _cleanup()
37 {
38         umount $SCRATCH_MNT
39 }
40
41 trap "_cleanup; exit \$status" 0 1 2 3 15
42
43 _free()
44 {
45     _df_dir $SCRATCH_MNT | $AWK_PROG '{ print $5 }'
46 }
47
48 # real QA test starts here
49 _supported_fs generic
50 _supported_os IRIX Linux
51
52 _require_scratch
53 _require_no_large_scratch_dev
54
55 _scratch_mkfs_sized `expr 50 \* 1024 \* 1024` >/dev/null 2>&1 \
56     || _fail "mkfs failed"
57 _scratch_mount || _fail "mount failed"
58 out=$SCRATCH_MNT/fillup.$$
59 rm -f $seq.full
60
61 free0=`_free`
62 if [ -z "$free0" ]
63 then
64     echo "   *** failed to get free space (0)"
65     exit 1
66 fi
67 echo "free space at start $free0" >> $seq.full
68
69 echo "fill disk:"       # well, filesystem really - not disk
70
71 POSIXLY_CORRECT=yes dd if=/dev/zero of=$out bs=1024k 2>&1 | _filter_dd
72
73 echo "check free space:"
74
75 free1=`_free`
76 if [ -z "$free1" ]
77 then
78     echo "   *** failed to get free space (1)"
79     exit 1
80 fi
81 echo "free space after fill $free1" >> $seq.full
82
83 if [ ! -e $out ]
84 then
85     echo "   *** file not created"
86     exit 1
87 fi
88
89 if [ ! -s $out ]
90 then
91     echo "   *** file created with zero length"
92     ls -l $out
93     exit 1
94 fi
95
96 echo "delete fill:"
97
98 if ! rm $out
99 then
100     echo "   *** file not deleted"
101     exit 1
102 fi
103
104 if [ -e $out ]
105 then
106     echo "   *** file still exists"
107     ls -l $out
108     exit 1
109 fi
110
111 echo "check free space:"
112
113 free2=`_free`
114 if [ -z "$free2" ]
115 then
116     echo "   *** failed to get free space (2)"
117     exit 1
118 fi
119 echo "free space after delete $free2" >> $seq.full
120
121 echo -n "   !!! "
122 _within_tolerance "free space" $free2 $free0 1% -v
123
124 status=0
125 exit