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.

174 lines
3.5 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. #!/bin/bash
  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. make test-resources -j$N_JOBS
  32. make l3pp_ext -j$N_JOBS
  33. make sylvan -j$N_JOBS
  34. travis_fold end make_dep
  35. ;;
  36. BuildLib1)
  37. # Make libstorm (first try)
  38. travis_fold start make_lib
  39. cd build
  40. make storm -j$N_JOBS
  41. travis_fold end make_lib
  42. ;;
  43. BuildLib)
  44. # Make libstorm
  45. travis_fold start make_lib
  46. cd build
  47. make storm -j$N_JOBS
  48. travis_fold end make_lib
  49. ;;
  50. BuildAll)
  51. # Make all
  52. travis_fold start make_all
  53. cd build
  54. make -j$N_JOBS
  55. travis_fold end make_all
  56. ;;
  57. TestAll)
  58. # Test all
  59. travis_fold start test_all
  60. cd build
  61. ctest test --output-on-failure
  62. travis_fold end test_all
  63. ;;
  64. *)
  65. echo "Unrecognized value of run: $1"
  66. exit 1
  67. esac
  68. }
  69. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  70. # ignored).
  71. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  72. case $COMPILER in
  73. gcc-4.8)
  74. export CC=gcc-4.8
  75. export CXX=g++-4.8
  76. ;;
  77. gcc-4.9)
  78. export CC=gcc-4.9
  79. export CXX=g++-4.9
  80. ;;
  81. gcc-5)
  82. export CC=gcc-5
  83. export CXX=g++-5
  84. ;;
  85. gcc-6)
  86. export CC=gcc-6
  87. export CXX=g++-6
  88. ;;
  89. gcc-default)
  90. export CC=gcc
  91. export CXX=g++
  92. ;;
  93. clang-3.5)
  94. export CC=clang-3.5
  95. export CXX=clang++-3.5
  96. ;;
  97. clang-3.6)
  98. export CC=clang-3.6
  99. export CXX=clang++-3.6
  100. ;;
  101. clang-3.7)
  102. export CC=clang-3.7
  103. export CXX=clang++-3.7
  104. ;;
  105. clang-3.8)
  106. export CC=clang-3.8
  107. export CXX=clang++-3.8
  108. ;;
  109. clang-3.9)
  110. export CC=clang-3.9
  111. export CXX=clang++-3.9
  112. ;;
  113. clang-4.0)
  114. case "$OS" in
  115. linux)
  116. export CC=clang-4.0
  117. export CXX=clang++-4.0
  118. ;;
  119. osx)
  120. export CC=/usr/local/opt/llvm/bin/clang-4.0
  121. export CXX=/usr/local/opt/llvm/bin/clang++
  122. ;;
  123. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  124. esac
  125. ;;
  126. clang-default)
  127. export CC=clang
  128. export CXX=clang++
  129. ;;
  130. *)
  131. echo "Unrecognized value of COMPILER: $COMPILER"
  132. exit 1
  133. esac
  134. # Build
  135. echo CXX version: $($CXX --version)
  136. 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)
  137. 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))
  138. case "$1" in
  139. DefaultDebug) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
  140. DefaultRelease) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
  141. *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;;
  142. esac
  143. # Restore timestamps of files
  144. travis_fold start mtime
  145. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  146. travis_fold end mtime
  147. run "$2"