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