btrfs-progs: tests: add test for missing device delete error value

Add a test which ensures the kernel returns the correct error value
when missing device removal is requested. This test verifies that kernel
refactoring didn't break the return value.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Nikolay Borisov 2018-09-03 13:02:57 +03:00 committed by David Sterba
parent 3894560deb
commit 5950bcd121
1 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,22 @@ test_delete_missing()
run_check_umount_test_dev
}
test_missing_error()
{
local out
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
run_check_mount_test_dev
out=$(run_mustfail_stdout "device remove succeeded" \
$SUDO_HELPER "$TOP/btrfs" device remove missing "$TEST_MNT")
if ! echo "$out" | grep -q "no missing devices found to remove"; then
_fail "IOCTL returned unexpected error value"
fi
run_check_umount_test_dev
}
setup_loopdevs 4
prepare_loopdevs
dev1=${loopdevs[1]}
@ -53,5 +69,6 @@ TEST_DEV=$dev1
test_do_mkfs -m raid1 -d raid1
test_wipefs
test_delete_missing
test_missing_error
cleanup_loopdevs