check we support quotas
[xfstests-dev.git] / 049
1 #! /bin/sh
2 # FS QA Test No. 049
3 #
4 # XFS on loop test
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 modify it
10 # under the terms of version 2 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, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightfullclaim of any third person regarding infringement
19 # or the like.  Any license provided herein, whether implied or
20 # otherwise, applies only to this software file.  Patent licenses, if
21 # any, provided herein do not apply to combinations of this program with
22 # other software, or any other product whatsoever.
23
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
27
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA  94043, or:
30
31 # http://www.sgi.com 
32
33 # For further information regarding this notice, see: 
34
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
37 #
38 # creator
39 owner=dxm@sgi.com
40
41 seq=`basename $0`
42 echo "QA output created by $seq"
43
44 _cleanup()
45 {
46     cd /
47     umount $SCRATCH_MNT/test2 > /dev/null 2>&1
48     umount $SCRATCH_MNT/test > /dev/null 2>&1
49     rm -f $tmp.*
50     
51     if [ -w $seq.full ]
52     then
53         echo "--- mounts at end (after cleanup)" >> $seq.full
54         mount >> $seq.full
55     fi
56 }
57
58 here=`pwd`
59 tmp=/tmp/$$
60 status=1        # failure is the default!
61 trap "_cleanup ; exit \$status" 0 1 2 3 15
62
63 # get standard environment, filters and checks
64 . ./common.rc
65 . ./common.filter
66
67 # real QA test starts here
68 _supported_fs xfs
69 _supported_os Linux
70
71 _log()
72 {
73     echo "--- $*"
74     echo "--- $*" >> $seq.full
75 }
76
77 _require_nobigloopfs
78 _require_nonexternal
79 _require_scratch
80 _require_loop
81
82 rm -f $seq.full
83
84 echo "(dev=$SCRATCH_DEV, mount=$SCRATCH_MNT)" >> $seq.full
85 echo "" >> $seq.full
86
87 echo "--- mounts" >> $seq.full
88 mount >> $seq.full
89
90 _log "Create ext2 fs on scratch"
91 mkfs -t ext2 $SCRATCH_DEV >> $seq.full 2>&1 \
92     || _fail "!!! failed to mkfs ext2"
93
94 _log "Mount ext2 fs on scratch"
95 mount -t ext2 $SCRATCH_DEV $SCRATCH_MNT >> $seq.full 2>&1 \
96     || _fail "!!! failed to mount"
97
98 _log "Create xfs fs in file on scratch"
99 /sbin/mkfs.xfs -f $MKFS_OPTIONS -dfile,name=$SCRATCH_MNT/test.xfs,size=40m \
100     >> $seq.full 2>&1 \
101     || _fail "!!! failed to mkfs xfs"
102
103 _log "Make mount points"
104 mkdir $SCRATCH_MNT/test $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
105     || _fail "!!! failed to make mount points"
106
107 _log "Mount xfs via loop"
108 mount -t xfs -o loop $SCRATCH_MNT/test.xfs $SCRATCH_MNT/test >> $seq.full 2>&1 \
109     || _fail "!!! failed to loop mount xfs"
110
111 _log "stress"
112 ltp/fsstress -d $SCRATCH_MNT/test -n 1000 $FSSTRESS_AVOID >> $seq.full 2>&1 \
113     || _fail "!!! stress failed"
114     
115 _log "clean"
116 rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
117     || _fail "!!! clean failed"
118
119 _log "create file for ext2 fs"
120 dd if=/dev/zero of=$SCRATCH_MNT/test/test.ext2 bs=1024 count=10240 >> $seq.full 2>&1 \
121     || _fail "!!! create file failed"
122     
123 _log "Create ext2 fs in file on looped xfs"
124 echo y | mkfs -t ext2 $SCRATCH_MNT/test/test.ext2 >> $seq.full 2>&1 \
125     || _fail "!!! failed to mkfs ext2 on xfs"
126
127 _log "Mount ext2 on xfs via loop"
128 mount -t ext2 -o loop $SCRATCH_MNT/test/test.ext2 $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
129     || _fail "!!! failed to loop mount xfs"
130
131 _log "stress ext2 on xfs via loop"
132 ltp/fsstress -d $SCRATCH_MNT/test2 -n 1000 $FSSTRESS_AVOID >> $seq.full 2>&1 \
133     || _fail "!!! stress ext2 failed"   
134
135 _log "clean"
136 rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
137     || _fail "!!! clean failed"
138    
139 _log "umount ext2 on xfs"
140 umount $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
141     || _fail "!!! umount ext2 failed"
142     
143 _log "umount xfs"
144 umount $SCRATCH_MNT/test >> $seq.full 2>&1 \
145     || _fail "!!! umount xfs failed"
146     
147 echo "--- mounts at end (before cleanup)" >> $seq.full
148 mount >> $seq.full
149
150 rm -f $seq.full
151 # success, all done
152 status=0
153 exit