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-04 12:10:30 +00:00
|
|
|
# FIXME: workaround cargo breaking Travis-CI again:
|
|
|
|
# https://github.com/rust-lang/cargo/issues/5721
|
|
|
|
if [ "$TRAVIS" = "true" ]
|
|
|
|
then
|
|
|
|
export TERM=dumb
|
|
|
|
fi
|
|
|
|
|
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-11-06 17:37:27 +00:00
|
|
|
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "x86_64-apple-darwin" ]
|
|
|
|
then
|
2020-07-17 13:22:46 +00:00
|
|
|
# Not using tee to avoid too much logs that exceeds travis' limit.
|
|
|
|
if ! ${CARGO_CMD} build -vv --target "${TARGET}" > build_no_std.txt 2>&1; then
|
|
|
|
tail -n 1024 build_no_std.txt
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-11-06 17:37:27 +00:00
|
|
|
|
|
|
|
# Check that the no-std builds are not linked against a libc with default
|
|
|
|
# features or the `use_std` feature enabled:
|
|
|
|
! grep -q "default" build_no_std.txt
|
|
|
|
! grep -q "use_std" build_no_std.txt
|
|
|
|
|
|
|
|
RUST_SYS_ROOT=$(rustc --target="${TARGET}" --print sysroot)
|
|
|
|
RUST_LLVM_NM="${RUST_SYS_ROOT}/lib/rustlib/${TARGET}/bin/llvm-nm"
|
|
|
|
|
|
|
|
find target/ -iname '*jemalloc*.rlib' | while read -r rlib; do
|
|
|
|
echo "${RUST_LLVM_NM} ${rlib}"
|
|
|
|
! $RUST_LLVM_NM "${rlib}" | grep "std"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}"
|
2019-04-03 10:47:51 +00:00
|
|
|
|
|
|
|
if [ "${JEMALLOC_SYS_GIT_DEV_BRANCH}" = "1" ]; then
|
|
|
|
# FIXME: profiling tests broken on dev-branch
|
|
|
|
# https://github.com/jemalloc/jemalloc/issues/1477
|
|
|
|
:
|
|
|
|
else
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" --features profiling
|
2019-04-03 10:47:51 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" --features debug
|
|
|
|
${CARGO_CMD} test --target "${TARGET}" --features stats
|
2019-04-03 10:47:51 +00:00
|
|
|
if [ "${JEMALLOC_SYS_GIT_DEV_BRANCH}" = "1" ]; then
|
|
|
|
# FIXME: profiling tests broken on dev-branch
|
|
|
|
# https://github.com/jemalloc/jemalloc/issues/1477
|
|
|
|
:
|
|
|
|
else
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" --features 'debug profiling'
|
2019-04-03 10:47:51 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" \
|
2018-11-04 13:03:39 +00:00
|
|
|
--features unprefixed_malloc_on_supported_platforms
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" --no-default-features
|
|
|
|
${CARGO_CMD} test --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
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" --features background_threads
|
2018-10-24 13:00:40 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" --release
|
|
|
|
${CARGO_CMD} test --target "${TARGET}" --manifest-path jemalloc-sys/Cargo.toml
|
|
|
|
${CARGO_CMD} test --target "${TARGET}" \
|
2018-11-04 13:03:39 +00:00
|
|
|
--manifest-path jemalloc-sys/Cargo.toml \
|
|
|
|
--features unprefixed_malloc_on_supported_platforms
|
2018-11-07 22:31:35 +00:00
|
|
|
|
|
|
|
# FIXME: jemalloc-ctl fails in the following targets
|
|
|
|
case "${TARGET}" in
|
|
|
|
"i686-unknown-linux-musl") ;;
|
2018-11-09 17:29:14 +00:00
|
|
|
"x86_64-unknown-linux-musl") ;;
|
2018-11-07 22:31:35 +00:00
|
|
|
*)
|
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" \
|
2018-11-07 22:31:35 +00:00
|
|
|
--manifest-path jemalloc-ctl/Cargo.toml \
|
|
|
|
--no-default-features
|
|
|
|
# FIXME: cross fails to pass features to jemalloc-ctl
|
2020-07-17 13:22:46 +00:00
|
|
|
# ${CARGO_CMD} test --target "${TARGET}" \
|
2018-11-07 22:31:35 +00:00
|
|
|
# --manifest-path jemalloc-ctl \
|
|
|
|
# --no-default-features --features use_std
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" -p systest
|
|
|
|
${CARGO_CMD} test --target "${TARGET}" \
|
2018-11-04 13:03:39 +00:00
|
|
|
--manifest-path jemallocator-global/Cargo.toml
|
2020-07-17 13:22:46 +00:00
|
|
|
${CARGO_CMD} test --target "${TARGET}" \
|
2018-11-04 13:03:39 +00:00
|
|
|
--manifest-path jemallocator-global/Cargo.toml \
|
|
|
|
--features force_global_jemalloc
|
2018-10-24 11:50:17 +00:00
|
|
|
|
2020-07-17 13:22:46 +00:00
|
|
|
# FIXME: Re-enable following test when allocator API is stable again.
|
|
|
|
# if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]
|
|
|
|
# then
|
|
|
|
# # The Alloc trait is unstable:
|
|
|
|
# ${CARGO_CMD} test --target "${TARGET}" --features alloc_trait
|
|
|
|
# fi
|