run.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. # Verify that there are no undefined symbols to `panic` within our implementations
  47. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  48. case $1 in
  49. thumb*)
  50. RUSTFLAGS="-C debug-assertions=no" xargo rustc --features 'c mem' --target $1 --example intrinsics -- -C lto -C link-arg=-nostartfiles
  51. xargo rustc --features 'c mem' --target $1 --example intrinsics --release -- -C lto
  52. ;;
  53. *)
  54. RUSTFLAGS="-C debug-assertions=no" cargo rustc --features 'c mem' --target $1 --example intrinsics -- -C lto
  55. cargo rustc --features 'c mem' --target $1 --example intrinsics --release -- -C lto
  56. ;;
  57. esac
  58. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  59. case $1 in
  60. armv7-*)
  61. PREFIX=arm-linux-gnueabihf-
  62. ;;
  63. thumb*)
  64. PREFIX=arm-none-eabi-
  65. ;;
  66. *86*-*)
  67. PREFIX=
  68. ;;
  69. esac
  70. case "$TRAVIS_OS_NAME" in
  71. osx)
  72. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  73. # Use GNU nm instead
  74. NM=gnm
  75. brew install binutils
  76. ;;
  77. *)
  78. NM=nm
  79. ;;
  80. esac
  81. if [ "$TRAVIS_OS_NAME" = osx ]; then
  82. path=target/${1}/debug/deps/libcompiler_builtins-*.rlib
  83. else
  84. path=/target/${1}/debug/deps/libcompiler_builtins-*.rlib
  85. fi
  86. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  87. for rlib in $(echo $path); do
  88. set +x
  89. stdout=$($PREFIX$NM -g --defined-only $rlib 2>&1)
  90. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  91. set +e
  92. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  93. if test $? = 0; then
  94. exit 1
  95. fi
  96. set -ex
  97. done
  98. # Ensure no references to a panicking function
  99. for rlib in $(echo $path); do
  100. set +x
  101. $PREFIX$NM -u $rlib 2>&1 | grep panicking
  102. if test $? = 0; then
  103. exit 1
  104. fi
  105. set -ex
  106. done
  107. true