run.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 gen-tests' --no-run
  25. qemu-arm-static target/${1}/debug/$t-*
  26. xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
  27. qemu-arm-static target/${1}/release/$t-*
  28. done
  29. ;;
  30. *)
  31. cargo test --no-default-features --features gen-tests --target $1
  32. cargo test --no-default-features --features 'gen-tests c' --target $1
  33. cargo test --no-default-features --features gen-tests --target $1 --release
  34. cargo test --no-default-features --features 'gen-tests c' --target $1 --release
  35. ;;
  36. esac
  37. # Verify that we haven't drop any intrinsic/symbol
  38. case $1 in
  39. thumb*)
  40. xargo build --features c --target $1 --example intrinsics
  41. ;;
  42. *)
  43. cargo build --no-default-features --features c --target $1 --example intrinsics
  44. ;;
  45. esac
  46. # Verify that there are no undefined symbols to `panic` within our implementations
  47. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  48. case $1 in
  49. thumb*)
  50. RUSTFLAGS="-C debug-assertions=no" xargo rustc --no-default-features --features c --target $1 --example intrinsics -- -C lto -C link-arg=-nostartfiles
  51. xargo rustc --no-default-features --features c --target $1 --example intrinsics --release -- -C lto
  52. ;;
  53. *)
  54. RUSTFLAGS="-C debug-assertions=no" cargo rustc --no-default-features --features c --target $1 --example intrinsics -- -C lto
  55. cargo rustc --no-default-features --features c --target $1 --example intrinsics --release -- -C lto
  56. ;;
  57. esac
  58. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  59. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  60. case $1 in
  61. armv7-*)
  62. PREFIX=arm-linux-gnueabihf-
  63. ;;
  64. thumb*)
  65. PREFIX=arm-none-eabi-
  66. ;;
  67. *86*-*)
  68. PREFIX=
  69. ;;
  70. esac
  71. case $TRAVIS_OS_NAME in
  72. osx)
  73. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  74. # Use GNU nm instead
  75. NM=gnm
  76. brew install binutils
  77. ;;
  78. *)
  79. NM=nm
  80. ;;
  81. esac
  82. if [ $TRAVIS_OS_NAME = osx ]; then
  83. path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
  84. else
  85. path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
  86. fi
  87. for rlib in $(echo $path); do
  88. stdout=$($PREFIX$NM -g --defined-only $rlib)
  89. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  90. set +e
  91. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  92. if test $? = 0; then
  93. exit 1
  94. fi
  95. done
  96. true