run.sh 3.5 KB

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