run.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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=$(find $(rustc --print sysroot) -name llvm-nm)
  31. if [ "$NM" = "" ]; then
  32. NM=${PREFIX}nm
  33. fi
  34. if [ -d /target ]; then
  35. path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
  36. else
  37. path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
  38. fi
  39. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  40. for rlib in $(echo $path); do
  41. set +x
  42. echo "================================================================"
  43. echo checking $rlib for duplicate symbols
  44. echo "================================================================"
  45. stdout=$($NM -g --defined-only $rlib 2>&1)
  46. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several
  47. # times so ignore it
  48. #
  49. # FIXME(#167) - we shouldn't ignore `__builtin_cl` style symbols here.
  50. set +e
  51. echo "$stdout" | \
  52. sort | \
  53. uniq -d | \
  54. grep -v __x86.get_pc_thunk | \
  55. grep -v __builtin_cl | \
  56. grep -v __builtin_ctz | \
  57. grep 'T __'
  58. if test $? = 0; then
  59. exit 1
  60. fi
  61. set -ex
  62. done
  63. rm -f $path
  64. # Verify that we haven't drop any intrinsic/symbol
  65. build_intrinsics="$cargo build --target $1 -v --example intrinsics"
  66. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics
  67. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --release
  68. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c
  69. RUSTFLAGS="-C debug-assertions=no" $build_intrinsics --features c --release
  70. # Verify that there are no undefined symbols to `panic` within our
  71. # implementations
  72. #
  73. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  74. if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
  75. RUSTFLAGS="-C debug-assertions=no" \
  76. CARGO_INCREMENTAL=0 \
  77. CARGO_PROFILE_DEV_LTO=true \
  78. $cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics
  79. fi
  80. CARGO_PROFILE_RELEASE_LTO=true \
  81. $cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release
  82. # Ensure no references to a panicking function
  83. for rlib in $(echo $path); do
  84. set +ex
  85. $NM -u $rlib 2>&1 | grep panicking
  86. if test $? = 0; then
  87. exit 1
  88. fi
  89. set -ex
  90. done
  91. true