run.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. set -ex
  2. # Test our implementation
  3. case $1 in
  4. thumb*)
  5. for t in $(ls tests); do
  6. t=${t%.rs}
  7. # TODO(#154) enable these tests when aeabi_*mul are implemented
  8. case $t in
  9. powi*f2)
  10. continue
  11. ;;
  12. esac
  13. # FIXME(#150) debug assertion in divmoddi4
  14. case $1 in
  15. thumbv6m-*)
  16. case $t in
  17. divdi3 | divmoddi4 | moddi3 | modsi3 | udivmoddi4 | udivmodsi4 | umoddi3 | \
  18. umodsi3)
  19. continue
  20. ;;
  21. esac
  22. ;;
  23. esac
  24. xargo test --test $t --target $1 --features mem --no-run
  25. qemu-arm-static target/${1}/debug/$t-*
  26. xargo test --test $t --target $1 --features mem --no-run --release
  27. qemu-arm-static target/${1}/release/$t-*
  28. done
  29. ;;
  30. *)
  31. cargo test --no-default-features --target $1
  32. cargo test --no-default-features --target $1 --release
  33. ;;
  34. esac
  35. # Verify that we haven't drop any intrinsic/symbol
  36. case $1 in
  37. thumb*)
  38. xargo build --features c --target $1 --bin intrinsics
  39. ;;
  40. *)
  41. cargo build --no-default-features --features c --target $1 --bin intrinsics
  42. ;;
  43. esac
  44. # Verify that there are no undefined symbols to `panic` within our implementations
  45. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  46. case $1 in
  47. thumb*)
  48. RUSTFLAGS="-C debug-assertions=no" xargo rustc --no-default-features --features c --target $1 --bin intrinsics -- -C lto -C link-arg=-nostartfiles
  49. xargo rustc --no-default-features --features c --target $1 --bin intrinsics --release -- -C lto
  50. ;;
  51. *)
  52. RUSTFLAGS="-C debug-assertions=no" cargo rustc --no-default-features --features c --target $1 --bin intrinsics -- -C lto
  53. cargo rustc --no-default-features --features c --target $1 --bin intrinsics --release -- -C lto
  54. ;;
  55. esac
  56. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  57. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  58. case $1 in
  59. armv7-*)
  60. PREFIX=arm-linux-gnueabihf-
  61. ;;
  62. thumb*)
  63. PREFIX=arm-none-eabi-
  64. ;;
  65. *86*-*)
  66. PREFIX=
  67. ;;
  68. esac
  69. case $TRAVIS_OS_NAME in
  70. osx)
  71. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  72. # Use GNU nm instead
  73. NM=gnm
  74. brew install binutils
  75. ;;
  76. *)
  77. NM=nm
  78. ;;
  79. esac
  80. if [ $TRAVIS_OS_NAME = osx ]; then
  81. path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
  82. else
  83. path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
  84. fi
  85. for rlib in $(echo $path); do
  86. stdout=$($PREFIX$NM -g --defined-only $rlib)
  87. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  88. set +e
  89. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  90. if test $? = 0; then
  91. exit 1
  92. fi
  93. done
  94. true