run.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. set -ex
  2. cargo=cargo
  3. # Test our implementation
  4. if [ "$XARGO" = "1" ]; then
  5. # FIXME: currently these tests don't work...
  6. echo nothing to do
  7. else
  8. run="cargo test --manifest-path testcrate/Cargo.toml --target $1"
  9. $run
  10. $run --release
  11. $run --features c
  12. $run --features c --release
  13. fi
  14. cargo build --target $1
  15. cargo build --target $1 --release
  16. cargo build --target $1 --features c
  17. cargo build --target $1 --release --features c
  18. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  19. case $1 in
  20. armv7-*)
  21. PREFIX=arm-linux-gnueabihf-
  22. ;;
  23. thumb*)
  24. PREFIX=arm-none-eabi-
  25. ;;
  26. *86*-*)
  27. PREFIX=
  28. ;;
  29. esac
  30. NM=nm
  31. if [ -d /target ]; then
  32. path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
  33. else
  34. path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
  35. fi
  36. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  37. for rlib in $(echo $path); do
  38. set +x
  39. echo "================================================================"
  40. echo checking $rlib for duplicate symbols
  41. echo "================================================================"
  42. stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)
  43. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several
  44. # times so ignore it
  45. #
  46. # FIXME(#167) - we shouldn't ignore `__builtin_cl` style symbols here.
  47. set +e
  48. echo "$stdout" | \
  49. sort | \
  50. uniq -d | \
  51. grep -v __x86.get_pc_thunk | \
  52. grep -v __builtin_cl | \
  53. grep -v __builtin_ctz | \
  54. grep 'T __'
  55. if test $? = 0; then
  56. exit 1
  57. fi
  58. set -ex
  59. done
  60. rm -f $path
  61. # Verify that we haven't drop any intrinsic/symbol
  62. build_intrinsics="$cargo build --target $1 -v --example intrinsics"
  63. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics
  64. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --release
  65. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c
  66. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c --release
  67. # Verify that there are no undefined symbols to `panic` within our
  68. # implementations
  69. #
  70. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  71. if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
  72. RUSTFLAGS="-C debug-assertions=no" \
  73. CARGO_INCREMENTAL=0 \
  74. $cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -- -C lto
  75. fi
  76. $cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release -- -C lto
  77. # Ensure no references to a panicking function
  78. for rlib in $(echo $path); do
  79. set +ex
  80. $PREFIX$NM -u $rlib 2>&1 | grep panicking
  81. if test $? = 0; then
  82. exit 1
  83. fi
  84. set -ex
  85. done
  86. true