From 36e47fb1a9ab0334f66978541f16beac9d8f877d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Lepage=20Vall=C3=A9e?= Date: Sun, 12 Jun 2016 17:28:32 -0400 Subject: [PATCH] tests: Don't use arbitrary build dir path (#898) Calling the test script by hand from the build dir stopped working. --- tests/run.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index 21909e1c..41b7a387 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -17,15 +17,20 @@ if [ "$CI" = true ]; then set -x fi -source_dir="$PWD" +# Either the build dir is passed in $CMAKE_BINARY_DIR or we guess based on $PWD build_dir="$CMAKE_BINARY_DIR" if [ -z "$build_dir" ]; then - build_dir="$PWD/build" + if [ -d "$PWD/build" ]; then + build_dir="$PWD/build" + else + build_dir="$PWD" + fi fi # Change to file's dir (POSIXly). cd -P -- "$(dirname -- "$0")" this_dir=$PWD +source_dir="$PWD/.." # Get test files: test*, or the ones provided as args (relative to tests/). if [ $# != 0 ]; then