Whoops, use a fixed 4k for alloc's "bsize" parameter, seems
[xfstests-dev.git] / 049
1 #! /bin/sh
2 # XFS QA Test No. 049
3 # $Id: 1.1 $
4 #
5 # XFS on loop test
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2002 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 rightfullclaim 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 _cleanup()
46 {
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 _log()
68 {
69     echo "--- $*"
70     echo "--- $*" >> $seq.full
71 }
72
73 # real QA test starts here
74
75 _require_scratch
76 _require_loop
77
78 rm -f $seq.full
79
80 echo "(dev=$SCRATCH_DEV, mount=$SCRATCH_MNT)" >> $seq.full
81 echo "" >> $seq.full
82
83 echo "--- mounts" >> $seq.full
84 mount >> $seq.full
85
86 _log "Create ext2 fs on scratch"
87 mkfs -t ext2 $SCRATCH_DEV >> $seq.full 2>&1 \
88     || _fail "!!! failed to mkfs ext2"
89
90 _log "Mount ext2 fs on scratch"
91 mount -t ext2 $SCRATCH_DEV $SCRATCH_MNT >> $seq.full 2>&1 \
92     || _fail "!!! failed to mount"
93
94 _log "Create xfs fs in file on scratch"
95 mkfs_xfs -dfile,name=$SCRATCH_MNT/test.xfs,size=20m >> $seq.full 2>&1 \
96     || _fail "!!! failed to mkfs xfs"
97
98 _log "Make mount points"
99 mkdir $SCRATCH_MNT/test $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
100     || _fail "!!! failed to make mount points"
101
102 _log "Mount xfs via loop"
103 mount -t xfs -o loop $SCRATCH_MNT/test.xfs $SCRATCH_MNT/test >> $seq.full 2>&1 \
104     || _fail "!!! failed to loop mount xfs"
105
106 _log "stress"
107 src/fsstress -d $SCRATCH_MNT/test -n 1000 $FSSTRESS_AVOID >> $seq.full 2>&1 \
108     || _fail "!!! stress failed"
109     
110 _log "clean"
111 rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
112     || _fail "!!! clean failed"
113
114 _log "create file for ext2 fs"
115 dd if=/dev/zero of=$SCRATCH_MNT/test/test.ext2 bs=1024 count=10240 >> $seq.full 2>&1 \
116     || _fail "!!! create file failed"
117     
118 _log "Create ext2 fs in file on looped xfs"
119 echo y | mkfs -t ext2 $SCRATCH_MNT/test/test.ext2 >> $seq.full 2>&1 \
120     || _fail "!!! failed to mkfs ext2 on xfs"
121
122 _log "Mount ext2 on xfs via loop"
123 mount -t ext2 -o loop $SCRATCH_MNT/test/test.ext2 $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
124     || _fail "!!! failed to loop mount xfs"
125
126 _log "stress ext2 on xfs via loop"
127 src/fsstress -d $SCRATCH_MNT/test2 -n 1000 $FSSTRESS_AVOID >> $seq.full 2>&1 \
128     || _fail "!!! stress ext2 failed"   
129
130 _log "clean"
131 rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
132     || _fail "!!! clean failed"
133    
134 _log "umount ext2 on xfs"
135 umount $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
136     || _fail "!!! umount ext2 failed"
137     
138 _log "umount xfs"
139 umount $SCRATCH_MNT/test >> $seq.full 2>&1 \
140     || _fail "!!! umount xfs failed"
141     
142 echo "--- mounts at end (before cleanup)" >> $seq.full
143 mount >> $seq.full
144
145 rm -f $seq.full
146 # success, all done
147 status=0
148 exit