test-mkfs (dosfstools-4.1) | : | test-mkfs (dosfstools-4.2) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
# | # | |||
# | # | |||
# This script expects a testname.mkfs file as its sole argument. It must | # This script expects a testname.mkfs file as its sole argument. It must | |||
# be a shell snippet setting the variables ARGS, SIZE and CMP_LIMIT. ARGS and | # be a shell snippet setting the variables ARGS, SIZE and CMP_LIMIT. ARGS and | |||
# SIZE are used in the mkfs invocation and the result is compared against a | # SIZE are used in the mkfs invocation and the result is compared against a | |||
# reference image generated from the hexdump in testname.xxd. The comparison | # reference image generated from the hexdump in testname.xxd. The comparison | |||
# is stopped after CMP_LIMIT since freshly build FAT filesystems are just | # is stopped after CMP_LIMIT since freshly build FAT filesystems are just | |||
# zeros after the initial info sectors, FATs and root directory. | # zeros after the initial info sectors, FATs and root directory. | |||
run_mkfs () { | run_mkfs () { | |||
"../src/mkfs.fat" "$@" | $RUN "../src/mkfs.fat" "$@" | |||
} | } | |||
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" .mkfs) | testname=$(basename "$1" .mkfs) | |||
if [ "$XXD_FOUND" != "yes" ]; then | if [ "$XXD_FOUND" != "yes" ]; then | |||
echo "xxd not available, required by test" | echo "xxd not available, required by test" | |||
skipping to change at line 62 | skipping to change at line 62 | |||
echo | echo | |||
echo "Comparing..." | echo "Comparing..." | |||
limitarg= | limitarg= | |||
if [ -n "$CMP_LIMIT" ]; then | if [ -n "$CMP_LIMIT" ]; then | |||
limitarg="--bytes=$CMP_LIMIT" | limitarg="--bytes=$CMP_LIMIT" | |||
fi | fi | |||
cmp $limitarg "${testname}.out" "${testname}.refimg" | cmp $limitarg "${testname}.out" "${testname}.refimg" | |||
success=$? | success=$? | |||
echo | ||||
echo "Testing fsck..." | ||||
run_fsck -n "${testname}.out" | ||||
success_fsck=$? | ||||
if [ $success -eq 0 ]; then | if [ $success -eq 0 ]; then | |||
echo | success=$success_fsck | |||
echo "Testing fsck..." | ||||
run_fsck -n "${testname}.out" | ||||
success=$? | ||||
fi | fi | |||
rm -f "${testname}.out" "${testname}.refimg" | rm -f "${testname}.out" "${testname}.refimg" | |||
if [ $success -eq 2 ]; then | if [ $success -eq 2 ]; then | |||
# cmp reported error | # cmp reported error | |||
exit 99 | exit 99 | |||
fi | fi | |||
exit $success | exit $success | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added |