From 5950bcd1214e91af3fdb618a65e34d7d5360a188 Mon Sep 17 00:00:00 2001 From: Nikolay Borisov Date: Mon, 3 Sep 2018 13:02:57 +0300 Subject: [PATCH] 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 Signed-off-by: David Sterba --- .../011-delete-missing-device/test.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/misc-tests/011-delete-missing-device/test.sh b/tests/misc-tests/011-delete-missing-device/test.sh index 4c976421..a6b2e29c 100755 --- a/tests/misc-tests/011-delete-missing-device/test.sh +++ b/tests/misc-tests/011-delete-missing-device/test.sh @@ -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