"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/test-fsck" between
dosfstools-4.1.tar.gz and dosfstools-4.2.tar.gz

About: dosfstools are utilities to create, check and label (MS-DOS) FAT filesystems.

test-fsck  (dosfstools-4.1):test-fsck  (dosfstools-4.2)
skipping to change at line 26 skipping to change at line 26
# #
# #
# This script expects a testname.fsck file as its sole argument. It must # This script expects a testname.fsck file as its sole argument. It must
# be a hex dump that can be converted to a filesystem image with xxd. # be a hex dump that can be converted to a filesystem image with xxd.
# fsck.fat is run on that image to attempt to fix the problem and then # fsck.fat is run on that image to attempt to fix the problem and then
# it is run a second time to determine if the problem has been fixed. # it is run a second time to determine if the problem has been fixed.
# The test fails if the first run does not detect an error or if the # The test fails if the first run does not detect an error or if the
# second run still detects an error. # second run still detects an error.
run_fsck () { run_fsck () {
"../src/fsck.fat" "$@" $RUN "../src/fsck.fat" "$@"
} }
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
echo "$0 called with wrong number of arguments" echo "$0 called with wrong number of arguments"
exit 99 exit 99
fi fi
testname=$(basename "$1" .fsck) testname=$(basename "$1" .fsck)
if [ "$XXD_FOUND" != "yes" ]; then if [ "$XXD_FOUND" != "yes" ]; then
echo "xxd not available, required by test" echo "xxd not available, required by test"
exit 77 # report test skipped exit 77 # report test skipped
fi fi
if [ -f "$testname.args" ]; then
ARGS=$(cat "$testname.args")
else
ARGS=
fi
echo "Test $testname" echo "Test $testname"
# make sure there aren't files remaining from earlier run # make sure there aren't files remaining from earlier run
rm -f "${testname}.img" rm -f "${testname}.img" "${testname}.refimg"
xxd -r "${srcdir}/${testname}.fsck" "${testname}.img" || exit 99 xxd -r "${srcdir}/${testname}.fsck" "${testname}.img" || exit 99
echo "First fsck run to check and fix error..." echo "First fsck run to check and fix error..."
run_fsck -a "${testname}.img" run_fsck -a $ARGS "${testname}.img"
success=$? success=$?
if [ $success -eq 0 ]; then if [ $success -eq 0 ]; then
echo "*** Error was not detected by fsck." echo "*** Error was not detected by fsck."
success=100 success=100
elif [ $success -eq 1 ]; then elif [ $success -eq 1 ]; then
echo "Second fsck run to check if error was fixed..." echo "Second fsck run to check if error was fixed..."
run_fsck -n "${testname}.img" run_fsck -n "${testname}.img"
success=$? success=$?
if [ $success -ne 0 ]; then if [ $success -ne 0 ]; then
echo "*** Error was not fixed by fsck." echo "*** Error was not fixed by fsck."
else
echo "Comparing..."
xxd -r "${srcdir}/${testname}.xxd" "${testname}.refimg" || exit 9
9
cmp "${testname}.img" "${testname}.refimg"
success=$?
if [ $success -eq 2 ]; then
# cmp reported error
exit 99
fi
fi fi
fi fi
rm -f "${testname}.img" rm -f "${testname}.img" "${testname}.refimg"
exit $success exit $success
 End of changes. 6 change blocks. 
4 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)