mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
reflink: fix style problems in existing tests
Fix style problems such as unnecessary use of quotes, add helper variables to reduce visual clutter, and other minor fixes to make the first batch of tests more closely resemble the second round tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
+14
-15
@@ -21,8 +21,8 @@
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
|
||||
seq=`basename "$0"`
|
||||
seqres="$RESULT_DIR/$seq"
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -f "$tmp".*
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -48,27 +48,26 @@ _require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
_scratch_mkfs -d size=$((2 * 4096 * 4096)) -l size=4194304 > $seqres.full 2>&1
|
||||
_scratch_mount >> $seqres.full 2>&1
|
||||
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
testdir=$SCRATCH_MNT/test-$seq
|
||||
mkdir $testdir
|
||||
|
||||
echo "Create the original file and reflink to copy1, copy2"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
_pwrite_byte 0x61 0 $((blksz * 14 + 71)) "$testdir/original" >> "$seqres.full"
|
||||
_cp_reflink "$testdir/original" "$testdir/copy1"
|
||||
_cp_reflink "$testdir/copy1" "$testdir/copy2"
|
||||
blksz="$(stat -f $testdir -c '%S')"
|
||||
_pwrite_byte 0x61 0 $((blksz * 14 + 71)) $testdir/original >> $seqres.full
|
||||
_cp_reflink $testdir/original $testdir/copy1
|
||||
_cp_reflink $testdir/copy1 $testdir/copy2
|
||||
|
||||
echo "Grow fs"
|
||||
"$XFS_GROWFS_PROG" "$SCRATCH_MNT" 2>&1 | _filter_growfs >> "$seqres.full"
|
||||
$XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 | _filter_growfs >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Create more reflink copies"
|
||||
_cp_reflink "$testdir/original" "$testdir/copy3"
|
||||
_cp_reflink $testdir/original $testdir/copy3
|
||||
|
||||
xfs_info "$SCRATCH_MNT" >> "$seqres.full"
|
||||
xfs_info $SCRATCH_MNT >> $seqres.full
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
|
||||
+46
-47
@@ -21,8 +21,8 @@
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
|
||||
seq=`basename "$0"`
|
||||
seqres="$RESULT_DIR/$seq"
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -f "$tmp".*
|
||||
rm -f $tmp.*
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -49,13 +49,12 @@ _require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
_scratch_mkfs > $seqres.full 2>&1
|
||||
_scratch_mount >> $seqres.full 2>&1
|
||||
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
free_blocks0=$(stat -f "$testdir" -c '%f')
|
||||
testdir=$SCRATCH_MNT/test-$seq
|
||||
mkdir $testdir
|
||||
free_blocks0=$(stat -f $testdir -c '%f')
|
||||
|
||||
echo "Create the original file and reflink to file2, file3"
|
||||
blks=2000
|
||||
@@ -63,57 +62,57 @@ margin=160
|
||||
blksz=65536
|
||||
real_blksz="$(stat -f $testdir -c '%S')"
|
||||
blksz_factor=$((blksz / real_blksz))
|
||||
_pwrite_byte 0x61 0 $((blks * blksz)) "$testdir/file1" >> "$seqres.full"
|
||||
_cp_reflink "$testdir/file1" "$testdir/file2"
|
||||
_cp_reflink "$testdir/file2" "$testdir/file3"
|
||||
_cp_reflink "$testdir/file3" "$testdir/file4"
|
||||
_pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full
|
||||
_cp_reflink $testdir/file1 $testdir/file2
|
||||
_cp_reflink $testdir/file2 $testdir/file3
|
||||
_cp_reflink $testdir/file3 $testdir/file4
|
||||
_test_remount
|
||||
free_blocks1=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks1=$(stat -f $testdir -c '%f')
|
||||
|
||||
md5sum "$testdir/file1" | _filter_scratch
|
||||
md5sum "$testdir/file2" | _filter_scratch
|
||||
md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file4" | _filter_scratch
|
||||
md5sum $testdir/file1 | _filter_scratch
|
||||
md5sum $testdir/file2 | _filter_scratch
|
||||
md5sum $testdir/file3 | _filter_scratch
|
||||
md5sum $testdir/file4 | _filter_scratch
|
||||
|
||||
c01=$(_md5_checksum "$testdir/file1")
|
||||
c02=$(_md5_checksum "$testdir/file2")
|
||||
c03=$(_md5_checksum "$testdir/file3")
|
||||
c04=$(_md5_checksum "$testdir/file4")
|
||||
c01=$(_md5_checksum $testdir/file1)
|
||||
c02=$(_md5_checksum $testdir/file2)
|
||||
c03=$(_md5_checksum $testdir/file3)
|
||||
c04=$(_md5_checksum $testdir/file4)
|
||||
|
||||
echo "CoW the reflink copies"
|
||||
_pwrite_byte 0x62 $blksz $blksz "$testdir/file2" >> "$seqres.full"
|
||||
_pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz "$testdir/file3" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $blksz $blksz $testdir/file2 >> $seqres.full
|
||||
_pwrite_byte 0x63 $(( blksz * (blks - 1) )) $blksz $testdir/file3 >> $seqres.full
|
||||
_test_remount
|
||||
free_blocks2=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks2=$(stat -f $testdir -c '%f')
|
||||
|
||||
md5sum "$testdir/file1" | _filter_scratch
|
||||
md5sum "$testdir/file2" | _filter_scratch
|
||||
md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file4" | _filter_scratch
|
||||
md5sum $testdir/file1 | _filter_scratch
|
||||
md5sum $testdir/file2 | _filter_scratch
|
||||
md5sum $testdir/file3 | _filter_scratch
|
||||
md5sum $testdir/file4 | _filter_scratch
|
||||
|
||||
c11=$(_md5_checksum "$testdir/file1")
|
||||
c12=$(_md5_checksum "$testdir/file2")
|
||||
c13=$(_md5_checksum "$testdir/file3")
|
||||
c14=$(_md5_checksum "$testdir/file4")
|
||||
c11=$(_md5_checksum $testdir/file1)
|
||||
c12=$(_md5_checksum $testdir/file2)
|
||||
c13=$(_md5_checksum $testdir/file3)
|
||||
c14=$(_md5_checksum $testdir/file4)
|
||||
|
||||
echo "Defragment"
|
||||
lsattr -l "$testdir/" | _filter_scratch | _filter_spaces
|
||||
xfs_fsr -v -d "$testdir/file1" >> "$seqres.full"
|
||||
xfs_fsr -v -d "$testdir/file2" >> "$seqres.full" # fsr probably breaks the link
|
||||
xfs_fsr -v -d "$testdir/file3" >> "$seqres.full" # fsr probably breaks the link
|
||||
xfs_fsr -v -d "$testdir/file4" >> "$seqres.full" # fsr probably ignores this file
|
||||
lsattr -l $testdir/ | _filter_scratch | _filter_spaces
|
||||
xfs_fsr -v -d $testdir/file1 >> $seqres.full
|
||||
xfs_fsr -v -d $testdir/file2 >> $seqres.full # fsr probably breaks the link
|
||||
xfs_fsr -v -d $testdir/file3 >> $seqres.full # fsr probably breaks the link
|
||||
xfs_fsr -v -d $testdir/file4 >> $seqres.full # fsr probably ignores this file
|
||||
_test_remount
|
||||
free_blocks3=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks3=$(stat -f $testdir -c '%f')
|
||||
|
||||
md5sum "$testdir/file1" | _filter_scratch
|
||||
md5sum "$testdir/file2" | _filter_scratch
|
||||
md5sum "$testdir/file3" | _filter_scratch
|
||||
md5sum "$testdir/file4" | _filter_scratch
|
||||
md5sum $testdir/file1 | _filter_scratch
|
||||
md5sum $testdir/file2 | _filter_scratch
|
||||
md5sum $testdir/file3 | _filter_scratch
|
||||
md5sum $testdir/file4 | _filter_scratch
|
||||
|
||||
c21=$(_md5_checksum "$testdir/file1")
|
||||
c22=$(_md5_checksum "$testdir/file2")
|
||||
c23=$(_md5_checksum "$testdir/file3")
|
||||
c24=$(_md5_checksum "$testdir/file4")
|
||||
c21=$(_md5_checksum $testdir/file1)
|
||||
c22=$(_md5_checksum $testdir/file2)
|
||||
c23=$(_md5_checksum $testdir/file3)
|
||||
c24=$(_md5_checksum $testdir/file4)
|
||||
|
||||
echo "Check files"
|
||||
test $c01 = $c02 || echo "Files 1-2 do not match"
|
||||
|
||||
+16
-17
@@ -22,7 +22,7 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
seq=`basename "$0"`
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
@@ -34,8 +34,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount "$SCRATCH_MNT" > /dev/null 2>&1
|
||||
rm -rf "$tmp".* "$testdir" "$metadump_file" "$TEST_DIR/image"
|
||||
umount $SCRATCH_MNT > /dev/null 2>&1
|
||||
rm -rf $tmp.* $testdir $metadump_file $TEST_DIR/image
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -49,39 +49,38 @@ _supported_fs xfs
|
||||
_require_loop
|
||||
_require_scratch_reflink
|
||||
|
||||
rm -f "$seqres.full"
|
||||
rm -f $seqres.full
|
||||
|
||||
_scratch_mkfs >/dev/null 2>&1
|
||||
_scratch_mount
|
||||
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
metadump_file="$TEST_DIR/${seq}_metadump"
|
||||
testdir=$SCRATCH_MNT/test-$seq
|
||||
mkdir $testdir
|
||||
metadump_file=$TEST_DIR/${seq}_metadump
|
||||
|
||||
echo "Create the original file blocks"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
blksz="$(stat -f $testdir -c '%S')"
|
||||
nr_blks=$((4 * blksz / 12))
|
||||
_pwrite_byte 0x61 0 $((blksz * nr_blks)) "$testdir/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
|
||||
|
||||
echo "Reflink every other block"
|
||||
seq 1 2 $((nr_blks - 1)) | while read nr; do
|
||||
_reflink_range "$testdir/file1" $((nr * blksz)) \
|
||||
"$testdir/file2" $((nr * blksz)) $blksz >> "$seqres.full"
|
||||
_reflink_range $testdir/file1 $((nr * blksz)) \
|
||||
$testdir/file2 $((nr * blksz)) $blksz >> $seqres.full
|
||||
done
|
||||
|
||||
echo "Create metadump file"
|
||||
_scratch_unmount
|
||||
_scratch_metadump "$metadump_file"
|
||||
_scratch_metadump $metadump_file
|
||||
|
||||
# Now restore the obfuscated one back and take a look around
|
||||
echo "Restore metadump"
|
||||
xfs_mdrestore "$metadump_file" "$TEST_DIR/image"
|
||||
_mount -t $FSTYP "$TEST_DIR/image" "$SCRATCH_MNT"
|
||||
umount "$SCRATCH_MNT"
|
||||
xfs_mdrestore $metadump_file $TEST_DIR/image
|
||||
_mount -t $FSTYP $TEST_DIR/image $SCRATCH_MNT
|
||||
umount $SCRATCH_MNT
|
||||
|
||||
echo "Check restored fs"
|
||||
_check_generic_filesystem "$metadump_file"
|
||||
_check_generic_filesystem $metadump_file
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
|
||||
+10
-11
@@ -20,7 +20,7 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
seq=`basename "$0"`
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
@@ -32,8 +32,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
umount "$SCRATCH_MNT" > /dev/null 2>&1
|
||||
rm -rf "$tmp".* "$testdir" "$metadump_file"
|
||||
umount $SCRATCH_MNT > /dev/null 2>&1
|
||||
rm -rf $tmp.* $testdir $metadump_file
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -48,24 +48,23 @@ _require_realtime
|
||||
_require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
|
||||
rm -f "$seqres.full"
|
||||
rm -f $seqres.full
|
||||
|
||||
echo "Format and mount scratch device"
|
||||
_scratch_mkfs >> "$seqres.full"
|
||||
_scratch_mkfs >> $seqres.full
|
||||
_scratch_mount
|
||||
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
testdir=$SCRATCH_MNT/test-$seq
|
||||
mkdir $testdir
|
||||
|
||||
echo "Create the original file blocks"
|
||||
blksz=65536
|
||||
$XFS_IO_PROG -R -f -c "truncate $blksz" "$testdir/file1"
|
||||
$XFS_IO_PROG -R -f -c "truncate $blksz" $testdir/file1
|
||||
|
||||
echo "Reflink every block"
|
||||
_cp_reflink "$testdir/file1" "$testdir/file2" 2>&1 | _filter_scratch
|
||||
_cp_reflink $testdir/file1 $testdir/file2 2>&1 | _filter_scratch
|
||||
|
||||
test -s "$testdir/file2" && _fail "Should not be able to reflink a realtime file."
|
||||
test -s $testdir/file2 && _fail "Should not be able to reflink a realtime file."
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
|
||||
+22
-21
@@ -37,8 +37,8 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
seq=`basename "$0"`
|
||||
seqres="$RESULT_DIR/$seq"
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
@@ -49,7 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -rf "$tmp".* "$testdir"
|
||||
rm -rf $tmp.* $testdir
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -65,53 +65,54 @@ _require_test_lsattr
|
||||
_require_cp_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
rm -f $seqres.full
|
||||
|
||||
testdir="$TEST_DIR/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
testdir=$TEST_DIR/test-$seq
|
||||
rm -rf $testdir
|
||||
mkdir $testdir
|
||||
|
||||
echo "Create the original file blocks"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
blksz="$(stat -f $testdir -c '%S')"
|
||||
blks=2000
|
||||
margin=100
|
||||
sz=$((blksz * blks))
|
||||
free_blocks0=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks0=$(stat -f $testdir -c '%f')
|
||||
nr=4
|
||||
_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
filesize=$((blksz * nr))
|
||||
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
|
||||
_test_remount
|
||||
|
||||
echo "Create the reflink copies"
|
||||
for i in `seq 2 $nr`; do
|
||||
_cp_reflink "$testdir/file1" "$testdir/file$i"
|
||||
_cp_reflink $testdir/file1 $testdir/file$i
|
||||
done
|
||||
_test_remount
|
||||
free_blocks1=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks1=$(stat -f $testdir -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
|
||||
|
||||
echo "funshare part of a file"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $((sz / 2))" "$testdir/file2"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $((sz / 2))" $testdir/file2
|
||||
_test_remount
|
||||
lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
|
||||
|
||||
echo "funshare some of the copies"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file2
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file3
|
||||
_test_remount
|
||||
free_blocks2=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks2=$(stat -f $testdir -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
|
||||
|
||||
echo "funshare the rest of the files"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file4
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1
|
||||
_test_remount
|
||||
free_blocks3=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks3=$(stat -f $testdir -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
|
||||
|
||||
echo "Rewrite the original file"
|
||||
_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x65 0 $sz $testdir/file1 >> $seqres.full
|
||||
_test_remount
|
||||
free_blocks4=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks4=$(stat -f $testdir -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir | _filter_spaces
|
||||
#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
|
||||
|
||||
|
||||
+15
-16
@@ -21,8 +21,8 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
seq=`basename "$0"`
|
||||
seqres="$RESULT_DIR/$seq"
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -rf "$tmp".* "$testdir"
|
||||
rm -rf $tmp.* $testdir
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -46,32 +46,31 @@ _supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
|
||||
rm -f "$seqres.full"
|
||||
rm -f $seqres.full
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
_scratch_mkfs -d agsize=$((32 * 1048576)) > $seqres.full 2>&1
|
||||
_scratch_mount >> $seqres.full 2>&1
|
||||
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
testdir=$SCRATCH_MNT/test-$seq
|
||||
mkdir $testdir
|
||||
blksz="$(stat -f $testdir -c '%S')"
|
||||
|
||||
echo "Create the original files"
|
||||
sz=$((48 * 1048576))
|
||||
nr=$((sz / blksz))
|
||||
_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
|
||||
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
|
||||
_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "CoW every other block"
|
||||
_pwrite_byte 0x62 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 0 $sz $testdir/file1 >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
md5sum "$testdir/file1" | _filter_scratch
|
||||
md5sum "$testdir/file2" | _filter_scratch
|
||||
#filefrag -v "$testdir/file1" "$testdir/file2"
|
||||
md5sum $testdir/file1 | _filter_scratch
|
||||
md5sum $testdir/file2 | _filter_scratch
|
||||
#filefrag -v $testdir/file1 $testdir/file2
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
|
||||
+18
-19
@@ -21,8 +21,8 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
seq=`basename "$0"`
|
||||
seqres="$RESULT_DIR/$seq"
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_cleanup()
|
||||
{
|
||||
cd /
|
||||
rm -rf "$tmp".* "$testdir"
|
||||
rm -rf $tmp.* $testdir
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -46,39 +46,38 @@ _supported_os Linux
|
||||
_require_scratch_reflink
|
||||
_require_cp_reflink
|
||||
|
||||
rm -f "$seqres.full"
|
||||
rm -f $seqres.full
|
||||
|
||||
echo "Format and mount"
|
||||
_scratch_mkfs -d agsize=$((32 * 1048576)) > "$seqres.full" 2>&1
|
||||
_scratch_mount >> "$seqres.full" 2>&1
|
||||
_scratch_mkfs -d agsize=$((32 * 1048576)) > $seqres.full 2>&1
|
||||
_scratch_mount >> $seqres.full 2>&1
|
||||
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
blksz="$(stat -f -c '%S' "$testdir")"
|
||||
testdir=$SCRATCH_MNT/test-$seq
|
||||
mkdir $testdir
|
||||
blksz=$(stat -f -c '%S' $testdir)
|
||||
|
||||
echo "Create the original files"
|
||||
sz=$((48 * 1048576))
|
||||
nr=$((sz / blksz))
|
||||
_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
|
||||
_pwrite_byte 0x61 0 $sz "$testdir/file2.chk" >> "$seqres.full"
|
||||
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
|
||||
_cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
|
||||
_pwrite_byte 0x61 0 $sz $testdir/file2.chk >> $seqres.full
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 do not match"
|
||||
cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
|
||||
cmp -s $testdir/file1 $testdir/file2 || echo "file1 and file2 do not match"
|
||||
cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
|
||||
|
||||
echo "CoW every other block"
|
||||
seq 1 2 $((nr - 1)) | while read f; do
|
||||
_pwrite_byte 0x62 $((f * blksz)) $blksz "$testdir/file2" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((f * blksz)) $blksz "$testdir/file2.chk" >> "$seqres.full"
|
||||
_pwrite_byte 0x62 $((f * blksz)) $blksz $testdir/file2 >> $seqres.full
|
||||
_pwrite_byte 0x62 $((f * blksz)) $blksz $testdir/file2.chk >> $seqres.full
|
||||
done
|
||||
_scratch_remount
|
||||
|
||||
echo "Compare files"
|
||||
! cmp -s "$testdir/file1" "$testdir/file2" || echo "file1 and file2 must not match"
|
||||
cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
|
||||
! cmp -s $testdir/file1 $testdir/file2 || echo "file1 and file2 must not match"
|
||||
cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
|
||||
Reference in New Issue
Block a user