run.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. set -ex
  2. case $1 in
  3. thumb*)
  4. cargo=xargo
  5. ;;
  6. *)
  7. cargo=cargo
  8. ;;
  9. esac
  10. INTRINSICS_FEATURES="c"
  11. if [ -z "$INTRINSICS_FAILS_WITH_MEM_FEATURE" ]; then
  12. INTRINSICS_FEATURES="$INTRINSICS_FEATURES mem"
  13. fi
  14. # Test our implementation
  15. case $1 in
  16. thumb*)
  17. for t in $(ls tests); do
  18. t=${t%.rs}
  19. # TODO(#154) enable these tests when aeabi_*mul are implemented
  20. case $t in
  21. powi*f2)
  22. continue
  23. ;;
  24. esac
  25. # FIXME(#150) debug assertion in divmoddi4
  26. case $1 in
  27. thumbv6m-*)
  28. case $t in
  29. divdi3 | divmoddi4 | moddi3 | modsi3 | udivmoddi4 | udivmodsi4 | umoddi3 | \
  30. umodsi3)
  31. continue
  32. ;;
  33. esac
  34. ;;
  35. esac
  36. xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
  37. qemu-arm-static target/${1}/debug/$t-*
  38. xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
  39. qemu-arm-static target/${1}/release/$t-*
  40. done
  41. ;;
  42. *)
  43. cargo test --no-default-features --features gen-tests --target $1
  44. cargo test --no-default-features --features 'gen-tests c' --target $1
  45. cargo test --no-default-features --features gen-tests --target $1 --release
  46. cargo test --no-default-features --features 'gen-tests c' --target $1 --release
  47. ;;
  48. esac
  49. # Verify that we haven't drop any intrinsic/symbol
  50. $cargo build --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics
  51. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  52. case $1 in
  53. armv7-*)
  54. PREFIX=arm-linux-gnueabihf-
  55. ;;
  56. thumb*)
  57. PREFIX=arm-none-eabi-
  58. ;;
  59. *86*-*)
  60. PREFIX=
  61. ;;
  62. esac
  63. case "$TRAVIS_OS_NAME" in
  64. osx)
  65. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  66. # Use GNU nm instead
  67. NM=gnm
  68. brew install binutils
  69. ;;
  70. *)
  71. NM=nm
  72. ;;
  73. esac
  74. if [ -d /target ]; then
  75. path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
  76. else
  77. path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
  78. fi
  79. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  80. for rlib in $(echo $path); do
  81. set +x
  82. stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)
  83. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  84. set +e
  85. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  86. if test $? = 0; then
  87. exit 1
  88. fi
  89. set -ex
  90. done
  91. rm -f $path
  92. # Verify that there are no undefined symbols to `panic` within our implementations
  93. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  94. if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
  95. RUSTFLAGS="-C debug-assertions=no" \
  96. $cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics -- -C lto
  97. fi
  98. $cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release -- -C lto
  99. # Ensure no references to a panicking function
  100. for rlib in $(echo $path); do
  101. set +ex
  102. $PREFIX$NM -u $rlib 2>&1 | grep panicking
  103. if test $? = 0; then
  104. exit 1
  105. fi
  106. set -ex
  107. done
  108. true