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!
49 umount $SCRATCH_MNT 2>/dev/null
50 umount $tmp.loop 2>/dev/null
51 [ -d $tmp.loop ] && rmdir $tmp.loop
52 [ -d $tmp.source_dir ] && rmdir $tmp.source_dir
53 rm -f $tmp.* /var/tmp/xfs_copy.log.*
55 trap "_cleanup; exit \$status" 0 1 2 3 15
59 sed -e "s,$1,<FSIMAGE1>,g" -e "s,$2,<FSIMAGE2>,g"
65 dd if=/dev/zero of=$SCRATCH_MNT/big+attr count=1000 bs=4096
66 [ "$FAST_POPULATE" = true ] && return
67 echo $SCRATCH_MNT/big+attr | $here/src/fill2attr
68 $here/src/fill2fs --bytes=1048576 --filesize=4096 --stddev=0 --force \
69 --dir=$SCRATCH_MNT/fill --list=- > $tmp.manifest
79 [ $source = $SCRATCH_DEV ] && _scratch_mount
81 echo checking new image
82 _check_filesystem $target
84 echo mounting new image on loopback
85 rmdir $target_dir 2>/dev/null
87 mount -t xfs -o loop $target $target_dir 2>/dev/null
89 echo retrying mount with nouuid option
90 mount -t xfs -o loop -o nouuid $target $target_dir
92 echo mount failed - evil!
97 echo comparing new image files to old
98 diff -Naur $source_dir $target_dir
100 echo comparing new image directories to old
102 | _filter_copy $source_dir '#' \
103 | LC_COLLATE=POSIX sort \
106 | _filter_copy $target_dir '#' \
107 | LC_COLLATE=POSIX sort \
109 [ -s $tmp.manifest1 ] || echo no directory output
110 diff -u $tmp.manifest1 $tmp.manifest2
112 echo comparing new image geometry to old
113 xfs_info $source_dir \
114 | _filter_copy $source_dir '#' \
117 xfs_info $target_dir \
118 | _filter_copy $target_dir '#' \
121 [ -s $tmp.geometry1 ] || echo no geometry output
122 diff -u $tmp.geometry1 $tmp.geometry2
124 echo unmounting and removing new image
125 umount $source $target
129 # get standard environment, filters and checks
133 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
134 [ -x /usr/sbin/xfs_copy ] || _notrun "xfs_copy binary not yet installed"
136 # real QA test starts here
140 _scratch_mkfs_xfs -dsize=41m | _filter_mkfs 2>/dev/null
141 _scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
144 echo === populating scratch device
146 umount $SCRATCH_MNT 2>/dev/null
149 echo === copying scratch device to single target
150 xfs_copy $SCRATCH_DEV $tmp.image | _filter_copy $tmp.image
151 _verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
154 echo === copying scratch device to single target, duplicate UUID
155 xfs_copy -d $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, large ro device
160 /sbin/mkfs.xfs -dfile,name=$tmp.source,size=100g | _filter_mkfs 2>/dev/null
161 rmdir $tmp.source_dir 2>/dev/null
162 mkdir $tmp.source_dir
163 mount -t xfs -o loop $tmp.source $tmp.source_dir
164 cp -a $here $tmp.source_dir
165 mount -t xfs -o remount,ro $tmp.source $tmp.source_dir
166 xfs_copy $tmp.source $tmp.image | _filter_copy $tmp.image
167 _verify_copy $tmp.image $tmp.source $tmp.source_dir
170 echo === copying scratch device to multiple targets
171 xfs_copy -L$tmp.log -b $SCRATCH_DEV $tmp.image1 $tmp.image2 \
172 | _filter_copy $tmp.image1 $tmp.image2
173 _verify_copy $tmp.image1 $SCRATCH_DEV $SCRATCH_MNT
174 _verify_copy $tmp.image2 $SCRATCH_DEV $SCRATCH_MNT