From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
With this commit, testsuite works as expected.
Signed-off-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
---
tests/common | 13 +++++++++----
tests/misc-tests/012-find-root-no-result/test.sh | 2 +-
.../020-fix-superblock-corruption/test.sh | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/tests/common b/tests/common
index 605cf72c..26190d85 100644
--- a/tests/common
+++ b/tests/common
@@ -305,13 +305,18 @@ run_mustfail_stdout()
check_prereq()
{
- if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then
+ 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()
diff --git a/tests/misc-tests/012-find-root-no-result/test.sh b/tests/misc-tests/012-find-root-no-result/test.sh
index 6dd447f3..edfdfd38 100755
--- a/tests/misc-tests/012-find-root-no-result/test.sh
+++ b/tests/misc-tests/012-find-root-no-result/test.sh
@@ -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"
diff --git a/tests/misc-tests/020-fix-superblock-corruption/test.sh b/tests/misc-tests/020-fix-superblock-corruption/test.sh
index 404d416b..d67a87c3 100755
--- a/tests/misc-tests/020-fix-superblock-corruption/test.sh
+++ b/tests/misc-tests/020-fix-superblock-corruption/test.sh
@@ -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"
--
2.25.0