blob: 2fb30281ec5981ef1f7a5e13972bfd04c2efa77f [file] [log] [blame]
#! /bin/bash
test_mkpartfs()
{
ped_test "mkpartfs"\
"mklabel $TEST_FS_USE_DISK_LABEL\
mkpartfs primary linux-swap 1 $DEFAULT_END\
check 1"
ped_test "mkfs"\
"mkfs 1 linux-swap\
check 1"
}
do_test_swap()
{
ped_testing "$1"
if ped_test_get_val "$2" "$3"; then
ped_test_failed
return 1
fi
if /sbin/swapon "${TEST_DRIVE}1"; then
/sbin/swapoff "${TEST_DRIVE}1"
ped_test_ok
else
ped_test_failed
fi
}
test_resize_move_start_forward()
{
do_test_swap "resize: move start forward"\
"resize 1 5 $DEFAULT_END check 1"
}
test_resize_move_start_backward()
{
do_test_swap "resize: move start backward"\
"resize 1 1 $DEFAULT_END check 1"
}
test_resize_move_end_forward()
{
do_test_swap "resize: move end forward"\
"resize 1 1 $[ $DEFAULT_END + 5 ] check 1"
}
test_resize_move_end_backward()
{
do_test_swap "resize: move end backward"\
"resize 1 1 $DEFAULT_END check 1"
}
main()
{
export DEFAULT_END=200
if ! test_mkpartfs; then
return 1
fi
test_resize_move_start_forward
test_resize_move_start_backward
test_resize_move_end_forward
test_resize_move_end_backward
}
main