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:
Darrick J. Wong
2016-02-08 09:27:15 +11:00
committed by Dave Chinner
parent aa69397ed1
commit 813524b566
89 changed files with 2290 additions and 2290 deletions
+12 -12
View File
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.* "$TESTDIR"
rm -f $tmp.* "$testdir"
}
# get standard environment, filters and checks
@@ -53,37 +53,37 @@ _require_xfs_io_command "fiemap"
_require_cp_reflink
_require_test
TESTDIR1=$TEST_DIR/test-$seq
rm -rf $TESTDIR1
mkdir $TESTDIR1
testdir1=$TEST_DIR/test-$seq
rm -rf $testdir1
mkdir $testdir1
_checksum_files() {
for F in original copy1 copy2
do
md5sum $TESTDIR1/$F | _filter_test_dir
md5sum $testdir1/$F | _filter_test_dir
done
}
rm -f $seqres.full
echo "Create the original file and reflink to copy1, copy2"
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \
>> $seqres.full 2>&1
cp --reflink $TESTDIR1/original $TESTDIR1/copy1
cp --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
_verify_reflink $TESTDIR1/original $TESTDIR1/copy1
_verify_reflink $TESTDIR1/original $TESTDIR1/copy2
cp --reflink $testdir1/original $testdir1/copy1
cp --reflink $testdir1/copy1 $testdir1/copy2
_verify_reflink $testdir1/original $testdir1/copy1
_verify_reflink $testdir1/original $testdir1/copy2
echo "Original md5sums:"
_checksum_files
echo "Overwrite original file with new data"
$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $TESTDIR1/original \
$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $testdir1/original \
>> $seqres.full 2>&1
echo "md5sums after overwriting original:"
_checksum_files
echo "Overwrite copy1 with different new data"
$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $TESTDIR1/copy1 \
$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $testdir1/copy1 \
>> $seqres.full 2>&1
echo "md5sums after overwriting copy1:"
_checksum_files
+21 -21
View File
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.* "$TESTDIR"
rm -f $tmp.* "$testdir"
}
# get standard environment, filters and checks
@@ -53,55 +53,55 @@ _require_xfs_io_command "fiemap"
_require_cp_reflink
_require_test
TESTDIR1=$TEST_DIR/test-$seq
rm -rf $TESTDIR1
mkdir $TESTDIR1
testdir1=$TEST_DIR/test-$seq
rm -rf $testdir1
mkdir $testdir1
_checksum_files() {
for F in original/file1 original/subdir/file2 \
copy1/file1 copy1/subdir/file2 \
copy2/file1 copy2/subdir/file2
do
md5sum $TESTDIR1/$F | _filter_test_dir
md5sum $testdir1/$F | _filter_test_dir
done
}
rm -f $seqres.full
mkdir $TESTDIR1/original
mkdir $TESTDIR1/original/subdir
mkdir $testdir1/original
mkdir $testdir1/original/subdir
echo "Create the original files and reflink dirs"
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original/file1 \
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original/file1 \
>> $seqres.full 2>&1
$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 11000' \
$TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
cp --recursive --reflink $TESTDIR1/original $TESTDIR1/copy1
cp --recursive --reflink $TESTDIR1/copy1 $TESTDIR1/copy2
$testdir1/original/subdir/file2 >> $seqres.full 2>&1
cp --recursive --reflink $testdir1/original $testdir1/copy1
cp --recursive --reflink $testdir1/copy1 $testdir1/copy2
_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy1/file1
_verify_reflink $TESTDIR1/original/subdir/file2 \
$TESTDIR1/copy1/subdir/file2
_verify_reflink $TESTDIR1/original/file1 $TESTDIR1/copy2/file1
_verify_reflink $TESTDIR1/original/subdir/file2 \
$TESTDIR1/copy2/subdir/file2
_verify_reflink $testdir1/original/file1 $testdir1/copy1/file1
_verify_reflink $testdir1/original/subdir/file2 \
$testdir1/copy1/subdir/file2
_verify_reflink $testdir1/original/file1 $testdir1/copy2/file1
_verify_reflink $testdir1/original/subdir/file2 \
$testdir1/copy2/subdir/file2
echo "Original md5sums:"
_checksum_files
echo "Overwrite original/file1 and original/subdir/file2 with new data"
$XFS_IO_PROG -c 'pwrite -S 0x63 0 13000' $TESTDIR1/original/file1 \
$XFS_IO_PROG -c 'pwrite -S 0x63 0 13000' $testdir1/original/file1 \
>> $seqres.full 2>&1
$XFS_IO_PROG -c 'pwrite -S 0x64 5000 1000' \
$TESTDIR1/original/subdir/file2 >> $seqres.full 2>&1
$testdir1/original/subdir/file2 >> $seqres.full 2>&1
echo "md5sums now:"
_checksum_files
echo "Overwrite copy1/file1 and copy1/subdir/file2 with new data"
$XFS_IO_PROG -c 'pwrite -S 0x65 0 9000' $TESTDIR1/copy1/file1 \
$XFS_IO_PROG -c 'pwrite -S 0x65 0 9000' $testdir1/copy1/file1 \
>> $seqres.full 2>&1
$XFS_IO_PROG -c 'pwrite -S 0x66 5000 25000' \
$TESTDIR1/copy1/subdir/file2 >> $seqres.full 2>&1
$testdir1/copy1/subdir/file2 >> $seqres.full 2>&1
echo "md5sums now:"
_checksum_files
+17 -17
View File
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.* "$TESTDIR"
rm -f $tmp.* "$testdir"
}
# get standard environment, filters and checks
@@ -53,31 +53,31 @@ _require_test
rm -f $seqres.full
TESTDIR1=$TEST_DIR/test-$seq
rm -rf $TESTDIR1
mkdir $TESTDIR1
testdir1=$TEST_DIR/test-$seq
rm -rf $testdir1
mkdir $testdir1
echo "Create the original files and reflink dirs"
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \
>> $seqres.full
cp --reflink $TESTDIR1/original $TESTDIR1/copy
cp --reflink $testdir1/original $testdir1/copy
_verify_reflink $TESTDIR1/original $TESTDIR1/copy
_verify_reflink $testdir1/original $testdir1/copy
echo "Move orig & reflink copy to subdir and md5sum:"
mkdir $TESTDIR1/subdir
mv $TESTDIR1/original $TESTDIR1/subdir/original_moved
mv $TESTDIR1/copy $TESTDIR1/subdir/copy_moved
_verify_reflink $TESTDIR1/subdir/original_moved \
$TESTDIR1/subdir/copy_moved
mkdir $testdir1/subdir
mv $testdir1/original $testdir1/subdir/original_moved
mv $testdir1/copy $testdir1/subdir/copy_moved
_verify_reflink $testdir1/subdir/original_moved \
$testdir1/subdir/copy_moved
md5sum $TESTDIR1/subdir/original_moved | _filter_test_dir
md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
md5sum $testdir1/subdir/original_moved | _filter_test_dir
md5sum $testdir1/subdir/copy_moved | _filter_test_dir
echo "remove orig from subdir and md5sum reflink copy:"
rm $TESTDIR1/subdir/original_moved
md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir
rm -rf $TESTDIR1/subdir
rm $testdir1/subdir/original_moved
md5sum $testdir1/subdir/copy_moved | _filter_test_dir
rm -rf $testdir1/subdir
# success, all done
status=0
+21 -21
View File
@@ -34,7 +34,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
@@ -48,43 +48,43 @@ _require_test_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
|| echo "Files do not match"
echo "Reflink the middle blocks together"
free_before="$(stat -f -c '%a' "$TESTDIR")"
_reflink_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
free_before="$(stat -f -c '%a' "$testdir")"
_reflink_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
_test_remount
free_after="$(stat -f -c '%a' "$TESTDIR")"
free_after="$(stat -f -c '%a' "$testdir")"
echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
|| echo "Start sections do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) \
|| echo "Middle sections do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
$((BLKSZ * 6)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
$((blksz * 6)) $((blksz * 2)) \
|| echo "End sections do not match"
# success, all done
+21 -21
View File
@@ -35,7 +35,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
@@ -49,43 +49,43 @@ _require_test_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
|| echo "Files do not match (intentional)"
echo "Reflink the middle blocks together"
free_before="$(stat -f -c '%a' "$TESTDIR")"
_reflink_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
free_before="$(stat -f -c '%a' "$testdir")"
_reflink_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
_test_remount
free_after="$(stat -f -c '%a' "$TESTDIR")"
free_after="$(stat -f -c '%a' "$testdir")"
echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
|| echo "Start sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) \
|| echo "Middle sections do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
$((BLKSZ * 6)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
$((blksz * 6)) $((blksz * 2)) \
|| echo "End sections do not match (intentional)"
# success, all done
+56 -56
View File
@@ -36,7 +36,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
@@ -50,119 +50,119 @@ _require_test_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ * 8)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 0 $((BLKSZ * 8)) "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x63 0 $((BLKSZ * 8)) "$TESTDIR/file3" >> "$seqres.full"
_pwrite_byte 0x64 0 $((BLKSZ * 8)) "$TESTDIR/file4" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz * 8)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 0 $((blksz * 8)) "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x63 0 $((blksz * 8)) "$testdir/file3" >> "$seqres.full"
_pwrite_byte 0x64 0 $((blksz * 8)) "$testdir/file4" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
|| echo "Files 1-2 do not match (intentional)"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 8)) \
_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 8)) \
|| echo "Files 1-3 do not match (intentional)"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 8)) \
_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 8)) \
|| echo "Files 1-4 do not match (intentional)"
echo "Reflink the first four blocks together, 1-2 3-4"
free_before="$(stat -f -c '%a' "$TESTDIR")"
_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) >> "$seqres.full"
_reflink_range "$TESTDIR/file3" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) >> "$seqres.full"
free_before="$(stat -f -c '%a' "$testdir")"
_reflink_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) >> "$seqres.full"
_reflink_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 4)) >> "$seqres.full"
_test_remount
free_after="$(stat -f -c '%a' "$TESTDIR")"
free_after="$(stat -f -c '%a' "$testdir")"
echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
|| echo "Sections of file 1-2 do not match"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 4)) \
|| echo "Sections of file 1-3 do not match (intentional)"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 4)) \
|| echo "Sections of file 1-4 do not match (intentional)"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $((blksz * 4)) \
|| echo "Sections of file 2-3 do not match (intentional)"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file2" 0 "$testdir/file4" 0 $((blksz * 4)) \
|| echo "Sections of file 2-4 do not match (intentional)"
_compare_range "$TESTDIR/file3" 0 "$TESTDIR/file4" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 4)) \
|| echo "Sections of file 3-4 do not match"
echo "Reflink the first two blocks together, 1-3 1-4"
free_before="$(stat -f -c '%a' $TESTDIR)"
_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 2)) >> "$seqres.full"
_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) >> "$seqres.full"
free_before="$(stat -f -c '%a' $testdir)"
_reflink_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 2)) >> "$seqres.full"
_reflink_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 2)) >> "$seqres.full"
_test_remount
free_after="$(stat -f -c '%a' $TESTDIR)"
free_after="$(stat -f -c '%a' $testdir)"
echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 2)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 2)) \
|| echo "Sections of files 1-2 do not match"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $((BLKSZ * 2)) \
_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $((blksz * 2)) \
|| echo "Sections of files 1-3 do not match"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) \
_compare_range "$testdir/file1" 0 "$testdir/file4" 0 $((blksz * 2)) \
|| echo "Sections of files 1-4 do not match"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 $((BLKSZ * 2)) \
_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $((blksz * 2)) \
|| echo "Sections of files 2-3 do not match"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) \
_compare_range "$testdir/file2" 0 "$testdir/file4" 0 $((blksz * 2)) \
|| echo "Sections of files 2-4 do not match"
_compare_range "$TESTDIR/file3" 0 "$TESTDIR/file4" 0 $((BLKSZ * 2)) \
_compare_range "$testdir/file3" 0 "$testdir/file4" 0 $((blksz * 2)) \
|| echo "Sections of files 3-4 do not match"
echo "Compare previously reflinked sections"
_compare_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file2" \
$((BLKSZ * 2)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file2" \
$((blksz * 2)) $((blksz * 2)) \
|| echo "Sections of file 1-2 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file3" \
$((BLKSZ * 2)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file3" \
$((blksz * 2)) $((blksz * 2)) \
|| echo "Sections of file 1-3 do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file4" \
$((BLKSZ * 2)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 2)) "$testdir/file4" \
$((blksz * 2)) $((blksz * 2)) \
|| echo "Sections of file 1-4 do not match (intentional)"
_compare_range "$TESTDIR/file2" $((BLKSZ * 2)) "$TESTDIR/file3" \
$((BLKSZ * 2)) $((BLKSZ * 2)) \
_compare_range "$testdir/file2" $((blksz * 2)) "$testdir/file3" \
$((blksz * 2)) $((blksz * 2)) \
|| echo "Sections of file 2-3 do not match (intentional)"
_compare_range "$TESTDIR/file2" $((BLKSZ * 2)) "$TESTDIR/file4" \
$((BLKSZ * 2)) $((BLKSZ * 2)) \
_compare_range "$testdir/file2" $((blksz * 2)) "$testdir/file4" \
$((blksz * 2)) $((blksz * 2)) \
|| echo "Sections of file 2-4 do not match (intentional)"
_compare_range "$TESTDIR/file3" $((BLKSZ * 2)) "$TESTDIR/file4" \
$((BLKSZ * 2)) $((BLKSZ * 2)) \
_compare_range "$testdir/file3" $((blksz * 2)) "$testdir/file4" \
$((blksz * 2)) $((blksz * 2)) \
|| echo "Sections of file 3-4 do not match"
# success, all done
+21 -21
View File
@@ -34,7 +34,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
@@ -48,43 +48,43 @@ _require_test_dedupe
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 files"
BLKSZ=65536
_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 8)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 8)) \
|| echo "Files 1-2 do not match (intentional)"
echo "Dedupe the middle blocks together"
free_before="$(stat -f -c '%a' "$TESTDIR")"
_dedupe_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
free_before="$(stat -f -c '%a' "$testdir")"
_dedupe_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
_test_remount
free_after="$(stat -f -c '%a' "$TESTDIR")"
free_after="$(stat -f -c '%a' "$testdir")"
echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
|| echo "Start sections do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) \
|| echo "Middle sections do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
$((BLKSZ * 6)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
$((blksz * 6)) $((blksz * 2)) \
|| echo "End sections do not match"
# success, all done
+21 -21
View File
@@ -34,7 +34,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
@@ -48,43 +48,43 @@ _require_test_dedupe
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 files"
BLKSZ=65536
_pwrite_byte 0x61 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 2)) $((BLKSZ * 6)) "$TESTDIR/file2" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 $((blksz * 2)) $((blksz * 6)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 2)) $((blksz * 6)) "$testdir/file2" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 "$((BLKSZ * 8))" \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 "$((blksz * 8))" \
|| echo "Files 1-2 do not match (intentional)"
echo "(Fail to) dedupe the middle blocks together"
free_before="$(stat -f -c '%a' "$TESTDIR")"
_dedupe_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) >> "$seqres.full"
free_before="$(stat -f -c '%a' "$testdir")"
_dedupe_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) >> "$seqres.full"
_test_remount
free_after="$(stat -f -c '%a' "$TESTDIR")"
free_after="$(stat -f -c '%a' "$testdir")"
echo "freesp changed by $free_before -> $free_after" >> "$seqres.full"
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $((BLKSZ * 4)) \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $((blksz * 4)) \
|| echo "Start sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 4)) "$TESTDIR/file2" \
$((BLKSZ * 4)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 4)) "$testdir/file2" \
$((blksz * 4)) $((blksz * 2)) \
|| echo "Middle sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 6)) "$TESTDIR/file2" \
$((BLKSZ * 6)) $((BLKSZ * 2)) \
_compare_range "$testdir/file1" $((blksz * 6)) "$testdir/file2" \
$((blksz * 6)) $((blksz * 2)) \
|| echo "End sections do not match (intentional)"
# success, all done
+45 -45
View File
@@ -38,7 +38,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,75 +52,75 @@ _require_test_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file3" >> "$seqres.full"
_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file4" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file3" >> "$seqres.full"
_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file4" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
C1="$(_md5_checksum $TESTDIR/file1)"
C2="$(_md5_checksum $TESTDIR/file2)"
C3="$(_md5_checksum $TESTDIR/file3)"
C4="$(_md5_checksum $TESTDIR/file4)"
c1="$(_md5_checksum $testdir/file1)"
c2="$(_md5_checksum $testdir/file2)"
c3="$(_md5_checksum $testdir/file3)"
c4="$(_md5_checksum $testdir/file4)"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" = "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" = "${c4}" || echo "file3 and file4 should match"
echo "Reflink the last blocks together, 1-2 1-3"
_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 >> "$seqres.full"
_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 >> "$seqres.full"
_reflink_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 >> "$seqres.full"
_reflink_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
C1="$(_md5_checksum $TESTDIR/file1)"
C2="$(_md5_checksum $TESTDIR/file2)"
C3="$(_md5_checksum $TESTDIR/file3)"
C4="$(_md5_checksum $TESTDIR/file4)"
c1="$(_md5_checksum $testdir/file1)"
c2="$(_md5_checksum $testdir/file2)"
c3="$(_md5_checksum $testdir/file3)"
c4="$(_md5_checksum $testdir/file4)"
echo "Compare files"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" != "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" != "${c4}" || echo "file3 and file4 should match"
echo "Compare sections"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 \
_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 \
|| echo "End sections of files 1-2 do not match"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
_compare_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 \
|| echo "End sections of files 1-3 do not match"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz 37 \
|| echo "End sections of files 1-4 do not match (intentional)"
_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 37 \
|| echo "End sections of files 2-3 do not match"
_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
_compare_range "$testdir/file2" $blksz "$testdir/file4" $blksz 37 \
|| echo "End sections of files 2-4 do not match (intentional)"
_compare_range "$TESTDIR/file3" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
_compare_range "$testdir/file3" $blksz "$testdir/file4" $blksz 37 \
|| echo "End sections of files 3-4 do not match (intentional)"
# success, all done
+45 -45
View File
@@ -38,7 +38,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,77 +52,77 @@ _require_test_dedupe
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x61 0 $((BLKSZ + 37)) "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file3" >> "$seqres.full"
_pwrite_byte 0x62 0 $((BLKSZ + 37)) "$TESTDIR/file4" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x61 0 $((blksz + 37)) "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file3" >> "$seqres.full"
_pwrite_byte 0x62 0 $((blksz + 37)) "$testdir/file4" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
C1="$(_md5_checksum $TESTDIR/file1)"
C2="$(_md5_checksum $TESTDIR/file2)"
C3="$(_md5_checksum $TESTDIR/file3)"
C4="$(_md5_checksum $TESTDIR/file4)"
c1="$(_md5_checksum $testdir/file1)"
c2="$(_md5_checksum $testdir/file2)"
c3="$(_md5_checksum $testdir/file3)"
c4="$(_md5_checksum $testdir/file4)"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" = "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" = "${c4}" || echo "file3 and file4 should match"
echo "Dedupe the last blocks together"
echo "1->2"
_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 >> "$seqres.full"
_dedupe_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 >> "$seqres.full"
echo "1->3"
_dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 >> "$seqres.full"
_dedupe_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
C1="$(_md5_checksum $TESTDIR/file1)"
C2="$(_md5_checksum $TESTDIR/file2)"
C3="$(_md5_checksum $TESTDIR/file3)"
C4="$(_md5_checksum $TESTDIR/file4)"
c1="$(_md5_checksum $testdir/file1)"
c2="$(_md5_checksum $testdir/file2)"
c3="$(_md5_checksum $testdir/file3)"
c4="$(_md5_checksum $testdir/file4)"
echo "Compare files"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" = "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" = "${c4}" || echo "file3 and file4 should match"
echo "Compare sections"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 \
_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 37 \
|| echo "End sections of files 1-2 do not match"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
_compare_range "$testdir/file1" $blksz "$testdir/file3" $blksz 37 \
|| echo "End sections of files 1-3 do not match (intentional)"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz 37 \
|| echo "End sections of files 1-4 do not match (intentional)"
_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 \
_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 37 \
|| echo "End sections of files 2-3 do not match (intentional)"
_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
_compare_range "$testdir/file2" $blksz "$testdir/file4" $blksz 37 \
|| echo "End sections of files 2-4 do not match (intentional)"
_compare_range "$TESTDIR/file3" $BLKSZ "$TESTDIR/file4" $BLKSZ 37 \
_compare_range "$testdir/file3" $blksz "$testdir/file4" $blksz 37 \
|| echo "End sections of files 3-4 do not match"
# success, all done
+27 -27
View File
@@ -38,7 +38,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
@@ -54,47 +54,47 @@ _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=65536
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $((BLKSZ * 2)) "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $((blksz * 2)) "$testdir/file1" >> "$seqres.full"
NR_BLKS=1024
nr_blks=1024
echo "fallocate half the file"
"$XFS_IO_PROG" -f -c "falloc $((NR_BLKS * BLKSZ / 2)) $((NR_BLKS * BLKSZ / 2))" "$TESTDIR/file1" >> "$seqres.full"
"$XFS_IO_PROG" -f -c "falloc $((nr_blks * blksz / 2)) $((nr_blks * blksz / 2))" "$testdir/file1" >> "$seqres.full"
echo "Reflink block zero to the threes"
seq 1 $((NR_BLKS / 3)) | while read nr; do
_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file1" $((nr * 3 * BLKSZ)) \
$BLKSZ >> "$seqres.full"
seq 1 $((nr_blks / 3)) | while read nr; do
_reflink_range "$testdir/file1" 0 "$testdir/file1" $((nr * 3 * blksz)) \
$blksz >> "$seqres.full"
done
echo "Reflink block one to the fives"
seq 1 $((NR_BLKS / 5)) | while read nr; do
_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file1" \
$((nr * 5 * BLKSZ)) $BLKSZ >> "$seqres.full"
seq 1 $((nr_blks / 5)) | while read nr; do
_reflink_range "$testdir/file1" $blksz "$testdir/file1" \
$((nr * 5 * blksz)) $blksz >> "$seqres.full"
done
echo "Dedupe block two to the sevens"
seq 1 $((NR_BLKS / 7)) | while read nr; do
_dedupe_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file1" \
$((nr * 7 * BLKSZ)) $BLKSZ >> "$seqres.full" 2>&1
seq 1 $((nr_blks / 7)) | while read nr; do
_dedupe_range "$testdir/file1" $((blksz * 2)) "$testdir/file1" \
$((nr * 7 * blksz)) $blksz >> "$seqres.full" 2>&1
done
_test_remount
echo "Check block mappings"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
crcZ=$(_md5_range_checksum /dev/zero 0 $BLKSZ)
crc0=$(_md5_range_checksum "$TESTDIR/file1" 0 $BLKSZ)
crc1=$(_md5_range_checksum "$TESTDIR/file1" $BLKSZ $BLKSZ)
crc2=$(_md5_range_checksum "$TESTDIR/file1" $((BLKSZ * 2)) $BLKSZ)
crcZ=$(_md5_range_checksum /dev/zero 0 $blksz)
crc0=$(_md5_range_checksum "$testdir/file1" 0 $blksz)
crc1=$(_md5_range_checksum "$testdir/file1" $blksz $blksz)
crc2=$(_md5_range_checksum "$testdir/file1" $((blksz * 2)) $blksz)
check_block() {
lblk="$1"
@@ -102,26 +102,26 @@ check_block() {
rem5=$((lblk % 5))
rem3=$((lblk % 3))
crc=$(_md5_range_checksum "$TESTDIR/file1" $((lblk * BLKSZ)) $BLKSZ)
crc=$(_md5_range_checksum "$testdir/file1" $((lblk * blksz)) $blksz)
if [ $rem7 -eq 0 ]; then
if [ $rem5 -eq 0 ]; then
test $crc2 = $crc || echo "lblk $lblk doesn't match block 2"
elif [ $rem3 -eq 0 ]; then
test $crc0 = $crc || echo "lblk $lblk doesn't match block 0"
elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
elif [ $lblk -lt $((nr_blks / 2)) ]; then
test $crcZ = $crc || echo "lblk $lblk isn't zeroed"
fi
elif [ $rem5 -eq 0 ]; then
test $crc1 = $crc || echo "lblk $lblk doesn't match block 1"
elif [ $rem3 -eq 0 ]; then
test $crc0 = $crc || echo "lblk $lblk doesn't match block 0"
elif [ $lblk -lt $((NR_BLKS / 2)) ]; then
elif [ $lblk -lt $((nr_blks / 2)) ]; then
test $crcZ = $crc || echo "lblk $lblk isn't zeroed"
fi
}
seq 3 $((NR_BLKS - 1)) | while read lblk; do
seq 3 $((nr_blks - 1)) | while read lblk; do
err="$(check_block $lblk)"
test -n "$err" && echo "$lblk: $err"
done
+50 -50
View File
@@ -35,7 +35,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
@@ -50,101 +50,101 @@ _require_cp_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file1" >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match"
cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match"
cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match"
cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match"
cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
echo "pagecache CoW the second file"
_pwrite_byte 0x62 0 17 "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x62 0 17 "$TESTDIR/file3" >> "$seqres.full"
_pwrite_byte 0x62 0 17 "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x62 0 17 "$testdir/file3" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 "$TESTDIR/file3" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 16 - 34)) 17 "$testdir/file3" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 48 - 8)) 17 "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 48 - 8)) 17 "$TESTDIR/file3" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 48 - 8)) 17 "$testdir/file3" >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match (intentional)"
cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match (intentional)"
cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match (intentional)"
cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match (intentional)"
cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
echo "Compare the CoW'd section to the before file"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 17 \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 17 \
|| echo "Start sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16 - 34)) \
"$TESTDIR/file2" $((BLKSZ * 16 - 34)) 17 \
_compare_range "$testdir/file1" $((blksz * 16 - 34)) \
"$testdir/file2" $((blksz * 16 - 34)) 17 \
|| echo "Middle sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 48 - 8)) \
"$TESTDIR/file2" $((BLKSZ * 48 - 8)) 17 \
_compare_range "$testdir/file1" $((blksz * 48 - 8)) \
"$testdir/file2" $((blksz * 48 - 8)) 17 \
|| echo "End sections do not match (intentional)"
echo "Compare the CoW'd section to the after file"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 17 \
_compare_range "$testdir/file2" 0 "$testdir/file3" 0 17 \
|| echo "Start sections do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16 - 34)) \
"$TESTDIR/file3" $((BLKSZ * 16 - 34)) 17 \
_compare_range "$testdir/file2" $((blksz * 16 - 34)) \
"$testdir/file3" $((blksz * 16 - 34)) 17 \
|| echo "Middle sections do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 48 - 8)) \
"$TESTDIR/file3" $((BLKSZ * 48 - 8)) 17 \
_compare_range "$testdir/file2" $((blksz * 48 - 8)) \
"$testdir/file3" $((blksz * 48 - 8)) 17 \
|| echo "End sections do not match"
echo "Compare the not CoW'd sections"
_compare_range "$TESTDIR/file1" 18 "$TESTDIR/file2" 18 17 \
_compare_range "$testdir/file1" 18 "$testdir/file2" 18 17 \
|| echo "Start sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" 18 "$TESTDIR/file3" 18 17 \
_compare_range "$testdir/file2" 18 "$testdir/file3" 18 17 \
|| echo "Start sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16 - 17)) \
"$TESTDIR/file2" $((BLKSZ * 16 - 17)) 82 \
_compare_range "$testdir/file1" $((blksz * 16 - 17)) \
"$testdir/file2" $((blksz * 16 - 17)) 82 \
|| echo "Middle sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16 - 17)) \
"$TESTDIR/file3" $((BLKSZ * 16 - 17)) 82 \
_compare_range "$testdir/file2" $((blksz * 16 - 17)) \
"$testdir/file3" $((blksz * 16 - 17)) 82 \
|| echo "Middle sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 48 - 108)) \
"$TESTDIR/file2" $((BLKSZ * 48 - 108)) 100 \
_compare_range "$testdir/file1" $((blksz * 48 - 108)) \
"$testdir/file2" $((blksz * 48 - 108)) 100 \
|| echo "End sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 48 - 108)) \
"$TESTDIR/file3" $((BLKSZ * 48 - 108)) 100 \
_compare_range "$testdir/file2" $((blksz * 48 - 108)) \
"$testdir/file3" $((blksz * 48 - 108)) 100 \
|| echo "End sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 14)) \
"$TESTDIR/file2" $((BLKSZ * 14)) $BLKSZ \
_compare_range "$testdir/file1" $((blksz * 14)) \
"$testdir/file2" $((blksz * 14)) $blksz \
|| echo "Untouched sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 14)) \
"$TESTDIR/file3" $((BLKSZ * 14)) $BLKSZ \
_compare_range "$testdir/file2" $((blksz * 14)) \
"$testdir/file3" $((blksz * 14)) $blksz \
|| echo "Untouched sections of 2-3 do not match"
# success, all done
+50 -50
View File
@@ -35,7 +35,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
@@ -50,100 +50,100 @@ _require_cp_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file1" >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 should match"
cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 should match"
cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 should match"
cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 should match"
cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 should match"
cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 should match"
echo "directio CoW the second file"
_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file2" -d >> "$seqres.full"
_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file3" -d >> "$seqres.full"
_pwrite_byte 0x62 0 $blksz "$testdir/file2" -d >> "$seqres.full"
_pwrite_byte 0x62 0 $blksz "$testdir/file3" -d >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 16 - 512)) 512 "$TESTDIR/file2" -d >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 16 - 512)) 512 "$TESTDIR/file3" -d >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 "$testdir/file2" -d >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 16 - 512)) 512 "$testdir/file3" -d >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 48)) $BLKSZ "$TESTDIR/file2" -d >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 48)) $BLKSZ "$TESTDIR/file3" -d >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 48)) $blksz "$testdir/file2" -d >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 48)) $blksz "$testdir/file3" -d >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 should not match (intentional)"
cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 should not match (intentional)"
cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 should match"
cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 should not match (intentional)"
cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 should not match (intentional)"
cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 should match"
echo "Compare the CoW'd section to the before file"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 $BLKSZ \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 $blksz \
|| echo "Start sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16 - 512)) \
"$TESTDIR/file2" $((BLKSZ * 16 - 512)) 512 \
_compare_range "$testdir/file1" $((blksz * 16 - 512)) \
"$testdir/file2" $((blksz * 16 - 512)) 512 \
|| echo "Middle sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 48 - 512)) \
"$TESTDIR/file2" $((BLKSZ * 48 - 512)) $BLKSZ \
_compare_range "$testdir/file1" $((blksz * 48 - 512)) \
"$testdir/file2" $((blksz * 48 - 512)) $blksz \
|| echo "End sections do not match (intentional)"
echo "Compare the CoW'd section to the after file"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 $BLKSZ \
_compare_range "$testdir/file2" 0 "$testdir/file3" 0 $blksz \
|| echo "Start sections do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16 - 512)) \
"$TESTDIR/file3" $((BLKSZ * 16 - 512)) 512 \
_compare_range "$testdir/file2" $((blksz * 16 - 512)) \
"$testdir/file3" $((blksz * 16 - 512)) 512 \
|| echo "Middle sections do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 48 - 512)) \
"$TESTDIR/file3" $((BLKSZ * 48 - 512)) $BLKSZ \
_compare_range "$testdir/file2" $((blksz * 48 - 512)) \
"$testdir/file3" $((blksz * 48 - 512)) $blksz \
|| echo "End sections do not match"
echo "Compare the not CoW'd sections"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 512 \
_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz 512 \
|| echo "Start sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $BLKSZ "$TESTDIR/file3" $BLKSZ 512 \
_compare_range "$testdir/file2" $blksz "$testdir/file3" $blksz 512 \
|| echo "Start sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16 - 1024)) \
"$TESTDIR/file2" $((BLKSZ * 16 - 1024)) 512 \
_compare_range "$testdir/file1" $((blksz * 16 - 1024)) \
"$testdir/file2" $((blksz * 16 - 1024)) 512 \
|| echo "Middle sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16 - 1024)) \
"$TESTDIR/file3" $((BLKSZ * 16 - 1024)) 512 \
_compare_range "$testdir/file2" $((blksz * 16 - 1024)) \
"$testdir/file3" $((blksz * 16 - 1024)) 512 \
|| echo "Middle sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 48 - 1024)) \
"$TESTDIR/file2" $((BLKSZ * 48 - 1024)) 512 \
_compare_range "$testdir/file1" $((blksz * 48 - 1024)) \
"$testdir/file2" $((blksz * 48 - 1024)) 512 \
|| echo "End sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 48 - 1024)) \
"$TESTDIR/file3" $((BLKSZ * 48 - 1024)) 512 \
_compare_range "$testdir/file2" $((blksz * 48 - 1024)) \
"$testdir/file3" $((blksz * 48 - 1024)) 512 \
|| echo "End sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16)) \
"$TESTDIR/file2" $((BLKSZ * 16)) 512 \
_compare_range "$testdir/file1" $((blksz * 16)) \
"$testdir/file2" $((blksz * 16)) 512 \
|| echo "Untouched sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16)) \
"$TESTDIR/file3" $((BLKSZ * 16)) 512 \
_compare_range "$testdir/file2" $((blksz * 16)) \
"$testdir/file3" $((blksz * 16)) 512 \
|| echo "Untouched sections of 2-3 do not match"
# success, all done
+50 -50
View File
@@ -35,7 +35,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
@@ -50,101 +50,101 @@ _require_cp_reflink
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file1" >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" >> "$seqres.full"
_pwrite_byte 0x61 0 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file1" >> "$seqres.full"
_cp_reflink "$testdir/file1" "$testdir/file2" >> "$seqres.full"
_pwrite_byte 0x61 0 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match"
cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match"
cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match"
cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match"
cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
echo "mmap CoW the second file"
_mwrite_byte 0x62 0 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file2" >> "$seqres.full"
_mwrite_byte 0x62 0 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
_mwrite_byte 0x62 0 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
_mwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file2" >> "$seqres.full"
_mwrite_byte 0x62 $((BLKSZ * 16 - 34)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
_mwrite_byte 0x62 $((blksz * 16 - 34)) 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
_mwrite_byte 0x62 $((BLKSZ * 48 - 20)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file2" >> "$seqres.full"
_mwrite_byte 0x62 $((BLKSZ * 48 - 20)) 17 $((BLKSZ * 48 - 3)) "$TESTDIR/file3" >> "$seqres.full"
_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) "$testdir/file2" >> "$seqres.full"
_mwrite_byte 0x62 $((blksz * 48 - 20)) 17 $((blksz * 48 - 3)) "$testdir/file3" >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "Files 1-2 do not match (intentional)"
cmp -s "$TESTDIR/file1" "$TESTDIR/file3" || echo "Files 1-3 do not match (intentional)"
cmp -s "$TESTDIR/file2" "$TESTDIR/file3" || echo "Files 2-3 do not match"
cmp -s "$testdir/file1" "$testdir/file2" || echo "Files 1-2 do not match (intentional)"
cmp -s "$testdir/file1" "$testdir/file3" || echo "Files 1-3 do not match (intentional)"
cmp -s "$testdir/file2" "$testdir/file3" || echo "Files 2-3 do not match"
echo "Compare the CoW'd section to the before file"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file2" 0 17 \
_compare_range "$testdir/file1" 0 "$testdir/file2" 0 17 \
|| echo "Start sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16 - 34)) \
"$TESTDIR/file2" $((BLKSZ * 16 - 34)) 17 \
_compare_range "$testdir/file1" $((blksz * 16 - 34)) \
"$testdir/file2" $((blksz * 16 - 34)) 17 \
|| echo "Middle sections do not match (intentional)"
_compare_range "$TESTDIR/file1" $((BLKSZ * 48 - 20)) \
"$TESTDIR/file2" $((BLKSZ * 48 - 20)) 17 \
_compare_range "$testdir/file1" $((blksz * 48 - 20)) \
"$testdir/file2" $((blksz * 48 - 20)) 17 \
|| echo "End sections do not match (intentional)"
echo "Compare the CoW'd section to the after file"
_compare_range "$TESTDIR/file2" 0 "$TESTDIR/file3" 0 17 \
_compare_range "$testdir/file2" 0 "$testdir/file3" 0 17 \
|| echo "Start sections do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16 - 34)) \
"$TESTDIR/file3" $((BLKSZ * 16 - 34)) 17 \
_compare_range "$testdir/file2" $((blksz * 16 - 34)) \
"$testdir/file3" $((blksz * 16 - 34)) 17 \
|| echo "Middle sections do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 48 - 20)) \
"$TESTDIR/file3" $((BLKSZ * 48 - 20)) 17 \
_compare_range "$testdir/file2" $((blksz * 48 - 20)) \
"$testdir/file3" $((blksz * 48 - 20)) 17 \
|| echo "End sections do not match"
echo "Compare the not CoW'd sections"
_compare_range "$TESTDIR/file1" 18 "$TESTDIR/file2" 18 17 \
_compare_range "$testdir/file1" 18 "$testdir/file2" 18 17 \
|| echo "Start sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" 18 "$TESTDIR/file3" 18 17 \
_compare_range "$testdir/file2" 18 "$testdir/file3" 18 17 \
|| echo "Start sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 16 - 17)) \
"$TESTDIR/file2" $((BLKSZ * 16 - 17)) 82 \
_compare_range "$testdir/file1" $((blksz * 16 - 17)) \
"$testdir/file2" $((blksz * 16 - 17)) 82 \
|| echo "Middle sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 16 - 17)) \
"$TESTDIR/file3" $((BLKSZ * 16 - 17)) 82 \
_compare_range "$testdir/file2" $((blksz * 16 - 17)) \
"$testdir/file3" $((blksz * 16 - 17)) 82 \
|| echo "Middle sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 48 - 120)) \
"$TESTDIR/file2" $((BLKSZ * 48 - 120)) 100 \
_compare_range "$testdir/file1" $((blksz * 48 - 120)) \
"$testdir/file2" $((blksz * 48 - 120)) 100 \
|| echo "End sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 48 - 120)) \
"$TESTDIR/file3" $((BLKSZ * 48 - 120)) 100 \
_compare_range "$testdir/file2" $((blksz * 48 - 120)) \
"$testdir/file3" $((blksz * 48 - 120)) 100 \
|| echo "End sections of 2-3 do not match"
_compare_range "$TESTDIR/file1" $((BLKSZ * 14)) \
"$TESTDIR/file2" $((BLKSZ * 14)) $BLKSZ \
_compare_range "$testdir/file1" $((blksz * 14)) \
"$testdir/file2" $((blksz * 14)) $blksz \
|| echo "Untouched sections of 1-2 do not match"
_compare_range "$TESTDIR/file2" $((BLKSZ * 14)) \
"$TESTDIR/file3" $((BLKSZ * 14)) $BLKSZ \
_compare_range "$testdir/file2" $((blksz * 14)) \
"$testdir/file3" $((blksz * 14)) $blksz \
|| echo "Untouched sections of 2-3 do not match"
# success, all done
+17 -17
View File
@@ -37,7 +37,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,37 +52,37 @@ _require_cp_reflink
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=65536
NR=9
_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
nr=9
_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
csum="$(_md5_checksum "$TESTDIR/file1")"
md5sum "$testdir/file1" | _filter_test_dir
csum="$(_md5_checksum "$testdir/file1")"
echo "Create the reflink copies"
seq 2 $NR | while read i; do
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
seq 2 $nr | while read i; do
_cp_reflink "$testdir/file1" "$testdir/file$i"
done
_test_remount
echo "Rewrite the copies"
seq 2 $NR | while read i; do
_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file$i" >> "$seqres.full"
seq 2 $nr | while read i; do
_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" >> "$seqres.full"
done
_test_remount
echo "Examine original file"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
mod_csum="$(_md5_checksum "$TESTDIR/file2")"
new_csum="$(_md5_checksum "$TESTDIR/file1")"
mod_csum="$(_md5_checksum "$testdir/file2")"
new_csum="$(_md5_checksum "$testdir/file1")"
test "${csum}" != "${mod_csum}" || echo "checksums do not match"
test "${csum}" = "${new_csum}" || echo "checksums do not match"
+17 -17
View File
@@ -37,7 +37,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,37 +52,37 @@ _require_cp_reflink
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=65536
NR=9
_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
nr=9
_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
csum="$(_md5_checksum "$TESTDIR/file1")"
md5sum "$testdir/file1" | _filter_test_dir
csum="$(_md5_checksum "$testdir/file1")"
echo "Create the reflink copies"
seq 2 $NR | while read i; do
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i"
seq 2 $nr | while read i; do
_cp_reflink "$testdir/file1" "$testdir/file$i"
done
_test_remount
echo "Rewrite the copies"
seq 2 $NR | while read i; do
_pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file$i" -d >> "$seqres.full"
seq 2 $nr | while read i; do
_pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" -d >> "$seqres.full"
done
_test_remount
echo "Examine original file"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
mod_csum="$(_md5_checksum "$TESTDIR/file2")"
new_csum="$(_md5_checksum "$TESTDIR/file1")"
mod_csum="$(_md5_checksum "$testdir/file2")"
new_csum="$(_md5_checksum "$testdir/file1")"
test "${csum}" != "${mod_csum}" || echo "checksums do not match"
test "${csum}" = "${new_csum}" || echo "checksums do not match"
+58 -58
View File
@@ -35,7 +35,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,90 +52,90 @@ _require_xfs_io_command "truncate"
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $((BLKSZ * 5 + 37)) "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $((blksz * 5 + 37)) "$testdir/file1" >> "$seqres.full"
_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ \
$((BLKSZ * 4 + 37)) >> "$seqres.full"
_reflink_range "$testdir/file1" $blksz "$testdir/file2" $blksz \
$((blksz * 4 + 37)) >> "$seqres.full"
"$XFS_IO_PROG" -f -c "truncate $((BLKSZ * 5 + 37))" "$TESTDIR/file3" >> "$seqres.full"
_reflink_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $BLKSZ >> "$seqres.full"
"$XFS_IO_PROG" -f -c "truncate $((blksz * 5 + 37))" "$testdir/file3" >> "$seqres.full"
_reflink_range "$testdir/file1" 0 "$testdir/file3" 0 $blksz >> "$seqres.full"
"$XFS_IO_PROG" -f -c "truncate $((BLKSZ * 5 + 37))" "$TESTDIR/file4" >> "$seqres.full"
_reflink_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ $BLKSZ >> "$seqres.full"
_reflink_range "$TESTDIR/file1" $((BLKSZ * 3)) "$TESTDIR/file4" $((BLKSZ * 3)) \
$BLKSZ >> "$seqres.full"
"$XFS_IO_PROG" -f -c "truncate $((blksz * 5 + 37))" "$testdir/file4" >> "$seqres.full"
_reflink_range "$testdir/file1" $blksz "$testdir/file4" $blksz $blksz >> "$seqres.full"
_reflink_range "$testdir/file1" $((blksz * 3)) "$testdir/file4" $((blksz * 3)) \
$blksz >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file5"
_cp_reflink "$testdir/file1" "$testdir/file5"
_test_remount
echo "Compare sections"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file5" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file5" | _filter_test_dir
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ \
$((BLKSZ * 4 + 37)) \
_compare_range "$testdir/file1" $blksz "$testdir/file2" $blksz \
$((blksz * 4 + 37)) \
|| echo "shared parts of files 1-2 changed"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file3" 0 $BLKSZ \
_compare_range "$testdir/file1" 0 "$testdir/file3" 0 $blksz \
|| echo "shared parts of files 1-3 changed"
_compare_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file4" $BLKSZ $BLKSZ \
_compare_range "$testdir/file1" $blksz "$testdir/file4" $blksz $blksz \
|| echo "shared parts of files 1-4 changed"
_compare_range "$TESTDIR/file1" 0 "$TESTDIR/file5" 0 $((BLKSZ * 5 + 37)) \
_compare_range "$testdir/file1" 0 "$testdir/file5" 0 $((blksz * 5 + 37)) \
|| echo "shared parts of files 1-5 changed"
echo "Compare files"
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
C5="$(_md5_checksum "$TESTDIR/file5")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
c5="$(_md5_checksum "$testdir/file5")"
test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C1}" = "${C5}" || echo "file1 and file5 should match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C2}" != "${C5}" || echo "file2 and file5 should not match"
test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
test "${C3}" != "${C5}" || echo "file3 and file5 should not match"
test "${C4}" != "${C5}" || echo "file4 and file5 should not match"
test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c1}" = "${c5}" || echo "file1 and file5 should match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c2}" != "${c5}" || echo "file2 and file5 should not match"
test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
test "${c3}" != "${c5}" || echo "file3 and file5 should not match"
test "${c4}" != "${c5}" || echo "file4 and file5 should not match"
echo "falloc everything"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 5))" "$TESTDIR/file2" >> "$seqres.full"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 5))" "$TESTDIR/file3" >> "$seqres.full"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 5))" "$TESTDIR/file4" >> "$seqres.full"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file2" >> "$seqres.full"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file3" >> "$seqres.full"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 5))" "$testdir/file4" >> "$seqres.full"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file5" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file5" | _filter_test_dir
D1="$(_md5_checksum "$TESTDIR/file1")"
D2="$(_md5_checksum "$TESTDIR/file2")"
D3="$(_md5_checksum "$TESTDIR/file3")"
D4="$(_md5_checksum "$TESTDIR/file4")"
D5="$(_md5_checksum "$TESTDIR/file5")"
d1="$(_md5_checksum "$testdir/file1")"
d2="$(_md5_checksum "$testdir/file2")"
d3="$(_md5_checksum "$testdir/file3")"
d4="$(_md5_checksum "$testdir/file4")"
d5="$(_md5_checksum "$testdir/file5")"
test "${C1}" = "${D1}" || echo "file1 should not change"
test "${C2}" = "${D2}" || echo "file2 should not change"
test "${C3}" = "${D3}" || echo "file3 should not change"
test "${C4}" = "${D4}" || echo "file4 should not change"
test "${C5}" = "${D5}" || echo "file2 should not change"
test "${c1}" = "${d1}" || echo "file1 should not change"
test "${c2}" = "${d2}" || echo "file2 should not change"
test "${c3}" = "${d3}" || echo "file3 should not change"
test "${c4}" = "${d4}" || echo "file4 should not change"
test "${c5}" = "${d5}" || echo "file2 should not change"
# success, all done
status=0
+64 -64
View File
@@ -36,7 +36,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
@@ -53,89 +53,89 @@ _require_xfs_io_command "fcollapse"
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
_cp_reflink "$testdir/file1" "$testdir/file2"
_cp_reflink "$testdir/file1" "$testdir/file3"
_cp_reflink "$testdir/file1" "$testdir/file4"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file1"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file2"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file3"
"$XFS_IO_PROG" -f -c "falloc 0 $((BLKSZ * 4))" "$TESTDIR/file4"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file1"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file2"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file3"
"$XFS_IO_PROG" -f -c "falloc 0 $((blksz * 4))" "$testdir/file4"
_pwrite_byte 0x62 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x63 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x62 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x63 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x63 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x63 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file2.chk" | _filter_test_dir
md5sum "$TESTDIR/file3.chk" | _filter_test_dir
md5sum "$TESTDIR/file4.chk" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file2.chk" | _filter_test_dir
md5sum "$testdir/file3.chk" | _filter_test_dir
md5sum "$testdir/file4.chk" | _filter_test_dir
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" = "${C3}" || echo "file1 and file3 should match"
test "${C1}" = "${C4}" || echo "file1 and file4 should match"
test "${C2}" = "${C3}" || echo "file2 and file3 should match"
test "${C2}" = "${C4}" || echo "file2 and file4 should match"
test "${C3}" = "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" = "${c3}" || echo "file1 and file3 should match"
test "${c1}" = "${c4}" || echo "file1 and file4 should match"
test "${c2}" = "${c3}" || echo "file2 and file3 should match"
test "${c2}" = "${c4}" || echo "file2 and file4 should match"
test "${c3}" = "${c4}" || echo "file3 and file4 should match"
echo "fcollapse files"
"$XFS_IO_PROG" -f -c "fcollapse 0 $BLKSZ" "$TESTDIR/file2"
"$XFS_IO_PROG" -f -c "fcollapse $BLKSZ $BLKSZ" "$TESTDIR/file3"
"$XFS_IO_PROG" -f -c "fcollapse $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
"$XFS_IO_PROG" -f -c "fcollapse 0 $blksz" "$testdir/file2"
"$XFS_IO_PROG" -f -c "fcollapse $blksz $blksz" "$testdir/file3"
"$XFS_IO_PROG" -f -c "fcollapse $((blksz * 2)) $blksz" "$testdir/file4"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file2.chk" | _filter_test_dir
md5sum "$TESTDIR/file3.chk" | _filter_test_dir
md5sum "$TESTDIR/file4.chk" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file2.chk" | _filter_test_dir
md5sum "$testdir/file3.chk" | _filter_test_dir
md5sum "$testdir/file4.chk" | _filter_test_dir
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
echo "Compare against check files"
cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
# success, all done
status=0
+60 -60
View File
@@ -36,7 +36,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,84 +52,84 @@ _require_xfs_io_command "fpunch"
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
_cp_reflink "$testdir/file1" "$testdir/file2"
_cp_reflink "$testdir/file1" "$testdir/file3"
_cp_reflink "$testdir/file1" "$testdir/file4"
_pwrite_byte 0x00 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file2.chk" | _filter_test_dir
md5sum "$TESTDIR/file3.chk" | _filter_test_dir
md5sum "$TESTDIR/file4.chk" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file2.chk" | _filter_test_dir
md5sum "$testdir/file3.chk" | _filter_test_dir
md5sum "$testdir/file4.chk" | _filter_test_dir
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" = "${C3}" || echo "file1 and file3 should match"
test "${C1}" = "${C4}" || echo "file1 and file4 should match"
test "${C2}" = "${C3}" || echo "file2 and file3 should match"
test "${C2}" = "${C4}" || echo "file2 and file4 should match"
test "${C3}" = "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" = "${c3}" || echo "file1 and file3 should match"
test "${c1}" = "${c4}" || echo "file1 and file4 should match"
test "${c2}" = "${c3}" || echo "file2 and file3 should match"
test "${c2}" = "${c4}" || echo "file2 and file4 should match"
test "${c3}" = "${c4}" || echo "file3 and file4 should match"
echo "fpunch files"
"$XFS_IO_PROG" -f -c "fpunch 0 $BLKSZ" "$TESTDIR/file2"
"$XFS_IO_PROG" -f -c "fpunch $BLKSZ $BLKSZ" "$TESTDIR/file3"
"$XFS_IO_PROG" -f -c "fpunch $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
"$XFS_IO_PROG" -f -c "fpunch 0 $blksz" "$testdir/file2"
"$XFS_IO_PROG" -f -c "fpunch $blksz $blksz" "$testdir/file3"
"$XFS_IO_PROG" -f -c "fpunch $((blksz * 2)) $blksz" "$testdir/file4"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file2.chk" | _filter_test_dir
md5sum "$TESTDIR/file3.chk" | _filter_test_dir
md5sum "$TESTDIR/file4.chk" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file2.chk" | _filter_test_dir
md5sum "$testdir/file3.chk" | _filter_test_dir
md5sum "$testdir/file4.chk" | _filter_test_dir
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
echo "Compare against check files"
cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
# success, all done
status=0
+63 -63
View File
@@ -36,7 +36,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,87 +52,87 @@ _require_xfs_io_command "finsert"
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 files"
BLKSZ=65536
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full"
blksz=65536
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file1" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 2)) $blksz "$testdir/file1" >> "$seqres.full"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3"
_cp_reflink "$TESTDIR/file1" "$TESTDIR/file4"
_cp_reflink "$testdir/file1" "$testdir/file2"
_cp_reflink "$testdir/file1" "$testdir/file3"
_cp_reflink "$testdir/file1" "$testdir/file4"
_pwrite_byte 0x00 0 $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x61 $BLKSZ $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full"
_pwrite_byte 0x00 0 $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x61 $blksz $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 2)) $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file2.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x00 $BLKSZ $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x62 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x00 $blksz $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x62 $((blksz * 2)) $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file3.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x62 $BLKSZ $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((BLKSZ * 2)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((BLKSZ * 3)) $BLKSZ "$TESTDIR/file4.chk" >> "$seqres.full"
_pwrite_byte 0x61 0 $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x62 $blksz $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x00 $((blksz * 2)) $blksz "$testdir/file4.chk" >> "$seqres.full"
_pwrite_byte 0x63 $((blksz * 3)) $blksz "$testdir/file4.chk" >> "$seqres.full"
_test_remount
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file2.chk" | _filter_test_dir
md5sum "$TESTDIR/file3.chk" | _filter_test_dir
md5sum "$TESTDIR/file4.chk" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file2.chk" | _filter_test_dir
md5sum "$testdir/file3.chk" | _filter_test_dir
md5sum "$testdir/file4.chk" | _filter_test_dir
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
test "${C1}" = "${C2}" || echo "file1 and file2 should match"
test "${C1}" = "${C3}" || echo "file1 and file3 should match"
test "${C1}" = "${C4}" || echo "file1 and file4 should match"
test "${C2}" = "${C3}" || echo "file2 and file3 should match"
test "${C2}" = "${C4}" || echo "file2 and file4 should match"
test "${C3}" = "${C4}" || echo "file3 and file4 should match"
test "${c1}" = "${c2}" || echo "file1 and file2 should match"
test "${c1}" = "${c3}" || echo "file1 and file3 should match"
test "${c1}" = "${c4}" || echo "file1 and file4 should match"
test "${c2}" = "${c3}" || echo "file2 and file3 should match"
test "${c2}" = "${c4}" || echo "file2 and file4 should match"
test "${c3}" = "${c4}" || echo "file3 and file4 should match"
echo "finsert files"
"$XFS_IO_PROG" -f -c "finsert 0 $BLKSZ" "$TESTDIR/file2"
"$XFS_IO_PROG" -f -c "finsert $BLKSZ $BLKSZ" "$TESTDIR/file3"
"$XFS_IO_PROG" -f -c "finsert $((BLKSZ * 2)) $BLKSZ" "$TESTDIR/file4"
"$XFS_IO_PROG" -f -c "finsert 0 $blksz" "$testdir/file2"
"$XFS_IO_PROG" -f -c "finsert $blksz $blksz" "$testdir/file3"
"$XFS_IO_PROG" -f -c "finsert $((blksz * 2)) $blksz" "$testdir/file4"
_test_remount
echo "Compare files"
md5sum "$TESTDIR/file1" | _filter_test_dir
md5sum "$TESTDIR/file2" | _filter_test_dir
md5sum "$TESTDIR/file3" | _filter_test_dir
md5sum "$TESTDIR/file4" | _filter_test_dir
md5sum "$TESTDIR/file2.chk" | _filter_test_dir
md5sum "$TESTDIR/file3.chk" | _filter_test_dir
md5sum "$TESTDIR/file4.chk" | _filter_test_dir
md5sum "$testdir/file1" | _filter_test_dir
md5sum "$testdir/file2" | _filter_test_dir
md5sum "$testdir/file3" | _filter_test_dir
md5sum "$testdir/file4" | _filter_test_dir
md5sum "$testdir/file2.chk" | _filter_test_dir
md5sum "$testdir/file3.chk" | _filter_test_dir
md5sum "$testdir/file4.chk" | _filter_test_dir
C1="$(_md5_checksum "$TESTDIR/file1")"
C2="$(_md5_checksum "$TESTDIR/file2")"
C3="$(_md5_checksum "$TESTDIR/file3")"
C4="$(_md5_checksum "$TESTDIR/file4")"
c1="$(_md5_checksum "$testdir/file1")"
c2="$(_md5_checksum "$testdir/file2")"
c3="$(_md5_checksum "$testdir/file3")"
c4="$(_md5_checksum "$testdir/file4")"
test "${C1}" != "${C2}" || echo "file1 and file2 should not match"
test "${C1}" != "${C3}" || echo "file1 and file3 should not match"
test "${C1}" != "${C4}" || echo "file1 and file4 should not match"
test "${C2}" != "${C3}" || echo "file2 and file3 should not match"
test "${C2}" != "${C4}" || echo "file2 and file4 should not match"
test "${C3}" != "${C4}" || echo "file3 and file4 should not match"
test "${c1}" != "${c2}" || echo "file1 and file2 should not match"
test "${c1}" != "${c3}" || echo "file1 and file3 should not match"
test "${c1}" != "${c4}" || echo "file1 and file4 should not match"
test "${c2}" != "${c3}" || echo "file2 and file3 should not match"
test "${c2}" != "${c4}" || echo "file2 and file4 should not match"
test "${c3}" != "${c4}" || echo "file3 and file4 should not match"
echo "Compare against check files"
cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match"
cmp -s "$TESTDIR/file3" "$TESTDIR/file3.chk" || echo "file3 and file3.chk do not match"
cmp -s "$TESTDIR/file4" "$TESTDIR/file4.chk" || echo "file4 and file4.chk do not match"
cmp -s "$testdir/file2" "$testdir/file2.chk" || echo "file2 and file2.chk do not match"
cmp -s "$testdir/file3" "$testdir/file3.chk" || echo "file3 and file3.chk do not match"
cmp -s "$testdir/file4" "$testdir/file4.chk" || echo "file4 and file4.chk do not match"
# success, all done
status=0

Some files were not shown because too many files have changed in this diff Show More