mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-16 17:56:51 +00:00
btrfs-progs: tests: add test for fi show and missing device
Add a test to ensure that 'btrfs fi show' on a mounted filesystem, which has a missing device will explicitly print which device is missing. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
957a79c9b0
commit
f4da3ea032
35
tests/cli-tests/017-fi-show-missing/test.sh
Executable file
35
tests/cli-tests/017-fi-show-missing/test.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Test that if a device is missing for a mounted filesystem, btrfs fi show will
|
||||
# show which device exactly is missing.
|
||||
|
||||
source "$TEST_TOP/common"
|
||||
|
||||
check_prereq mkfs.btrfs
|
||||
check_prereq btrfs
|
||||
|
||||
setup_root_helper
|
||||
setup_loopdevs 2
|
||||
prepare_loopdevs
|
||||
|
||||
dev1=${loopdevs[1]}
|
||||
dev2=${loopdevs[2]}
|
||||
|
||||
run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -d raid1 "${loopdevs[@]}"
|
||||
|
||||
# Move the device, changing its path, simulating the device being missing
|
||||
run_check $SUDO_HELPER mv "$dev2" /dev/loop-non-existent
|
||||
|
||||
run_check $SUDO_HELPER mount -o degraded $dev1 $TEST_MNT
|
||||
|
||||
if ! run_check_stdout $SUDO_HELPER "$TOP/btrfs" filesystem show "$TEST_MNT" | \
|
||||
grep -q "$dev2 MISSING"; then
|
||||
|
||||
_fail "didn't find exact missing device"
|
||||
fi
|
||||
|
||||
run_check $SUDO_HELPER mv /dev/loop-non-existent "$dev2"
|
||||
|
||||
run_check $SUDO_HELPER umount "$TEST_MNT"
|
||||
|
||||
cleanup_loopdevs
|
Loading…
Reference in New Issue
Block a user