run.sh 2.7 KB

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