compiler-builtins-zynq/ci/run.sh

126 lines
3.5 KiB
Bash
Raw Normal View History

set -ex
2016-09-30 07:50:04 +08:00
# Test our implementation
case $1 in
thumb*)
for t in $(ls tests); do
t=${t%.rs}
# TODO(#154) enable these tests when aeabi_*mul are implemented
case $t in
powi*f2)
continue
;;
esac
# FIXME(#150) debug assertion in divmoddi4
case $1 in
thumbv6m-*)
case $t in
divdi3 | divmoddi4 | moddi3 | modsi3 | udivmoddi4 | udivmodsi4 | umoddi3 | \
umodsi3)
continue
;;
esac
;;
esac
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
qemu-arm-static target/${1}/debug/$t-*
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
qemu-arm-static target/${1}/release/$t-*
done
2016-09-30 07:50:04 +08:00
;;
*)
cargo test --no-default-features --features gen-tests --target $1
cargo test --no-default-features --features 'gen-tests c' --target $1
cargo test --no-default-features --features gen-tests --target $1 --release
cargo test --no-default-features --features 'gen-tests c' --target $1 --release
2016-09-30 07:50:04 +08:00
;;
esac
# Verify that we haven't drop any intrinsic/symbol
case $1 in
thumb*)
2017-06-24 00:59:49 +08:00
xargo build --features 'c mem' --target $1 --example intrinsics
2016-09-30 07:50:04 +08:00
;;
*)
2017-06-24 00:59:49 +08:00
cargo build --features 'c mem' --target $1 --example intrinsics
2016-09-30 07:50:04 +08:00
;;
esac
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
2016-09-30 07:50:04 +08:00
case $1 in
armv7-*)
PREFIX=arm-linux-gnueabihf-
;;
thumb*)
PREFIX=arm-none-eabi-
;;
*86*-*)
2016-09-30 07:50:04 +08:00
PREFIX=
;;
esac
2017-06-24 01:44:29 +08:00
case "$TRAVIS_OS_NAME" in
2016-09-30 07:50:04 +08:00
osx)
# NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
# Use GNU nm instead
NM=gnm
2016-09-30 07:50:04 +08:00
brew install binutils
;;
*)
NM=nm
;;
esac
2017-06-24 01:44:29 +08:00
if [ "$TRAVIS_OS_NAME" = osx ]; then
path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
2016-10-08 03:29:34 +08:00
else
path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
2016-10-08 03:29:34 +08:00
fi
2017-06-24 02:52:22 +08:00
# Look out for duplicated symbols when we include the compiler-rt (C) implementation
for rlib in $(echo $path); do
2017-06-24 01:44:29 +08:00
set +x
stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
set +e
echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
2016-09-30 07:50:04 +08:00
if test $? = 0; then
exit 1
fi
2017-06-24 01:44:29 +08:00
set -ex
done
rm -f $path
# Verify that there are no undefined symbols to `panic` within our implementations
# TODO(#79) fix the undefined references problem for debug-assertions+lto
case $1 in
thumb*)
RUSTFLAGS="-C debug-assertions=no" xargo rustc --features 'c mem' --target $1 --example intrinsics -- -C lto -C link-arg=-nostartfiles
xargo rustc --features 'c mem' --target $1 --example intrinsics --release -- -C lto
;;
*)
RUSTFLAGS="-C debug-assertions=no" cargo rustc --features 'c mem' --target $1 --example intrinsics -- -C lto
cargo rustc --features 'c mem' --target $1 --example intrinsics --release -- -C lto
;;
esac
2017-06-24 02:52:22 +08:00
# Ensure no references to a panicking function
for rlib in $(echo $path); do
set +ex
2017-06-24 02:52:22 +08:00
$PREFIX$NM -u $rlib 2>&1 | grep panicking
if test $? = 0; then
exit 1
fi
set -ex
done
true