diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2018-02-19 15:51:31 +0000 |
---|---|---|
committer | Dimitri John Ledkov <xnox@ubuntu.com> | 2018-02-19 15:52:49 +0000 |
commit | b70cb0d0a21394d5d6b00b51f064115c2724cea8 (patch) | |
tree | f001381d2ee826e6665e003e7c6dccb084a54316 /tests/clean-tests.sh | |
parent | f1b0adb46b2c193e940f8c22b35036d2ee76c673 (diff) |
New upstream releasedebian/4.15.1-1archive/debian/4.15.1-1
Diffstat (limited to 'tests/clean-tests.sh')
-rwxr-xr-x | tests/clean-tests.sh | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tests/clean-tests.sh b/tests/clean-tests.sh index 61baa069..342616f7 100755 --- a/tests/clean-tests.sh +++ b/tests/clean-tests.sh @@ -1,9 +1,34 @@ #!/bin/bash # remove all intermediate files from tests +LANG=C SCRIPT_DIR=$(dirname $(readlink -f "$0")) -TOP=$(readlink -f "$SCRIPT_DIR/../") -source "$TOP/tests/common" +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/cli-tests-results.txt" +IMAGE="$TEST_TOP/test.img" + +source "$TEST_TOP/common" setup_root_helper @@ -13,8 +38,8 @@ fi $SUDO_HELPER umount "$TEST_MNT" &>/dev/null -if ! cd "$TOP/tests"; then - echo "ERROR: cannot cd to $TOP/tests" +if ! cd "$TEST_TOP"; then + echo "ERROR: cannot cd to $TEST_TOP" exit 1 fi |