diff options
author | Gu Jinxiang <gujx@cn.fujitsu.com> | 2018-02-08 14:34:19 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-02-13 15:41:32 +0100 |
commit | cebf3b37228cbde730a5448ad2dfb044600d5e03 (patch) | |
tree | ecc36b048a74d11374ac00bb6e9ab5ab2a166b0f /tests/common | |
parent | 04cd2c0bcac7129026c80661933b4ab97d4ab9ca (diff) |
btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests
Use TEST_TOP as base for tests to reference any files, this will be used
for git and external testsuite.
INTERNAL_BIN is needed for referencing binaries that could reside in
different paths in git vs external testsuite.
Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
[ add quotes around sourced files, update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/common')
-rw-r--r-- | tests/common | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/common b/tests/common index 7f641a00..fae30f1d 100644 --- a/tests/common +++ b/tests/common @@ -290,8 +290,12 @@ run_mustfail_stdout() check_prereq() { - if ! [ -f "$TOP/$1" ]; then - _fail "Failed prerequisites: $1"; + if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then + if ! [ -f "$INTERNAL_BIN/$1" ]; then + _fail "Failed prerequisites: $INTERNAL_BIN/$1"; + fi + elif ! [ -f "$TOP/$1" ]; then + _fail "Failed prerequisites: $TOP/$1"; fi } @@ -449,9 +453,9 @@ prepare_test_dev() return; fi - echo "\$TEST_DEV not given, using $TOP/tests/test.img as fallback" >> \ + echo "\$TEST_DEV not given, using $TEST_TOP/test.img as fallback" >> \ "$RESULTS" - TEST_DEV="$TOP/tests/test.img" + TEST_DEV="$TEST_TOP/test.img" truncate -s 0 "$TEST_DEV" truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed" @@ -632,11 +636,11 @@ cleanup_loopdevs() init_env() { - TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}" + TEST_MNT="${TEST_MNT:-$TEST_TOP/mnt}" export TEST_MNT mkdir -p "$TEST_MNT" || { echo "Failed mkdir -p $TEST_MNT"; exit 1; } - source $TOP/tests/common.local + source $TEST_TOP/common.local if [ "$TEST_ENABLE_OVERRIDE" = 'true' -a -n "$RESULTS" ]; then echo "INCLUDE common.local" >> "$RESULTS" |