btrfs-progs: misc-tests/021: Do extra btrfs check before mounting

Test case misc/021 is testing if we could mount a single disk btrfs
image recovered from multi disk fs.

The problem is, current kernel has extra check for block group, chunk
and dev extent.  This means no image can pass btrfs check for chunk
tree and the filesystem will not mount.

So do extra btrfs check before mount, this will also help us to locate
the problem in btrfs-image easier.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2018-11-27 16:38:28 +08:00 committed by David Sterba
parent a1a98ee7a8
commit 9996feb94d
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ run_check $SUDO_HELPER wipefs -a "$loop2"
run_check $SUDO_HELPER "$TOP/btrfs-image" -r "$IMAGE" "$loop1"
# Run check to make sure there is nothing wrong for the recovered image
run_check "$TOP/btrfs" check "$loop1"
run_check $SUDO_HELPER mount "$loop1" "$TEST_MNT"
new_md5=$(run_check_stdout md5sum "$TEST_MNT/foobar" | cut -d ' ' -f 1)
run_check $SUDO_HELPER umount "$TEST_MNT"