X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=896f2a0f29d4aeea42b42b4419520115321b262f;hb=9c5dd55ab776adbdfe69dcad62765c937e0a52e7;hp=d6fcf303452b30648f8235e6cbfa052f73696713;hpb=e23e08c478a341565d48a1b37dd2ad554be6b84e;p=babeltrace.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index d6fcf303..896f2a0f 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -22,7 +22,14 @@ # Error out when encountering an undefined variable set -u +# If "readlink -f" is available, get a resolved absolute path to the +# tests source dir, otherwise make do with a relative path. scriptdir="$(dirname "${BASH_SOURCE[0]}")" +if readlink -f "." >/dev/null 2>&1; then + testsdir=$(readlink -f "$scriptdir/..") +else + testsdir="$scriptdir/.." +fi # The OS on which we are running. See [1] for possible values of 'uname -s'. # We do a bit of translation to ease our life down the road for comparison. @@ -52,12 +59,12 @@ export BT_OS_TYPE # Allow overriding the source and build directories if [ "x${BT_TESTS_SRCDIR:-}" = "x" ]; then - BT_TESTS_SRCDIR="$scriptdir/.." + BT_TESTS_SRCDIR="$testsdir" fi export BT_TESTS_SRCDIR if [ "x${BT_TESTS_BUILDDIR:-}" = "x" ]; then - BT_TESTS_BUILDDIR="$scriptdir/.." + BT_TESTS_BUILDDIR="$testsdir" fi export BT_TESTS_BUILDDIR