compiler-builtins-zynq/ci/script.sh

81 lines
1.9 KiB
Bash
Raw Normal View History

2016-08-08 05:55:30 +08:00
set -ex
. $(dirname $0)/env.sh
gist_it() {
gist -d "'$TARGET/rustc-builtins.rlib' from commit '$TRAVIS_COMMIT' on branch '$TRAVIS_BRANCH'"
echo "Disassembly available at the above URL."
}
2016-08-08 06:03:44 +08:00
build() {
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
}
inspect() {
$PREFIX$NM -g --defined-only target/**/debug/*.rlib
2016-08-14 01:26:58 +08:00
set +e
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib | gist_it
set -e
# Check presence/absence of weak symbols
if [[ $WEAK ]]; then
local symbols=( memcmp memcpy memmove memset )
for symbol in "${symbols[@]}"; do
$PREFIX$NM target/$TARGET/debug/deps/librlibc-*.rlib | grep -q "W $symbol"
done
else
set +e
ls target/$TARGET/debug/deps/librlibc-*.rlib
if [[ $? == 0 ]]; then
exit 1
fi
set -e
fi
}
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 \
--privileged \
-e IN_DOCKER_CONTAINER=y \
2016-08-09 09:37:04 +08:00
-e TARGET=$TARGET \
-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 \
-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