script.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. set -ex
  2. . $(dirname $0)/env.sh
  3. gist_it() {
  4. gist -d "'$TARGET/rustc-builtins.rlib' from commit '$TRAVIS_COMMIT' on branch '$TRAVIS_BRANCH'"
  5. echo "Disassembly available at the above URL."
  6. }
  7. build() {
  8. $CARGO build --target $TARGET
  9. $CARGO build --target $TARGET --release
  10. }
  11. inspect() {
  12. $PREFIX$NM -g --defined-only target/**/debug/*.rlib
  13. set +e
  14. $PREFIX$OBJDUMP -Cd target/**/release/*.rlib | gist_it
  15. set -e
  16. # Check presence of weak symbols
  17. if [[ $LINUX ]]; then
  18. local symbols=( memcmp memcpy memmove memset )
  19. for symbol in "${symbols[@]}"; do
  20. $PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol"
  21. done
  22. fi
  23. }
  24. run_tests() {
  25. if [[ $QEMU_LD_PREFIX ]]; then
  26. export RUST_TEST_THREADS=1
  27. fi
  28. if [[ $RUN_TESTS == y ]]; then
  29. cargo test --target $TARGET
  30. cargo test --target $TARGET --release
  31. fi
  32. }
  33. main() {
  34. if [[ $LINUX && ${IN_DOCKER_CONTAINER:-n} == n ]]; then
  35. local tag=2016-08-24
  36. docker run \
  37. --privileged \
  38. -e IN_DOCKER_CONTAINER=y \
  39. -e TARGET=$TARGET \
  40. -e TRAVIS_BRANCH=$TRAVIS_BRANCH \
  41. -e TRAVIS_COMMIT=$TRAVIS_COMMIT \
  42. -e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
  43. -v $(pwd):/mnt \
  44. japaric/rustc-builtins:$tag \
  45. sh -c 'cd /mnt;
  46. bash ci/install.sh;
  47. bash ci/script.sh'
  48. else
  49. build
  50. inspect
  51. run_tests
  52. fi
  53. }
  54. main