Skip to content

Commit a7bc32e

Browse files
committed
ci: limit test runner to build path
We provide `BUILD_PATH` to our build script; provide it and mutate `PATH` when running our tests as well.
1 parent 9b546b2 commit a7bc32e

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

ci/test.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ fi
1313

1414
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
1515
BUILD_DIR=$(pwd)
16+
BUILD_PATH=${BUILD_PATH:=$PATH}
17+
CTEST=$(which ctest)
1618
TMPDIR=${TMPDIR:-/tmp}
1719
USER=${USER:-$(whoami)}
1820

@@ -75,7 +77,11 @@ run_test() {
7577

7678
RETURN_CODE=0
7779

78-
CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml" ctest -V -R "^${1}$" || RETURN_CODE=$? && true
80+
(
81+
export PATH="${BUILD_PATH}"
82+
export CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml"
83+
"${CTEST}" -V -R "^${1}$"
84+
) || RETURN_CODE=$? && true
7985

8086
if [ "$RETURN_CODE" -eq 0 ]; then
8187
FAILED=0
@@ -96,9 +102,21 @@ run_test() {
96102
fi
97103
}
98104

105+
indent() { sed "s/^/ /"; }
106+
107+
if [[ "$(uname -s)" == MINGW* ]]; then
108+
BUILD_PATH=$(cygpath "$BUILD_PATH")
109+
fi
110+
111+
99112
# Configure the test environment; run them early so that we're certain
100113
# that they're started by the time we need them.
101114

115+
echo "CTest version:"
116+
env PATH="${BUILD_PATH}" "${CTEST}" --version | head -1 2>&1 | indent
117+
118+
echo ""
119+
102120
echo "##############################################################################"
103121
echo "## Configuring test environment"
104122
echo "##############################################################################"
@@ -386,7 +404,7 @@ if [ -z "$SKIP_FUZZERS" ]; then
386404
echo "## Running fuzzers"
387405
echo "##############################################################################"
388406

389-
ctest -V -R 'fuzzer'
407+
env PATH="${BUILD_PATH}" "${CTEST}" -V -R 'fuzzer'
390408
fi
391409

392410
cleanup

0 commit comments

Comments
 (0)