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.

163 lines
3.3 KiB

8 years ago
8 years ago
8 years ago
8 years ago
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. # Helper for distinguishing between different runs
  11. run() {
  12. case "$1" in
  13. BuildDep)
  14. # CMake
  15. travis_fold start cmake
  16. rm -rf build
  17. mkdir build
  18. cd build
  19. cmake .. "${CMAKE_ARGS[@]}"
  20. echo
  21. echo "Content of CMakeFiles/CMakeError.log:"
  22. if [ -f "CMakeFiles/CMakeError.log" ]
  23. then
  24. cat CMakeFiles/CMakeError.log
  25. fi
  26. echo
  27. travis_fold end cmake
  28. # Make resources
  29. travis_fold start make_dep
  30. make resources -j$N_JOBS
  31. travis_fold end make_dep
  32. ;;
  33. BuildLib)
  34. # Make libstorm
  35. travis_fold start make_lib
  36. cd build
  37. make storm -j$N_JOBS
  38. travis_fold end make_lib
  39. ;;
  40. BuildAll)
  41. # Make all
  42. travis_fold start make_all
  43. cd build
  44. make -j$N_JOBS
  45. travis_fold end make_all
  46. ;;
  47. TestAll)
  48. # Test all
  49. travis_fold start test_all
  50. cd build
  51. ctest test --output-on-failure
  52. travis_fold end test_all
  53. ;;
  54. *)
  55. echo "Unrecognized value of run: $1"
  56. exit 1
  57. esac
  58. }
  59. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  60. # ignored).
  61. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  62. case $COMPILER in
  63. gcc-4.8)
  64. export CC=gcc-4.8
  65. export CXX=g++-4.8
  66. ;;
  67. gcc-4.9)
  68. export CC=gcc-4.9
  69. export CXX=g++-4.9
  70. ;;
  71. gcc-5)
  72. export CC=gcc-5
  73. export CXX=g++-5
  74. ;;
  75. gcc-6)
  76. export CC=gcc-6
  77. export CXX=g++-6
  78. ;;
  79. gcc-default)
  80. export CC=gcc
  81. export CXX=g++
  82. ;;
  83. clang-3.5)
  84. export CC=clang-3.5
  85. export CXX=clang++-3.5
  86. ;;
  87. clang-3.6)
  88. export CC=clang-3.6
  89. export CXX=clang++-3.6
  90. ;;
  91. clang-3.7)
  92. export CC=clang-3.7
  93. export CXX=clang++-3.7
  94. ;;
  95. clang-3.8)
  96. export CC=clang-3.8
  97. export CXX=clang++-3.8
  98. ;;
  99. clang-3.9)
  100. export CC=clang-3.9
  101. export CXX=clang++-3.9
  102. ;;
  103. clang-4.0)
  104. case "$OS" in
  105. linux)
  106. export CC=clang-4.0
  107. export CXX=clang++-4.0
  108. ;;
  109. osx)
  110. export CC=/usr/local/opt/llvm/bin/clang-4.0
  111. export CXX=/usr/local/opt/llvm/bin/clang++
  112. ;;
  113. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  114. esac
  115. ;;
  116. clang-default)
  117. export CC=clang
  118. export CXX=clang++
  119. ;;
  120. *)
  121. echo "Unrecognized value of COMPILER: $COMPILER"
  122. exit 1
  123. esac
  124. # Build
  125. echo CXX version: $($CXX --version)
  126. 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)
  127. 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))
  128. case "$1" in
  129. DefaultDebug) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
  130. DefaultRelease) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
  131. *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;;
  132. esac
  133. # Restore timestamps of files
  134. travis_fold start mtime
  135. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  136. travis_fold end mtime
  137. run "$2"