Use a smaller scratch bigfs, 1tb is a bad idea without big-AG changes
[xfstests-dev.git] / 049
1 #! /bin/sh
2 # XFS 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     umount $SCRATCH_MNT/test2 > /dev/null 2>&1
47     umount $SCRATCH_MNT/test > /dev/null 2>&1
48     rm -f $tmp.*
49     
50     if [ -w $seq.full ]
51     then
52         echo "--- mounts at end (after cleanup)" >> $seq.full
53         mount >> $seq.full
54     fi
55 }
56
57 here=`pwd`
58 tmp=/tmp/$$
59 status=1        # failure is the default!
60 trap "_cleanup ; exit \$status" 0 1 2 3 15
61
62 # get standard environment, filters and checks
63 . ./common.rc
64 . ./common.filter
65
66 _log()
67 {
68     echo "--- $*"
69     echo "--- $*" >> $seq.full
70 }
71
72 # real QA test starts here
73
74 _require_scratch
75 _require_loop
76
77 [ "$USE_EXTERNAL" = yes ] && _notrun "Test doesn't cope with external devices"
78
79 rm -f $seq.full
80
81 echo "(dev=$SCRATCH_DEV, mount=$SCRATCH_MNT)" >> $seq.full
82 echo "" >> $seq.full
83
84 echo "--- mounts" >> $seq.full
85 mount >> $seq.full
86
87 _log "Create ext2 fs on scratch"
88 mkfs -t ext2 $SCRATCH_DEV >> $seq.full 2>&1 \
89     || _fail "!!! failed to mkfs ext2"
90
91 _log "Mount ext2 fs on scratch"
92 mount -t ext2 $SCRATCH_DEV $SCRATCH_MNT >> $seq.full 2>&1 \
93     || _fail "!!! failed to mount"
94
95 _log "Create xfs fs in file on scratch"
96 /sbin/mkfs.xfs -f $MKFS_OPTIONS -dfile,name=$SCRATCH_MNT/test.xfs,size=20m \
97     >> $seq.full 2>&1 \
98     || _fail "!!! failed to mkfs xfs"
99
100 _log "Make mount points"
101 mkdir $SCRATCH_MNT/test $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
102     || _fail "!!! failed to make mount points"
103
104 _log "Mount xfs via loop"
105 mount -t xfs -o loop $SCRATCH_MNT/test.xfs $SCRATCH_MNT/test >> $seq.full 2>&1 \
106     || _fail "!!! failed to loop mount xfs"
107
108 _log "stress"
109 ltp/fsstress -d $SCRATCH_MNT/test -n 1000 $FSSTRESS_AVOID >> $seq.full 2>&1 \
110     || _fail "!!! stress failed"
111     
112 _log "clean"
113 rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
114     || _fail "!!! clean failed"
115
116 _log "create file for ext2 fs"
117 dd if=/dev/zero of=$SCRATCH_MNT/test/test.ext2 bs=1024 count=10240 >> $seq.full 2>&1 \
118     || _fail "!!! create file failed"
119     
120 _log "Create ext2 fs in file on looped xfs"
121 echo y | mkfs -t ext2 $SCRATCH_MNT/test/test.ext2 >> $seq.full 2>&1 \
122     || _fail "!!! failed to mkfs ext2 on xfs"
123
124 _log "Mount ext2 on xfs via loop"
125 mount -t ext2 -o loop $SCRATCH_MNT/test/test.ext2 $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
126     || _fail "!!! failed to loop mount xfs"
127
128 _log "stress ext2 on xfs via loop"
129 ltp/fsstress -d $SCRATCH_MNT/test2 -n 1000 $FSSTRESS_AVOID >> $seq.full 2>&1 \
130     || _fail "!!! stress ext2 failed"   
131
132 _log "clean"
133 rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
134     || _fail "!!! clean failed"
135    
136 _log "umount ext2 on xfs"
137 umount $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
138     || _fail "!!! umount ext2 failed"
139     
140 _log "umount xfs"
141 umount $SCRATCH_MNT/test >> $seq.full 2>&1 \
142     || _fail "!!! umount xfs failed"
143     
144 echo "--- mounts at end (before cleanup)" >> $seq.full
145 mount >> $seq.full
146
147 rm -f $seq.full
148 # success, all done
149 status=0
150 exit