spilt acl kernel and user headers apart - no point keeping in sync.
[xfstests-dev.git] / 015
1 #! /bin/sh
2 # XFS QA Test No. 015
3 # $Id: 1.1 $
4 #
5 # check out-of-space behaviour
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
9
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 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, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like.  Any license provided herein, whether implied or
21 # otherwise, applies only to this software file.  Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
24
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
28
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA  94043, or:
31
32 # http://www.sgi.com 
33
34 # For further information regarding this notice, see: 
35
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
38 #
39 # creator
40 owner=dxm@sgi.com
41
42 seq=`basename $0`
43 echo "QA output created by $seq"
44
45 here=`pwd`
46 tmp=/tmp/$$
47 status=1        # success is the default!
48
49 # get standard environment, filters and checks
50 . ./common.rc
51 . ./common.filter
52
53 _cleanup()
54 {
55         umount $SCRATCH_MNT
56 }
57
58 trap "_cleanup; exit \$status" 0 1 2 3 15
59
60 _free()
61 {
62     _df_dir $SCRATCH_MNT | $AWK_PROG '{ print $5 }'
63 }
64
65 _filter_dd()
66 {
67     $AWK_PROG '
68         /records in/                { next }
69         /records out/               { next }
70         /No space left on device/   { print "   !!! disk full (expected)" 
71                                       next }
72                                     { print "   *** " $0 }
73     '
74 }
75
76 # real QA test starts here
77 _require_scratch
78
79 mkfs -t xfs -f -d size=50m $SCRATCH_DEV >/dev/null
80 mount -t xfs $SCRATCH_DEV $SCRATCH_MNT
81 out=$SCRATCH_MNT/fillup.$$
82 rm -f $seq.full
83
84 free0=`_free`
85 if [ -z "$free0" ]
86 then
87     echo "   *** failed to get free space (0)"
88     exit 1
89 fi
90 echo "free space at start $free0" >> $seq.full
91
92 echo "fill disk:"       # well, filesystem really - not disk
93
94 dd if=/dev/zero of=$out bs=1024k 2>&1 | _filter_dd
95
96 echo "check free space:"
97
98 free1=`_free`
99 if [ -z "$free1" ]
100 then
101     echo "   *** failed to get free space (1)"
102     exit 1
103 fi
104 echo "free space after fill $free1" >> $seq.full
105
106 if [ ! -e $out ]
107 then
108     echo "   *** file not created"
109     exit 1
110 fi
111
112 if [ ! -s $out ]
113 then
114     echo "   *** file created with zero length"
115     ls -l $out
116     exit 1
117 fi
118
119 echo "delete fill:"
120
121 if ! rm $out
122 then
123     echo "   *** file not deleted"
124     exit 1
125 fi
126
127 if [ -e $out ]
128 then
129     echo "   *** file still exists"
130     ls -l $out
131     exit 1
132 fi
133
134 echo "check free space:"
135
136 free2=`_free`
137 if [ -z "$free2" ]
138 then
139     echo "   *** failed to get free space (2)"
140     exit 1
141 fi
142 echo "free space after delete $free2" >> $seq.full
143
144 echo -n "   !!! "
145 _within_tolerance "free space" $free2 $free0 1% -v
146
147 status=0
148 exit