mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
reflink: fix style problems in existing tests
Fix style problems such as unnecessary use of quotes, add helper variables to reduce visual clutter, and other minor fixes to make the first batch of tests more closely resemble the second round tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
+22
-21
@@ -33,8 +33,8 @@
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
seq=`basename "$0"`
|
||||
seqres="$RESULT_DIR/$seq"
|
||||
seq=`basename $0`
|
||||
seqres=$RESULT_DIR/$seq
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
@@ -45,7 +45,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
|
||||
@@ -64,49 +64,50 @@ _require_test_reflink
|
||||
_require_cp_reflink
|
||||
_require_xfs_io_command "falloc"
|
||||
|
||||
rm -f "$seqres.full"
|
||||
rm -f $seqres.full
|
||||
|
||||
testdir="$TEST_DIR/test-$seq"
|
||||
rm -rf "$testdir"
|
||||
mkdir "$testdir"
|
||||
testdir=$TEST_DIR/test-$seq
|
||||
rm -rf $testdir
|
||||
mkdir $testdir
|
||||
|
||||
echo "Create the original file blocks"
|
||||
blksz="$(stat -f "$testdir" -c '%S')"
|
||||
blksz="$(stat -f $testdir -c '%S')"
|
||||
blks=2000
|
||||
margin='15%'
|
||||
sz=$((blksz * blks))
|
||||
free_blocks0=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks0=$(stat -f $testdir -c '%f')
|
||||
nr=4
|
||||
_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
filesize=$((blksz * nr))
|
||||
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
|
||||
_test_remount
|
||||
|
||||
echo "Create the reflink copies"
|
||||
for i in `seq 2 $nr`; do
|
||||
_cp_reflink "$testdir/file1" "$testdir/file$i"
|
||||
_cp_reflink $testdir/file1 $testdir/file$i
|
||||
done
|
||||
_test_remount
|
||||
free_blocks1=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks1=$(stat -f $testdir -c '%f')
|
||||
|
||||
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
|
||||
|
||||
echo "funshare some of the copies"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file2"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file3"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file2
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file3
|
||||
_test_remount
|
||||
free_blocks2=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks2=$(stat -f $testdir -c '%f')
|
||||
|
||||
echo "funshare the rest of the files"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file4"
|
||||
"$XFS_IO_PROG" -f -c "falloc 0 $sz" "$testdir/file1"
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file4
|
||||
$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1
|
||||
_test_remount
|
||||
free_blocks3=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks3=$(stat -f $testdir -c '%f')
|
||||
|
||||
echo "Rewrite the original file"
|
||||
_pwrite_byte 0x65 0 $sz "$testdir/file1" >> "$seqres.full"
|
||||
_pwrite_byte 0x65 0 $sz $testdir/file1 >> $seqres.full
|
||||
_test_remount
|
||||
free_blocks4=$(stat -f "$testdir" -c '%f')
|
||||
free_blocks4=$(stat -f $testdir -c '%f')
|
||||
#echo $free_blocks0 $free_blocks1 $free_blocks2 $free_blocks3 $free_blocks4
|
||||
|
||||
_within_tolerance "free blocks after reflinking" $free_blocks1 $((free_blocks0 - blks)) $margin -v
|
||||
|
||||
Reference in New Issue
Block a user