6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
22 umount $SCRATCH_MNT 2>/dev/null
23 umount $tmp.loop 2>/dev/null
24 [ -d $tmp.loop ] && rmdir $tmp.loop
25 [ -d $tmp.source_dir ] && rmdir $tmp.source_dir
26 rm -f $tmp.* /var/tmp/xfs_copy.log.*
28 trap "_cleanup; exit \$status" 0 1 2 3 15
32 sed -e "s,$1,<DEVIMAGE>,g" -e "s,$2,<FSIMAGE1>,g" \
33 -e "s,$3,<DEVIMAGE>,g" -e "s,$4,<FSIMAGE2>,g"
38 sed -e "s,$1,<MNTPATH>,g" | LC_COLLATE=POSIX sort
44 dd if=/dev/zero of=$SCRATCH_MNT/big+attr count=1000 bs=4096
45 [ "$FAST_POPULATE" = true ] && return
46 echo $SCRATCH_MNT/big+attr | $here/src/fill2attr
47 $here/src/fill2fs --bytes=1048576 --filesize=4096 --stddev=0 --force \
48 --dir=$SCRATCH_MNT/fill --list=- > $tmp.manifest
58 [ $source = $SCRATCH_DEV ] && _scratch_mount
60 echo checking new image
61 _check_xfs_filesystem $target none none
63 echo mounting new image on loopback
64 rmdir $target_dir 2>/dev/null
66 mount -t xfs -o loop $target $target_dir 2>/dev/null
68 echo retrying mount with nouuid option
69 mount -t xfs -o loop -o nouuid $target $target_dir
71 echo mount failed - evil!
76 echo comparing new image files to old
77 diff -Naur $source_dir $target_dir
79 echo comparing new image directories to old
80 find $source_dir | _filter_path $source_dir > $tmp.manifest1
81 find $target_dir | _filter_path $target_dir > $tmp.manifest2
82 [ -s $tmp.manifest1 ] || echo no directory output
83 diff -u $tmp.manifest1 $tmp.manifest2
85 echo comparing new image geometry to old
86 xfs_info $source_dir \
87 | _filter_copy $source $source_dir '/dev/loop.' '#' \
90 xfs_info $target_dir \
91 | _filter_copy $target $target_dir '/dev/loop.' '#' \
94 [ -s $tmp.geometry1 ] || echo no geometry output
95 diff -u $tmp.geometry1 $tmp.geometry2
97 echo unmounting and removing new image
98 umount $source $target
102 # get standard environment, filters and checks
107 # real QA test starts here
111 [ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
112 [ -x /usr/sbin/xfs_copy ] || _notrun "xfs_copy binary not yet installed"
117 MKFS_OPTIONS="" #ignore external MKFS_OPTIONS
118 _scratch_mkfs_xfs -dsize=41m,agcount=2 | _filter_mkfs 2>/dev/null
119 _scratch_mount 2>/dev/null || _fail "initial scratch mount failed"
122 echo === populating scratch device
124 umount $SCRATCH_MNT 2>/dev/null
127 echo === copying scratch device to single target
128 xfs_copy $SCRATCH_DEV $tmp.image | _filter_copy '#' $tmp.image '#' '#'
129 _verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
132 echo === copying scratch device to single target, duplicate UUID
133 xfs_copy -d $SCRATCH_DEV $tmp.image | _filter_copy '#' $tmp.image '#' '#'
134 _verify_copy $tmp.image $SCRATCH_DEV $SCRATCH_MNT
137 echo === copying scratch device to single target, large ro device
138 /sbin/mkfs.xfs -dfile,name=$tmp.source,size=100g | _filter_mkfs 2>/dev/null
139 rmdir $tmp.source_dir 2>/dev/null
140 mkdir $tmp.source_dir
141 mount -t xfs -o loop $tmp.source $tmp.source_dir
142 cp -a $here $tmp.source_dir
143 mount -t xfs -o remount,ro $tmp.source $tmp.source_dir
144 xfs_copy $tmp.source $tmp.image | _filter_copy '#' $tmp.image '#' '#'
145 _verify_copy $tmp.image $tmp.source $tmp.source_dir
148 echo === copying scratch device to multiple targets
149 xfs_copy -L$tmp.log -b $SCRATCH_DEV $tmp.image1 $tmp.image2 \
150 | _filter_copy '#' $tmp.image1 '#' $tmp.image2
151 _verify_copy $tmp.image1 $SCRATCH_DEV $SCRATCH_MNT
152 _verify_copy $tmp.image2 $SCRATCH_DEV $SCRATCH_MNT