summaryrefslogtreecommitdiff
path: root/tests/misc-tests/011-delete-missing-device/test.sh
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-09-03 13:02:57 +0300
committerDavid Sterba <dsterba@suse.com>2018-10-23 14:48:39 +0200
commit5950bcd1214e91af3fdb618a65e34d7d5360a188 (patch)
tree703cc45b73db2b9969d794b136e395734749375f /tests/misc-tests/011-delete-missing-device/test.sh
parent3894560deba51b96753327329730c4a741781ff7 (diff)
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>
Diffstat (limited to 'tests/misc-tests/011-delete-missing-device/test.sh')
-rwxr-xr-xtests/misc-tests/011-delete-missing-device/test.sh17
1 files changed, 17 insertions, 0 deletions
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