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>
Marcos Paulo de Souza 2020-03-01 00:33:44 -03:00 committed by David Sterba
parent 225d66e99b
commit 6ec6c11ba1
3 changed files with 12 additions and 6 deletions

View File

@ -305,13 +305,19 @@ run_mustfail_stdout()
check_prereq()
{
if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then
# Internal tools for testing, not shipped with the package
case "$1" in
btrfs-corrupt-block|btrfs-find-root|btrfs-select-super|fssum)
if ! [ -f "$INTERNAL_BIN/$1" ]; then
_fail "Failed prerequisites: $INTERNAL_BIN/$1";
fi
elif ! [ -f "$TOP/$1" ]; then
_fail "Failed prerequisites: $TOP/$1";
fi
;;
*)
if ! [ -f "$TOP/$1" ]; then
_fail "Failed prerequisites: $TOP/$1";
fi
;;
esac
}
check_global_prereq()

View File

@ -11,7 +11,7 @@ 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 "$TOP/btrfs-find-root" test.img | sed '/^Superblock/d')
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"

View File

@ -25,7 +25,7 @@ test_superblock_restore()
_fail "btrfs check should detect corruption"
# Copy backup superblock to primary
run_check "$TOP/btrfs-select-super" -s 1 "$TEST_DEV"
run_check "$INTERNAL_BIN/btrfs-select-super" -s 1 "$TEST_DEV"
# Perform btrfs check
run_check "$TOP/btrfs" check "$TEST_DEV"