diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2023-01-31 12:17:09 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2023-02-09 12:10:40 +0000 |
commit | a7bc32edd553b41b1d4f02233379934e6d4b47a9 (patch) | |
tree | ac4d185fe787fc71860f68f623586a8185c41a8a | |
parent | 9b546b2ba1306afdf6d986ca0a298133be584a5c (diff) | |
download | libgit2-a7bc32edd553b41b1d4f02233379934e6d4b47a9.tar.gz |
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.
-rwxr-xr-x | ci/test.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ci/test.sh b/ci/test.sh index 47629e9eb..d86fb3cf0 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -13,6 +13,8 @@ fi SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )} BUILD_DIR=$(pwd) +BUILD_PATH=${BUILD_PATH:=$PATH} +CTEST=$(which ctest) TMPDIR=${TMPDIR:-/tmp} USER=${USER:-$(whoami)} @@ -75,7 +77,11 @@ run_test() { RETURN_CODE=0 - CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml" ctest -V -R "^${1}$" || RETURN_CODE=$? && true + ( + export PATH="${BUILD_PATH}" + export CLAR_SUMMARY="${BUILD_DIR}/results_${1}.xml" + "${CTEST}" -V -R "^${1}$" + ) || RETURN_CODE=$? && true if [ "$RETURN_CODE" -eq 0 ]; then FAILED=0 @@ -96,9 +102,21 @@ run_test() { fi } +indent() { sed "s/^/ /"; } + +if [[ "$(uname -s)" == MINGW* ]]; then + BUILD_PATH=$(cygpath "$BUILD_PATH") +fi + + # Configure the test environment; run them early so that we're certain # that they're started by the time we need them. +echo "CTest version:" +env PATH="${BUILD_PATH}" "${CTEST}" --version | head -1 2>&1 | indent + +echo "" + echo "##############################################################################" echo "## Configuring test environment" echo "##############################################################################" @@ -386,7 +404,7 @@ if [ -z "$SKIP_FUZZERS" ]; then echo "## Running fuzzers" echo "##############################################################################" - ctest -V -R 'fuzzer' + env PATH="${BUILD_PATH}" "${CTEST}" -V -R 'fuzzer' fi cleanup |