2018-05-02 14:06:16 +00:00
|
|
|
#!/usr/bin/env sh
|
2018-05-02 09:33:27 +00:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2018-10-24 11:50:17 +00:00
|
|
|
: "${TARGET?The TARGET environment variable must be set.}"
|
2018-05-02 09:33:27 +00:00
|
|
|
|
2018-07-11 18:29:10 +00:00
|
|
|
echo "Running tests for target: ${TARGET}, Rust version=${TRAVIS_RUST_VERSION}"
|
2018-05-02 09:33:27 +00:00
|
|
|
export RUST_BACKTRACE=1
|
|
|
|
export RUST_TEST_THREADS=1
|
|
|
|
export RUST_TEST_NOCAPTURE=1
|
|
|
|
export CARGO_CMD=cross
|
|
|
|
|
2018-11-03 15:53:36 +00:00
|
|
|
# Runs jemalloc tests when building jemalloc-sys (runs "make check"):
|
|
|
|
if [ "${NO_JEMALLOC_TESTS}" = "1" ]
|
|
|
|
then
|
|
|
|
echo "jemalloc's tests are not run"
|
|
|
|
else
|
|
|
|
export JEMALLOC_SYS_RUN_JEMALLOC_TESTS=1
|
|
|
|
fi
|
2018-05-02 09:33:27 +00:00
|
|
|
|
|
|
|
# Use cargo on native CI platforms:
|
2018-10-24 11:50:17 +00:00
|
|
|
case "${TARGET}" in
|
|
|
|
"x86_64-unknown-linux-gnu") export CARGO_CMD=cargo ;;
|
|
|
|
*"windows"*) export CARGO_CMD=cargo ;;
|
|
|
|
*"apple"*) export CARGO_CMD=cargo ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "${CARGO_CMD}" = "cross" ]
|
|
|
|
then
|
2018-05-03 16:23:38 +00:00
|
|
|
cargo install cross || echo "cross is already installed"
|
2018-05-02 09:33:27 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-03 16:12:09 +00:00
|
|
|
if [ "${VALGRIND}" = "1" ]
|
|
|
|
then
|
|
|
|
case "${TARGET}" in
|
|
|
|
"x86_64-unknown-linux-gnu")
|
|
|
|
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER=valgrind
|
|
|
|
;;
|
|
|
|
"x86_64-apple-darwin")
|
|
|
|
export CARGO_TARGET_X86_64_APPLE_DARWIN_RUNNER=valgrind
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Specify how to run valgrind for TARGET=${TARGET}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2018-10-24 11:50:17 +00:00
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}"
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features profiling
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features debug
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features stats
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features 'debug profiling'
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features unprefixed_malloc_on_supported_platforms
|
2018-11-02 17:09:57 +00:00
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --no-default-features
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --no-default-features \
|
2018-10-24 13:00:40 +00:00
|
|
|
--features background_threads_runtime_support
|
|
|
|
|
|
|
|
if [ "${NOBGT}" = "1" ]
|
|
|
|
then
|
|
|
|
echo "enabling background threads by default at run-time is not tested"
|
|
|
|
else
|
2018-11-02 17:09:57 +00:00
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features background_threads
|
2018-10-24 13:00:40 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-24 11:50:17 +00:00
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --release
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" -p jemalloc-sys
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" -p jemalloc-sys --features unprefixed_malloc_on_supported_platforms
|
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" -p systest
|
|
|
|
|
|
|
|
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]
|
|
|
|
then
|
2018-07-12 10:51:07 +00:00
|
|
|
# The Alloc trait is unstable:
|
2018-10-24 11:50:17 +00:00
|
|
|
${CARGO_CMD} test -vv --target "${TARGET}" --features alloc_trait
|
2018-07-11 18:29:10 +00:00
|
|
|
fi
|