blob: 69a1e60d7ac3217a6655b545cc9aad8e3dba77a0 [file] [log] [blame] [edit]
#! /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