btrfs-progs/tests/misc-tests/012-find-root-no-result/test.sh
Marcos Paulo de Souza 6ec6c11ba1 btrfs-progs: tests: misc: find-root and select-super are internal commands
Enhance the prerequisite check for internal tools, up to now missing
btrfs-find-root and btrfs-select-super. The correct path in the checks
is INTERNAL_BIN.

The testsuite is now self-contained.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:55 +01:00

25 lines
707 B
Bash
Executable File

#!/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
source "$TEST_TOP/common"
check_prereq btrfs-find-root
check_prereq btrfs-image
run_check "$TOP/btrfs-image" -r first_meta_chunk.btrfs-image test.img || \
_fail "failed to extract first_meta_chunk.btrfs-image"
result=$(run_check_stdout "$INTERNAL_BIN/btrfs-find-root" test.img | sed '/^Superblock/d')
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