mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
tests: use lowercase variables for all the new reflink tests
Since $TESTDIR is a local variable, make it lowercase to avoid confusion with $TEST_DIR. While we're at it, make all the local variables lowercase. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
aa69397ed1
commit
813524b566
+8
-8
@@ -51,22 +51,22 @@ echo "Format and mount"
|
||||
_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"
|
||||
rm -rf "$testdir"
|
||||
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"
|
||||
_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"
|
||||
|
||||
|
||||
+66
-66
@@ -52,93 +52,93 @@ echo "Format and mount"
|
||||
_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"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
free_blocks0=$(stat -f "$testdir" -c '%f')
|
||||
|
||||
echo "Create the original file and reflink to file2, file3"
|
||||
BLKS=2000
|
||||
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"
|
||||
blks=2000
|
||||
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"
|
||||
_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
|
||||
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
|
||||
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"
|
||||
test $C01 = $C03 || echo "Files 1-3 do not match"
|
||||
test $C01 = $C04 || echo "Files 1-4 do not match"
|
||||
test $C02 = $C03 || echo "Files 2-3 do not match"
|
||||
test $C02 = $C04 || echo "Files 2-4 do not match"
|
||||
test $C03 = $C04 || echo "Files 3-4 do not match"
|
||||
test $c01 = $c02 || echo "Files 1-2 do not match"
|
||||
test $c01 = $c03 || echo "Files 1-3 do not match"
|
||||
test $c01 = $c04 || echo "Files 1-4 do not match"
|
||||
test $c02 = $c03 || echo "Files 2-3 do not match"
|
||||
test $c02 = $c04 || echo "Files 2-4 do not match"
|
||||
test $c03 = $c04 || echo "Files 3-4 do not match"
|
||||
|
||||
test $C01 = $C11 || echo "File1 should not be different after CoW"
|
||||
test $C02 != $C12 || echo "File2 should be different after CoW"
|
||||
test $C03 != $C13 || echo "File3 should be different after CoW"
|
||||
test $C04 = $C14 || echo "File4 should not be different after CoW"
|
||||
test $c01 = $c11 || echo "File1 should not be different after CoW"
|
||||
test $c02 != $c12 || echo "File2 should be different after CoW"
|
||||
test $c03 != $c13 || echo "File3 should be different after CoW"
|
||||
test $c04 = $c14 || echo "File4 should not be different after CoW"
|
||||
|
||||
test $C11 = $C21 || echo "File1 changed by defrag"
|
||||
test $C12 = $C22 || echo "File2 changed by defrag"
|
||||
test $C13 = $C23 || echo "File3 changed by defrag"
|
||||
test $C14 = $C24 || echo "File4 changed by defrag"
|
||||
test $c11 = $c21 || echo "File1 changed by defrag"
|
||||
test $c12 = $c22 || echo "File2 changed by defrag"
|
||||
test $c13 = $c23 || echo "File3 changed by defrag"
|
||||
test $c14 = $c24 || echo "File4 changed by defrag"
|
||||
|
||||
#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3
|
||||
#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3
|
||||
|
||||
_within_tolerance "free blocks after creating some reflink copies" $FREE_BLOCKS1 $((FREE_BLOCKS0 - (BLKS * BLKSZ_FACTOR) )) $MARGIN -v
|
||||
_within_tolerance "free blocks after CoW some reflink copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - 2)) $MARGIN -v
|
||||
_within_tolerance "free blocks after defragging all reflink copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - (BLKS * 2 * BLKSZ_FACTOR))) $MARGIN -v
|
||||
_within_tolerance "free blocks after all tests" $FREE_BLOCKS3 $((FREE_BLOCKS0 - (BLKS * 3 * BLKSZ_FACTOR))) $MARGIN -v
|
||||
_within_tolerance "free blocks after creating some reflink copies" $free_blocks1 $((free_blocks0 - (blks * blksz_factor) )) $margin -v
|
||||
_within_tolerance "free blocks after CoW some reflink copies" $free_blocks2 $((free_blocks1 - 2)) $margin -v
|
||||
_within_tolerance "free blocks after defragging all reflink copies" $free_blocks3 $((free_blocks2 - (blks * 2 * blksz_factor))) $margin -v
|
||||
_within_tolerance "free blocks after all tests" $free_blocks3 $((free_blocks0 - (blks * 3 * blksz_factor))) $margin -v
|
||||
|
||||
echo "Check scratch fs"
|
||||
umount "$SCRATCH_MNT"
|
||||
|
||||
+14
-14
@@ -35,7 +35,7 @@ _cleanup()
|
||||
{
|
||||
cd /
|
||||
umount "$SCRATCH_MNT" > /dev/null 2>&1
|
||||
rm -rf "$tmp".* "$TESTDIR" "$METADUMP_FILE" "$TEST_DIR/image"
|
||||
rm -rf "$tmp".* "$testdir" "$metadump_file" "$TEST_DIR/image"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -54,34 +54,34 @@ 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"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
metadump_file="$TEST_DIR/${seq}_metadump"
|
||||
|
||||
echo "Create the original file blocks"
|
||||
BLKSZ="$(stat -f "$TESTDIR" -c '%S')"
|
||||
NR_BLKS=$((4 * BLKSZ / 12))
|
||||
_pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/file1" >> "$seqres.full"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
nr_blks=$((4 * blksz / 12))
|
||||
_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"
|
||||
seq 1 2 $((nr_blks - 1)) | while read nr; do
|
||||
_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"
|
||||
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
|
||||
|
||||
+8
-8
@@ -33,7 +33,7 @@ _cleanup()
|
||||
{
|
||||
cd /
|
||||
umount "$SCRATCH_MNT" > /dev/null 2>&1
|
||||
rm -rf "$tmp".* "$TESTDIR" "$METADUMP_FILE"
|
||||
rm -rf "$tmp".* "$testdir" "$metadump_file"
|
||||
}
|
||||
|
||||
# get standard environment, filters and checks
|
||||
@@ -54,18 +54,18 @@ echo "Format and mount scratch device"
|
||||
_scratch_mkfs >> "$seqres.full"
|
||||
_scratch_mount
|
||||
|
||||
TESTDIR="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$TESTDIR"
|
||||
mkdir "$TESTDIR"
|
||||
testdir="$SCRATCH_MNT/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
|
||||
echo "Create the original file blocks"
|
||||
BLKSZ=65536
|
||||
$XFS_IO_PROG -R -f -c "truncate $BLKSZ" "$TESTDIR/file1"
|
||||
blksz=65536
|
||||
$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."
|
||||
|
||||
echo "Check restored fs"
|
||||
umount "$SCRATCH_MNT"
|
||||
|
||||
+34
-34
@@ -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
|
||||
@@ -67,63 +67,63 @@ _require_xfs_io_command "falloc"
|
||||
|
||||
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')"
|
||||
BLKS=2000
|
||||
MARGIN=100
|
||||
SZ=$((BLKSZ * BLKS))
|
||||
FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f')
|
||||
NR=4
|
||||
_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
blks=2000
|
||||
margin=100
|
||||
sz=$((blksz * blks))
|
||||
free_blocks0=$(stat -f "$testdir" -c '%f')
|
||||
nr=4
|
||||
_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"
|
||||
for i in `seq 2 $nr`; do
|
||||
_cp_reflink "$testdir/file1" "$testdir/file$i"
|
||||
done
|
||||
_test_remount
|
||||
FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f')
|
||||
lsattr -l $TESTDIR/ | _filter_test_dir
|
||||
free_blocks1=$(stat -f "$testdir" -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir
|
||||
|
||||
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
|
||||
lsattr -l $testdir/ | _filter_test_dir
|
||||
|
||||
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')
|
||||
lsattr -l $TESTDIR/ | _filter_test_dir
|
||||
free_blocks2=$(stat -f "$testdir" -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir
|
||||
|
||||
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')
|
||||
lsattr -l $TESTDIR/ | _filter_test_dir
|
||||
free_blocks3=$(stat -f "$testdir" -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir
|
||||
|
||||
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')
|
||||
lsattr -l $TESTDIR/ | _filter_test_dir
|
||||
#echo $FREE_BLOCKS0 $FREE_BLOCKS1 $FREE_BLOCKS2 $FREE_BLOCKS3 $FREE_BLOCKS4
|
||||
free_blocks4=$(stat -f "$testdir" -c '%f')
|
||||
lsattr -l $testdir/ | _filter_test_dir
|
||||
#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
|
||||
|
||||
_within_tolerance "free blocks after reflinking" $FREE_BLOCKS1 $((FREE_BLOCKS0 - BLKS)) $MARGIN -v
|
||||
_within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
|
||||
|
||||
_within_tolerance "free blocks after nocow'ing some copies" $FREE_BLOCKS2 $((FREE_BLOCKS1 - (2 * BLKS))) $MARGIN -v
|
||||
_within_tolerance "free blocks after nocow'ing some copies" $free_blocks2 $((free_blocks1 - (2 * blks))) $margin -v
|
||||
|
||||
_within_tolerance "free blocks after nocow'ing all copies" $FREE_BLOCKS3 $((FREE_BLOCKS2 - BLKS)) $MARGIN -v
|
||||
_within_tolerance "free blocks after nocow'ing all copies" $free_blocks3 $((free_blocks2 - blks)) $margin -v
|
||||
|
||||
_within_tolerance "free blocks after overwriting original" $FREE_BLOCKS4 $FREE_BLOCKS3 $MARGIN -v
|
||||
_within_tolerance "free blocks after overwriting original" $free_blocks4 $free_blocks3 $margin -v
|
||||
|
||||
_within_tolerance "free blocks after all tests" $FREE_BLOCKS4 $((FREE_BLOCKS0 - (4 * BLKS))) $MARGIN -v
|
||||
_within_tolerance "free blocks after all tests" $free_blocks4 $((free_blocks0 - (4 * blks))) $margin -v
|
||||
|
||||
# success, all done
|
||||
status=0
|
||||
|
||||
+13
-13
@@ -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
|
||||
@@ -52,26 +52,26 @@ echo "Format and mount"
|
||||
_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"
|
||||
rm -rf "$testdir"
|
||||
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"
|
||||
sz=$((48 * 1048576))
|
||||
nr=$((sz / blksz))
|
||||
_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_test_dir
|
||||
md5sum "$TESTDIR/file2" | _filter_test_dir
|
||||
#filefrag -v "$TESTDIR/file1" "$TESTDIR/file2"
|
||||
md5sum "$testdir/file1" | _filter_test_dir
|
||||
md5sum "$testdir/file2" | _filter_test_dir
|
||||
#filefrag -v "$testdir/file1" "$testdir/file2"
|
||||
|
||||
echo "Check scratch fs"
|
||||
umount "$SCRATCH_MNT"
|
||||
|
||||
+17
-17
@@ -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
|
||||
@@ -52,33 +52,33 @@ echo "Format and mount"
|
||||
_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"
|
||||
rm -rf "$testdir"
|
||||
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"
|
||||
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"
|
||||
_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"
|
||||
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"
|
||||
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"
|
||||
|
||||
echo "Check scratch fs"
|
||||
umount "$SCRATCH_MNT"
|
||||
|
||||
Reference in New Issue
Block a user