diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:16:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:16:34 +0000 |
commit | a398d2c2b5fd6ab0545d8bb019f9a970b2309404 (patch) | |
tree | 272fc7ab226258d7ceddee12c8c682c8e711c2b0 /debug/test/test_fs_hfs | |
parent | Initial commit. (diff) | |
download | parted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.tar.xz parted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.zip |
Adding upstream version 3.6.upstream/3.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | debug/test/test_fs_hfs | 90 | ||||
-rw-r--r-- | debug/test/test_fs_hfsplus | 94 |
2 files changed, 184 insertions, 0 deletions
diff --git a/debug/test/test_fs_hfs b/debug/test/test_fs_hfs new file mode 100644 index 0000000..cb0d3f1 --- /dev/null +++ b/debug/test/test_fs_hfs @@ -0,0 +1,90 @@ +#!/bin/bash +# fsck_hfs seems to be broken : it doesn't even succeed in scanning a freshly +# created by newfs_hfs partition. + +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() +{ +# -h option for newfs_hfs makes it use legacy HFS (not Plus) +# -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 -h -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=hfs + + if ! test_newfs_hfs; then + return 1 + fi + + prepare_resize_tests + test_resize_move_end_backward +} + +main 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 |