diff options
Diffstat (limited to 'debug/test/test_fs_reiserfs')
-rwxr-xr-x | debug/test/test_fs_reiserfs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/debug/test/test_fs_reiserfs b/debug/test/test_fs_reiserfs new file mode 100755 index 0000000..7e1ffdf --- /dev/null +++ b/debug/test/test_fs_reiserfs @@ -0,0 +1,97 @@ +#! /bin/bash + +do_diff() +{ + mount "${TEST_DRIVE}1" $TEST_MOUNT_POINT -t reiserfs > /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_mkpartfs() +{ + ped_test "mkpartfs primary reiserfs 1 1"\ + "mklabel $TEST_FS_USE_DISK_LABEL\ + mkpartfs primary reiserfs 1 1\ + check 1"\ + "echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1" + + ped_test "mkpartfs"\ + "mklabel $TEST_FS_USE_DISK_LABEL\ + mkpartfs primary reiserfs 1 $DEFAULT_END\ + check 1"\ + "echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1" + + ped_test "mkfs"\ + "mkfs 1 reiserfs\ + check 1"\ + "echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1" +} + +prepare_resize_tests() +{ + part_num=1 + part=$TEST_DRIVE$part_num + + umount $TEST_MOUNT_POINT 2>&1 > /dev/null + + mount $part $TEST_MOUNT_POINT -t reiserfs \ + && cp $TEST_DATA/* $TEST_MOUNT_POINT -r + umount $TEST_MOUNT_POINT 2>&1 > /dev/null +} + +test_resize_move_end_forward() +{ + do_test_diff "resize: move end forward"\ + $TEST_DATA $TEST_MOUNT_POINT \ + "resize 1 1 $[ $DEFAULT_END + 5 ] check 1"\ + "echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1" +} + +test_resize_move_end_forward_big() +{ + do_test_diff "resize: move end forward (big)"\ + $TEST_DATA $TEST_MOUNT_POINT \ + "resize 1 1 $[ $DEFAULT_END + 200 ] check 1"\ + "echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1" +} + +test_resize_move_end_backward() +{ + do_test_diff "resize: move end backward"\ + $TEST_DATA $TEST_MOUNT_POINT \ + "resize 1 1 $DEFAULT_END check 1"\ + "echo Yes | /sbin/reiserfsck -q ${TEST_DRIVE}1 2>&1" +} + +main() +{ + export DEFAULT_END=200 + + if ! test_mkpartfs; then + return 1 + fi + + prepare_resize_tests + test_resize_move_end_forward + test_resize_move_end_backward + test_resize_move_end_forward_big + test_resize_move_end_backward +} + +main |