run.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. set -e
  2. # Test our implementation
  3. case $1 in
  4. thumb*)
  5. xargo build --target $1
  6. xargo build --target $1 --release
  7. ;;
  8. # QEMU crashes even when executing the simplest cross compiled C program:
  9. # `int main() { return 0; }`
  10. powerpc64le-unknown-linux-gnu)
  11. cargo test --target $1 --no-run
  12. cargo test --target $1 --no-run --release
  13. ;;
  14. *)
  15. cargo test --target $1
  16. cargo test --target $1 --release
  17. ;;
  18. esac
  19. # Verify that we haven't drop any intrinsic/symbol
  20. case $1 in
  21. thumb*)
  22. xargo build --features c --target $1 --bin intrinsics
  23. ;;
  24. *)
  25. cargo build --features c --target $1 --bin intrinsics
  26. ;;
  27. esac
  28. # Verify that there are no undefined symbols to `panic` within our implementations
  29. case $1 in
  30. thumb*)
  31. xargo build --features c --target $1 --bin intrinsics --release
  32. ;;
  33. *)
  34. cargo build --features c --target $1 --bin intrinsics --release
  35. ;;
  36. esac
  37. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  38. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  39. case $1 in
  40. armv7-*)
  41. PREFIX=arm-linux-gnueabihf-
  42. ;;
  43. thumb*)
  44. PREFIX=arm-none-eabi-
  45. ;;
  46. *86*-*)
  47. PREFIX=
  48. ;;
  49. esac
  50. case $TRAVIS_OS_NAME in
  51. osx)
  52. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  53. # Use GNU nm instead
  54. NM=gnm
  55. brew install binutils
  56. ;;
  57. *)
  58. NM=nm
  59. ;;
  60. esac
  61. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  62. if [ $TRAVIS_OS_NAME = osx ]; then
  63. path=target/${1}/debug/librustc_builtins.rlib
  64. else
  65. path=/target/${1}/debug/librustc_builtins.rlib
  66. fi
  67. stdout=$($PREFIX$NM -g --defined-only $path)
  68. set +e
  69. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  70. if test $? = 0; then
  71. exit 1
  72. fi