diff options
author | David Sterba <dsterba@suse.com> | 2018-02-08 18:34:40 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-02-13 16:19:48 +0100 |
commit | e44f595dd7dd2372954595cb9231c36e04cafc73 (patch) | |
tree | 8d667d97dcb4a1457f1370d627b92fba42795e21 /tests/convert-tests.sh | |
parent | dd11901dae6c11387ffce0c769718b22ca8128f0 (diff) |
btrfs-progs: tests: unify test drivers, make ready for extenral testsuite
Make the TOP variable more configurable, allow to set it to any path
where to find binaries when the testsuite is exported, or fallback to
system binaries.
There's now more code duplication, the logic is now more complex so it's
left open coded for clarity. Further cleanups are possible.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/convert-tests.sh')
-rwxr-xr-x | tests/convert-tests.sh | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh index 52c59d4d..4bc915db 100755 --- a/tests/convert-tests.sh +++ b/tests/convert-tests.sh @@ -5,10 +5,26 @@ LANG=C SCRIPT_DIR=$(dirname $(readlink -f "$0")) -TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/") -TOP=$(readlink -f "$SCRIPT_DIR/../") -if ! [ -f "$TOP/btrfs" ];then - TOP=$(dirname `which btrfs`) +if [ -z "$TOP" ]; then + TOP=$(readlink -f "$SCRIPT_DIR/../") + if [ -f "$TOP/configure.ac" ]; then + # inside git + TEST_TOP="$TOP/tests/" + INTERNAL_BIN="$TOP" + else + # external, defaults to system binaries + TOP=$(dirname `which btrfs`) + TEST_TOP="$SCRIPT_DIR" + INTERNAL_BIN="$TEST_TOP" + fi +else + # assume external, TOP set from commandline + TEST_TOP="$SCRIPT_DIR" + INTERNAL_BIN="$TEST_TOP" +fi +if ! [ -x "$TOP/btrfs" ]; then + echo "ERROR: cannot execute btrfs from TOP=$TOP" + exit 1 fi TEST_DEV=${TEST_DEV:-} RESULTS="$TEST_TOP/convert-tests-results.txt" @@ -17,6 +33,7 @@ IMAGE="$TEST_TOP/test.img" source "$TEST_TOP/common" source "$TEST_TOP/common.convert" +export INTERNAL_BIN export TEST_TOP export TOP export RESULTS |