2016-08-08 05:55:30 +08:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
. $(dirname $0)/env.sh
|
|
|
|
|
2016-08-23 07:03:21 +08:00
|
|
|
gist_it() {
|
2016-08-24 09:46:36 +08:00
|
|
|
gist -d "'$TARGET/rustc-builtins.rlib' from commit '$TRAVIS_COMMIT' on branch '$TRAVIS_BRANCH'"
|
2016-08-22 05:51:50 +08:00
|
|
|
echo "Disassembly available at the above URL."
|
|
|
|
}
|
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
build() {
|
2016-09-23 03:46:05 +08:00
|
|
|
if [[ $WEAK ]]; then
|
|
|
|
$CARGO build --features weak --target $TARGET
|
|
|
|
$CARGO build --features weak --target $TARGET --release
|
|
|
|
else
|
|
|
|
$CARGO build --target $TARGET
|
|
|
|
$CARGO build --target $TARGET --release
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
2016-08-14 06:22:12 +08:00
|
|
|
inspect() {
|
|
|
|
$PREFIX$NM -g --defined-only target/**/debug/*.rlib
|
2016-08-14 01:26:58 +08:00
|
|
|
|
2016-08-14 06:22:12 +08:00
|
|
|
set +e
|
2016-08-24 09:46:36 +08:00
|
|
|
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib | gist_it
|
2016-08-23 07:03:21 +08:00
|
|
|
set -e
|
|
|
|
|
2016-09-23 03:46:05 +08:00
|
|
|
# Check presence/absence of weak symbols
|
|
|
|
if [[ $WEAK ]]; then
|
2016-08-23 07:03:21 +08:00
|
|
|
local symbols=( memcmp memcpy memmove memset )
|
|
|
|
for symbol in "${symbols[@]}"; do
|
2016-09-23 03:46:05 +08:00
|
|
|
$PREFIX$NM target/$TARGET/debug/deps/librlibc-*.rlib | grep -q "W $symbol"
|
2016-08-23 07:03:21 +08:00
|
|
|
done
|
2016-09-23 03:46:05 +08:00
|
|
|
else
|
|
|
|
set +e
|
|
|
|
ls target/$TARGET/debug/deps/librlibc-*.rlib
|
|
|
|
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
2016-08-23 07:03:21 +08:00
|
|
|
fi
|
|
|
|
|
2016-08-14 06:22:12 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
run_tests() {
|
|
|
|
if [[ $QEMU_LD_PREFIX ]]; then
|
|
|
|
export RUST_TEST_THREADS=1
|
2016-08-08 05:55:30 +08:00
|
|
|
fi
|
|
|
|
|
2016-08-30 08:31:49 +08:00
|
|
|
if [[ $RUN_TESTS == y ]]; then
|
2016-08-09 09:04:17 +08:00
|
|
|
cargo test --target $TARGET
|
|
|
|
cargo test --target $TARGET --release
|
|
|
|
fi
|
2016-08-08 06:03:44 +08:00
|
|
|
}
|
2016-08-08 05:55:30 +08:00
|
|
|
|
|
|
|
main() {
|
2016-08-30 08:31:49 +08:00
|
|
|
if [[ $LINUX && ${IN_DOCKER_CONTAINER:-n} == n ]]; then
|
2016-08-30 10:21:59 +08:00
|
|
|
# NOTE The Dockerfile of this image is in the docker branch of this repository
|
2016-08-09 09:37:04 +08:00
|
|
|
docker run \
|
2016-08-14 06:22:12 +08:00
|
|
|
--privileged \
|
|
|
|
-e IN_DOCKER_CONTAINER=y \
|
2016-08-09 09:37:04 +08:00
|
|
|
-e TARGET=$TARGET \
|
2016-08-23 07:03:21 +08:00
|
|
|
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
|
|
|
|
-e TRAVIS_COMMIT=$TRAVIS_COMMIT \
|
2016-08-09 09:37:04 +08:00
|
|
|
-e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
|
2016-09-23 03:46:05 +08:00
|
|
|
-e WEAK=$WEAK \
|
2016-08-09 09:41:08 +08:00
|
|
|
-v $(pwd):/mnt \
|
2016-08-30 10:21:59 +08:00
|
|
|
japaric/rustc-builtins \
|
2016-08-30 08:31:49 +08:00
|
|
|
sh -c 'cd /mnt;
|
2016-08-09 10:02:07 +08:00
|
|
|
bash ci/install.sh;
|
|
|
|
bash ci/script.sh'
|
2016-08-09 09:37:04 +08:00
|
|
|
else
|
|
|
|
build
|
|
|
|
inspect
|
2016-08-14 00:32:52 +08:00
|
|
|
run_tests
|
2016-08-09 09:37:04 +08:00
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|