2016-02-22 06:59:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Regression test for case btrfs-find-root may print no result on a
|
|
|
|
# recent fs or balanced fs, whose metadata chunk is the first chunk
|
|
|
|
# and the only metadata chunk
|
|
|
|
|
2018-02-08 06:34:19 +00:00
|
|
|
source "$TEST_TOP/common"
|
2016-02-22 06:59:57 +00:00
|
|
|
|
|
|
|
check_prereq btrfs-find-root
|
|
|
|
check_prereq btrfs-image
|
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check "$TOP/btrfs-image" -r first_meta_chunk.btrfs-image test.img || \
|
2016-02-22 06:59:57 +00:00
|
|
|
_fail "failed to extract first_meta_chunk.btrfs-image"
|
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
result=$(run_check_stdout "$TOP/btrfs-find-root" test.img | sed '/^Superblock/d')
|
2016-02-22 06:59:57 +00:00
|
|
|
|
|
|
|
if [ -z "$result" ]; then
|
|
|
|
_fail "btrfs-find-root failed to find tree root"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! echo "$result" | grep -q 'Found tree root at'; then
|
|
|
|
_fail "btrfs-find-root failed to find tree root, unexpected output"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm test.img
|