You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
2.7 KiB

8 years ago
  1. #!/bin/bash -x
  2. # Inspired by https://github.com/google/fruit
  3. set -e
  4. # Helper for travis folding
  5. travis_fold() {
  6. local action=$1
  7. local name=$2
  8. echo -en "travis_fold:${action}:${name}\r"
  9. }
  10. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  11. # ignored).
  12. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  13. case $COMPILER in
  14. gcc-4.8)
  15. export CC=gcc-4.8
  16. export CXX=g++-4.8
  17. ;;
  18. gcc-4.9)
  19. export CC=gcc-4.9
  20. export CXX=g++-4.9
  21. ;;
  22. gcc-5)
  23. export CC=gcc-5
  24. export CXX=g++-5
  25. ;;
  26. gcc-6)
  27. export CC=gcc-6
  28. export CXX=g++-6
  29. ;;
  30. gcc-default)
  31. export CC=gcc
  32. export CXX=g++
  33. ;;
  34. clang-3.5)
  35. export CC=clang-3.5
  36. export CXX=clang++-3.5
  37. ;;
  38. clang-3.6)
  39. export CC=clang-3.6
  40. export CXX=clang++-3.6
  41. ;;
  42. clang-3.7)
  43. export CC=clang-3.7
  44. export CXX=clang++-3.7
  45. ;;
  46. clang-3.8)
  47. export CC=clang-3.8
  48. export CXX=clang++-3.8
  49. ;;
  50. clang-3.9)
  51. export CC=clang-3.9
  52. export CXX=clang++-3.9
  53. ;;
  54. clang-4.0)
  55. case "$OS" in
  56. linux)
  57. export CC=clang-4.0
  58. export CXX=clang++-4.0
  59. ;;
  60. osx)
  61. export CC=/usr/local/opt/llvm/bin/clang-4.0
  62. export CXX=/usr/local/opt/llvm/bin/clang++
  63. ;;
  64. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  65. esac
  66. ;;
  67. clang-default)
  68. export CC=clang
  69. export CXX=clang++
  70. ;;
  71. *)
  72. echo "Unrecognized value of COMPILER: $COMPILER"
  73. exit 1
  74. esac
  75. # Build
  76. echo CXX version: $($CXX --version)
  77. echo C++ Standard library location: $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)
  78. echo Normalized C++ Standard library location: $(readlink -f $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1))
  79. case "$1" in
  80. DefaultDebug) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
  81. DefaultRelease) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
  82. *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;;
  83. esac
  84. # Restore timestamps of files
  85. travis_fold start mtime
  86. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  87. travis_fold end mtime
  88. # CMake
  89. travis_fold start cmake
  90. mkdir -p build
  91. cd build
  92. cmake .. "${CMAKE_ARGS[@]}"
  93. echo
  94. echo "Content of CMakeFiles/CMakeError.log:"
  95. if [ -f "CMakeFiles/CMakeError.log" ]
  96. then
  97. cat CMakeFiles/CMakeError.log
  98. fi
  99. echo
  100. travis_fold end cmake
  101. # Make
  102. travis_fold start make
  103. #make storm -j$N_JOBS
  104. #make resources -j$N_JOBS
  105. make -j$N_JOBS
  106. travis_fold end make
  107. # Make
  108. travis_fold start tests
  109. ctest test --output-on-failure
  110. travis_fold end tests