run.sh 2.9 KB

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