2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2003,2008 Silicon Graphics, Inc. All Rights Reserved.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
17 # get standard environment, filters and checks
22 # don't put fs images in /tmp
28 _scratch_unmount 2>/dev/null
29 umount $imgs.loop 2>/dev/null
30 [ -d $imgs.loop ] && rmdir $imgs.loop
31 umount $imgs.source_dir 2>/dev/null
32 [ -d $imgs.source_dir ] && rm -rf $imgs.source_dir
33 rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.*
35 trap "_cleanup; exit \$status" 0 1 2 3 15
39 sed -e "s,$1,<DEVIMAGE>,g" -e "s,$2,<FSIMAGE1>,g" \
40 -e "s,$3,<DEVIMAGE>,g" -e "s,$4,<FSIMAGE2>,g"
45 sed -e "s,$1,<MNTPATH>,g" | LC_COLLATE=POSIX sort
51 dd if=/dev/zero of=$SCRATCH_MNT/big+attr count=1000 bs=4096
52 [ "$FAST_POPULATE" = true ] && return
53 echo $SCRATCH_MNT/big+attr | $here/src/fill2attr
54 $here/src/fill2fs --bytes=1048576 --filesize=4096 --stddev=0 --force \
55 --dir=$SCRATCH_MNT/fill --list=- > $tmp.manifest
65 [ $source = $SCRATCH_DEV ] && _scratch_mount
67 echo checking new image
68 _check_xfs_filesystem $target none none
70 echo mounting new image on loopback
71 rmdir $target_dir 2>/dev/null
74 mount -t xfs -o loop $target $target_dir 2>/dev/null
76 echo retrying mount with nouuid option >>$seqres.full
77 mount -t xfs -o loop -o nouuid $target $target_dir
79 echo mount failed - evil!
84 echo comparing new image files to old
85 diff -Naur $source_dir $target_dir
87 echo comparing new image directories to old
88 find $source_dir | _filter_path $source_dir > $tmp.manifest1
89 find $target_dir | _filter_path $target_dir > $tmp.manifest2
90 [ -s $tmp.manifest1 ] || echo no directory output
91 diff -u $tmp.manifest1 $tmp.manifest2
93 echo comparing new image geometry to old
94 $XFS_INFO_PROG $source_dir \
95 | _filter_copy $source $source_dir '/dev/loop.' '#' \
98 $XFS_INFO_PROG $target_dir \
99 | _filter_copy $target $target_dir '/dev/loop.' '#' \
102 [ -s $tmp.geometry1 ] || echo no geometry output
103 diff -u $tmp.geometry1 $tmp.geometry2
105 echo unmounting and removing new image
107 umount $target_dir > /dev/null 2>&1
111 # real QA test starts here
121 _scratch_mkfs_xfs -dsize=41m,agcount=2 >>$seqres.full 2>&1
125 echo === populating scratch device
127 _scratch_unmount 2>/dev/null
130 echo === copying scratch device to single target
131 $XFS_COPY_PROG $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
132 _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
135 echo === copying scratch device to single target, duplicate UUID
136 $XFS_COPY_PROG -d $SCRATCH_DEV $imgs.image | _filter_copy '#' $imgs.image '#' '#'
137 _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
140 echo === copying scratch device to single target, large ro device
141 ${MKFS_XFS_PROG} -dfile,name=$imgs.source,size=100g \
142 | _filter_mkfs 2>/dev/null
143 rmdir $imgs.source_dir 2>/dev/null
144 mkdir $imgs.source_dir
146 mount -t xfs -o loop $imgs.source $imgs.source_dir
147 loop2=`mount | grep $imgs.source | grep -o -e 'loop=.*[^),]' | grep -o -e '/.*$'`
148 cp -a $here $imgs.source_dir
149 mount -t xfs -o remount,ro $imgs.source $imgs.source_dir
150 $XFS_COPY_PROG $imgs.source $imgs.image | _filter_copy '#' $imgs.image '#' '#'
151 _verify_copy $imgs.image $imgs.source $imgs.source_dir
155 # We're done with the nested loop mount, now we have to clean
156 # up the pieces that mount is incapable of doing.
157 losetup -d $loop2 > /dev/null 2>&1
160 echo === copying scratch device to multiple targets
161 $XFS_COPY_PROG -L$imgs.log -b $SCRATCH_DEV $imgs.image1 $imgs.image2 \
162 | _filter_copy '#' $imgs.image1 '#' $imgs.image2
163 _verify_copy $imgs.image1 $SCRATCH_DEV $SCRATCH_MNT
164 _verify_copy $imgs.image2 $SCRATCH_DEV $SCRATCH_MNT