mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
use _do from common.rc
This commit is contained in:
@@ -51,7 +51,7 @@ status=1 # failure is the default!
|
|||||||
_cleanup()
|
_cleanup()
|
||||||
{
|
{
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
rm -f $tmp.*
|
# rm -f $tmp.*
|
||||||
}
|
}
|
||||||
trap "_cleanup ; exit \$status" 0 1 2 3 15
|
trap "_cleanup ; exit \$status" 0 1 2 3 15
|
||||||
|
|
||||||
@@ -63,21 +63,14 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15
|
|||||||
|
|
||||||
_require_scratch
|
_require_scratch
|
||||||
|
|
||||||
_do()
|
|
||||||
{
|
|
||||||
if [ $# -ne 1 ]; then echo "Usage: _do \"cmd\"" 1>&2 ; exit 1; fi
|
|
||||||
echo "*** $1" >>$seq.full
|
|
||||||
eval "$1 2>&1 | _fix_malloc >>$seq.full"
|
|
||||||
}
|
|
||||||
|
|
||||||
_fill()
|
_fill()
|
||||||
{
|
{
|
||||||
if [ $# -ne 1 ]; then echo "Usage: _fill \"path\"" 1>&2 ; exit 1; fi
|
if [ $# -ne 1 ]; then echo "Usage: _fill \"path\"" 1>&2 ; exit 1; fi
|
||||||
echo -n "Fill filesystem... "
|
_do "Fill filesystem" \
|
||||||
_do "(src/fill2fs --verbose --dir=$1 --seed=0 --filesize=65536 --stddev=32768 --list=- >>$tmp.manifest)"
|
"src/fill2fs --verbose --dir=$1 --seed=0 --filesize=65536 --stddev=32768 --list=- >>$tmp.manifest"
|
||||||
echo "done"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_do_die_on_error=y
|
||||||
rm -f $seq.full
|
rm -f $seq.full
|
||||||
#agsize=16
|
#agsize=16
|
||||||
agsize=32
|
agsize=32
|
||||||
@@ -101,16 +94,7 @@ do
|
|||||||
_do "umount $SCRATCH_MNT"
|
_do "umount $SCRATCH_MNT"
|
||||||
_do "mount -t xfs $SCRATCH_DEV $SCRATCH_MNT"
|
_do "mount -t xfs $SCRATCH_DEV $SCRATCH_MNT"
|
||||||
echo "done"
|
echo "done"
|
||||||
echo -n "Check files... "
|
_do "Check files" "src/fill2fs_check $tmp.manifest"
|
||||||
if ! _do "src/fill2fs_check $tmp.manifest"; then
|
|
||||||
echo "fail"
|
|
||||||
echo "Files corrupt/missing after growfs. Test failed see $seq.full"
|
|
||||||
status=1; exit
|
|
||||||
fi
|
|
||||||
echo "done"
|
|
||||||
# echo -n "Checking filesystem... "
|
|
||||||
# _check_fs $SCRATCH_DEV
|
|
||||||
# echo "done"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# success, all done
|
# success, all done
|
||||||
|
|||||||
@@ -87,14 +87,6 @@ _cull_files()
|
|||||||
close MANIFEST;'
|
close MANIFEST;'
|
||||||
}
|
}
|
||||||
|
|
||||||
_do()
|
|
||||||
{
|
|
||||||
if [ $# -ne 1 ]; then echo "Usage: _do \"cmd\"" 1>&2 ; exit 1; fi
|
|
||||||
echo "*** $1" >>$seq.full
|
|
||||||
eval "$1 2>&1 | _fix_malloc >>$seq.full"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# create a large contiguous file using dd
|
# create a large contiguous file using dd
|
||||||
# use fill2fs to fill the filesystem up with 4k sized files
|
# use fill2fs to fill the filesystem up with 4k sized files
|
||||||
# fill any remaining space using dd
|
# fill any remaining space using dd
|
||||||
@@ -103,7 +95,6 @@ _do()
|
|||||||
# delete the dd-generated file
|
# delete the dd-generated file
|
||||||
# run xfs_fsr on the filesystem
|
# run xfs_fsr on the filesystem
|
||||||
# check checksums for remaining files
|
# check checksums for remaining files
|
||||||
|
|
||||||
# create 3 minimum sized (16Mb) allocation groups
|
# create 3 minimum sized (16Mb) allocation groups
|
||||||
# xfs_repair is going to need three to verify the superblock
|
# xfs_repair is going to need three to verify the superblock
|
||||||
rm -f $seq.full
|
rm -f $seq.full
|
||||||
@@ -120,7 +111,7 @@ do
|
|||||||
done
|
done
|
||||||
echo "done"
|
echo "done"
|
||||||
echo -n "Fill filesystem with 4k files, generate manifest... "
|
echo -n "Fill filesystem with 4k files, generate manifest... "
|
||||||
_do "(src/fill2fs --verbose --dir=$SCRATCH_MNT/fill --seed=0 --filesize=4096 --stddev=0 --list=$tmp.manifest)"
|
_do "src/fill2fs --verbose --dir=$SCRATCH_MNT/fill --seed=0 --filesize=4096 --stddev=0 --list=$tmp.manifest"
|
||||||
echo "done"
|
echo "done"
|
||||||
echo -n "Use up any further available space using dd... "
|
echo -n "Use up any further available space using dd... "
|
||||||
_do "dd if=/dev/zero of=$SCRATCH_MNT/pad bs=4096"
|
_do "dd if=/dev/zero of=$SCRATCH_MNT/pad bs=4096"
|
||||||
@@ -136,7 +127,7 @@ echo -n "Create one very large file... "
|
|||||||
_do "src/fill2 -d nbytes=16000000,file=$SCRATCH_MNT/fragmented"
|
_do "src/fill2 -d nbytes=16000000,file=$SCRATCH_MNT/fragmented"
|
||||||
echo "done"
|
echo "done"
|
||||||
_do "xfs_bmap $SCRATCH_MNT/fragmented"
|
_do "xfs_bmap $SCRATCH_MNT/fragmented"
|
||||||
_do "(sum $SCRATCH_MNT/fragmented >$tmp.sum1)"
|
_do "sum $SCRATCH_MNT/fragmented >$tmp.sum1"
|
||||||
echo -n "Remove other files... "
|
echo -n "Remove other files... "
|
||||||
_do "rm -rf $SCRATCH_MNT/{pad,hole*}"
|
_do "rm -rf $SCRATCH_MNT/{pad,hole*}"
|
||||||
echo "done"
|
echo "done"
|
||||||
@@ -158,7 +149,7 @@ if ! _do "src/fill2fs_check $tmp.manifest"; then
|
|||||||
fi
|
fi
|
||||||
echo "done"
|
echo "done"
|
||||||
echo -n "Check large file... "
|
echo -n "Check large file... "
|
||||||
_do "(sum $SCRATCH_MNT/fragmented >$tmp.sum2)"
|
_do "sum $SCRATCH_MNT/fragmented >$tmp.sum2"
|
||||||
if ! diff $tmp.sum1 $tmp.sum2; then
|
if ! diff $tmp.sum1 $tmp.sum2; then
|
||||||
echo "fail"
|
echo "fail"
|
||||||
echo "File is corrupt/missing after fsr. Test failed see $seq.full"
|
echo "File is corrupt/missing after fsr. Test failed see $seq.full"
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ _do()
|
|||||||
status=1; exit
|
status=1; exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(eval "echo '---' $_cmd") >>$seq.full
|
(eval "echo '---' \"$_cmd\"") >>$seq.full
|
||||||
(eval "$_cmd") >$tmp._out 2>&1; ret=$?
|
(eval "$_cmd") >$tmp._out 2>&1; ret=$?
|
||||||
cat $tmp._out | _fix_malloc >>$seq.full
|
cat $tmp._out | _fix_malloc >>$seq.full
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user