diff options
Diffstat (limited to 'debug/test/test_fs_hfsplus')
-rw-r--r-- | debug/test/test_fs_hfsplus | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/debug/test/test_fs_hfsplus b/debug/test/test_fs_hfsplus new file mode 100644 index 0000000..39652df --- /dev/null +++ b/debug/test/test_fs_hfsplus @@ -0,0 +1,94 @@ +#!/bin/bash +# fsck_hfs seems to be broken : it doesn't even succeed in scanning a freshly +# created by newfs_hfs partition. +# update : retry with my newfs_hfs that round file system size down to 4 ko + +do_diff() +{ + mount "${TEST_DRIVE}1" $TEST_MOUNT_POINT -t $FILE_SYSTEM > /dev/null + + if diff -rq $1 $2 --exclude lost+found >> test_log; then + ped_test_ok + else + ped_test_failed + fi + + umount $TEST_MOUNT_POINT 2>&1 > /dev/null +} + +do_test_diff() +{ + ped_testing "$1" + if ped_test_get_val "$4" "$5" "$6"; then + ped_test_failed + return 1 + fi + do_diff "$2" "$3" +} + + +test_newfs_hfs() +{ +# -w option for newfs_hfs adds an HFS wrapper around the HFS+ F.S. +# update : don't use -w yet because it doesn't works well +# it seems that the wrapper bad block file is stored differently by +# newfs_hfs than by mac os X install format program +# -dfn for fsck_hfs means Debug, Force, No +# Debug => print more information +# Force => force check even if clean bit is set +# No => don't modify the F.S. + ped_test "mkpart && newfs_hfs && fsck_hfs"\ + "mklabel $TEST_FS_USE_DISK_LABEL\ + mkpart primary $FILE_SYSTEM 1 $DEFAULT_END"\ + "newfs_hfs -v \"PED HFS TEST\" ${TEST_DRIVE}1" +# &&\ +# fsck_hfs -dfn ${TEST_DRIVE}1" +} + +prepare_resize_tests() +{ + part_num=1 + part=$TEST_DRIVE$part_num + hole_parent=`echo $TEST_DATA_HOLE | sed -e "s/[-_.a-zA-Z0-9]+\///g"` + + umount $TEST_MOUNT_POINT 2>&1 > /dev/null + + mount $part $TEST_MOUNT_POINT -t $FILE_SYSTEM \ + && cp $TEST_DATA/* $TEST_MOUNT_POINT -r \ + && cp -r $TEST_DATA $TEST_MOUNT_POINT/tmp_copy \ + && rm -rf $TEST_MOUNT_POINT/$TEST_DATA_HOLE \ + && mv $TEST_MOUNT_POINT/tmp_copy/$TEST_DATA_HOLE \ + $TEST_MOUNT_POINT/$hole_parent \ + && rm -rf $TEST_MOUNT_POINT/tmp_copy + + umount $TEST_MOUNT_POINT 2>&1 > /dev/null +} + +test_resize_move_end_backward() +{ +# -dfn for fsck_hfs means Debug, Force, No +# Debug => print more information +# Force => force check even if clean bit is set +# No => don't modify the F.S. + do_test_diff "resize: move end backward"\ + $TEST_DATA $TEST_MOUNT_POINT \ + "resize 1 1 $RESIZE_END"\ + "" +#fsck_hfs -dfn ${TEST_DRIVE}1 2>&1" +} + +main() +{ + export DEFAULT_END=250 + export RESIZE_END=200 + export FILE_SYSTEM=hfsplus + + if ! test_newfs_hfs; then + return 1 + fi + + prepare_resize_tests + test_resize_move_end_backward +} + +main |