6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
17 # Further, this software is distributed without any warranty that it is
18 # free of the rightful claim 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.
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.
28 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
29 # Mountain View, CA 94043, or:
33 # For further information regarding this notice, see:
35 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
36 #-----------------------------------------------------------------------
42 echo "QA output created by $seq"
46 status=1 # failure is the default!
50 umount $SCRATCH_MNT 2>/dev/null
51 umount $tmp.loop 2>/dev/null
52 [ -d $tmp.loop ] && rmdir $tmp.loop
53 [ -d $tmp.source_dir ] && rmdir $tmp.source_dir
54 rm -f $tmp.* /var/tmp/xfs_copy.log.*
56 trap "_cleanup; exit \$status" 0 1 2 3 15
60 sed -e "s,$1,<FSIMAGE1>,g" -e "s,$2,<FSIMAGE2>,g"
66 dd if=/dev/zero of=$SCRATCH_MNT/big+attr count=1000 bs=4096
67 [ "$FAST_POPULATE" = true ] && return
68 echo $SCRATCH_MNT/big+attr | $here/src/fill2attr
69 $here/src/fill2fs --bytes=1048576 --filesize=4096 --stddev=0 --force \
70 --dir=$SCRATCH_MNT/fill --list=- > $tmp.manifest
80 [ $source = $SCRATCH_DEV ] && _scratch_mount
82 echo checking new image
83 _check_xfs_filesystem $target
85 echo mounting new image on loopback
86 rmdir $target_dir 2>/dev/null
88 mount -t xfs -o loop $target $target_dir 2>/dev/null
90 echo retrying mount with nouuid option
91 mount -t xfs -o loop -o nouuid $target $target_dir
93 echo mount failed - evil!
98 echo comparing new image files to old
99 diff -Naur $source_dir $target_dir
101 echo comparing new image directories to old
103 | _filter_copy $source_dir '#' \
104 | LC_COLLATE=POSIX sort \
107 | _filter_copy $target_dir '#' \
108 | LC_COLLATE=POSIX sort \
110 [ -s $tmp.manifest1 ] || echo no directory output
111 diff -u $tmp.manifest1 $tmp.manifest2
113 echo comparing new image geometry to old
114 xfs_info $source_dir \
115 | _filter_copy $source_dir '#' \
118 xfs_info $target_dir \
119 | _filter_copy $target_dir '#' \
122 [ -s $tmp.geometry1 ] || echo no geometry output
123 diff -u $tmp.geometry1 $tmp.geometry2
125 echo unmounting and removing new image
126 umount $source $target
130 # get standard environment, filters and checks
135 # real QA test starts here
139 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
140 [ -x /usr/sbin/xfs_copy ] || _notrun "xfs_copy binary not yet installed"
145 _scratch_mkfs_xfs -dsize=41m | _filter_mkfs 2>/dev/null
146 _scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
149 echo === populating scratch device
151 umount $SCRATCH_MNT 2>/dev/null
154 echo === copying scratch device to single target
155 xfs_copy $SCRATCH_DEV $tmp.image | _filter_copy $tmp.image
156 _verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
159 echo === copying scratch device to single target, duplicate UUID
160 xfs_copy -d $SCRATCH_DEV $tmp.image | _filter_copy $tmp.image
161 _verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
164 echo === copying scratch device to single target, large ro device
165 /sbin/mkfs.xfs -dfile,name=$tmp.source,size=100g | _filter_mkfs 2>/dev/null
166 rmdir $tmp.source_dir 2>/dev/null
167 mkdir $tmp.source_dir
168 mount -t xfs -o loop $tmp.source $tmp.source_dir
169 cp -a $here $tmp.source_dir
170 mount -t xfs -o remount,ro $tmp.source $tmp.source_dir
171 xfs_copy $tmp.source $tmp.image | _filter_copy $tmp.image
172 _verify_copy $tmp.image $tmp.source $tmp.source_dir
175 echo === copying scratch device to multiple targets
176 xfs_copy -L$tmp.log -b $SCRATCH_DEV $tmp.image1 $tmp.image2 \
177 | _filter_copy $tmp.image1 $tmp.image2
178 _verify_copy $tmp.image1 $SCRATCH_DEV $SCRATCH_MNT
179 _verify_copy $tmp.image2 $SCRATCH_DEV $SCRATCH_MNT