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/fsck-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/fsck-tests.sh')
-rwxr-xr-x | tests/fsck-tests.sh | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/fsck-tests.sh b/tests/fsck-tests.sh index f97ae986..14287bbe 100755 --- a/tests/fsck-tests.sh +++ b/tests/fsck-tests.sh @@ -4,11 +4,26 @@ LANG=C SCRIPT_DIR=$(dirname $(readlink -f "$0")) -INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../") -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/fsck-tests-results.txt" |