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.

161 lines
3.7 KiB

8 years ago
8 years ago
  1. #!/bin/bash
  2. set -e
  3. # Helper for travis folding
  4. travis_fold() {
  5. local action=$1
  6. local name=$2
  7. echo -en "travis_fold:${action}:${name}\r"
  8. }
  9. # Helper to write output every minute
  10. function bell() {
  11. while true; do
  12. echo "travis_wait for it..."
  13. sleep 60
  14. done
  15. }
  16. # Helper for distinguishing between different runs
  17. run() {
  18. case "$1" in
  19. Build*)
  20. if [[ "$1" == "Build1" ]]
  21. then
  22. if [[ "$CONFIG" == "*Travis" ]]
  23. then
  24. # Build Carl separately
  25. travis_fold start install_carl
  26. cd ..
  27. git clone https://github.com/smtrat/carl.git
  28. cd carl
  29. mkdir build
  30. cd build
  31. cmake .. "${CARL_CMAKE_ARGS[@]}"
  32. make lib_carl -j$N_JOBS
  33. cd ../../storm
  34. travis_fold end install_carl
  35. fi
  36. # CMake
  37. travis_fold start cmake
  38. mkdir build
  39. cd build
  40. cmake .. "${CMAKE_ARGS[@]}"
  41. echo
  42. if [ -f "CMakeFiles/CMakeError.log" ]
  43. then
  44. echo "Content of CMakeFiles/CMakeError.log:"
  45. cat CMakeFiles/CMakeError.log
  46. fi
  47. echo
  48. cd ..
  49. travis_fold end cmake
  50. fi
  51. # Make
  52. travis_fold start make
  53. cd build
  54. make -j$N_JOBS
  55. travis_fold end make
  56. # Set skip-file
  57. if [[ "$1" != "BuildLast" ]]
  58. then
  59. touch skip.txt
  60. else
  61. rm -rf skip.txt
  62. fi
  63. ;;
  64. TestAll)
  65. # Test all
  66. travis_fold start test_all
  67. cd build
  68. ctest test --output-on-failure
  69. travis_fold end test_all
  70. ;;
  71. *)
  72. echo "Unrecognized value of run: $1"
  73. exit 1
  74. esac
  75. }
  76. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  77. # ignored).
  78. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  79. case $COMPILER in
  80. gcc-6)
  81. export CC=gcc-6
  82. export CXX=g++-6
  83. ;;
  84. gcc)
  85. export CC=gcc
  86. export CXX=g++
  87. ;;
  88. clang-4)
  89. case "$OS" in
  90. linux)
  91. export CC=clang-4.0
  92. export CXX=clang++-4.0
  93. ;;
  94. osx)
  95. export CC=/usr/local/opt/llvm/bin/clang-4.0
  96. export CXX=/usr/local/opt/llvm/bin/clang++
  97. ;;
  98. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  99. esac
  100. ;;
  101. clang)
  102. export CC=clang
  103. export CXX=clang++
  104. ;;
  105. *)
  106. echo "Unrecognized value of COMPILER: $COMPILER"
  107. exit 1
  108. esac
  109. # Build
  110. echo CXX version: $($CXX --version)
  111. 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)
  112. 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))
  113. case "$CONFIG" in
  114. DefaultDebug*)
  115. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DCMAKE_CXX_FLAGS="$STLARG")
  116. CARL_CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG" -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON -DTHREAD_SAFE=ON -DBUILD_ADDONS=ON -DBUILD_ADDON_PARSER=ON)
  117. ;;
  118. DefaultRelease*)
  119. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DSTORM_DEVELOPER=OFF -DCMAKE_CXX_FLAGS="$STLARG")
  120. CARL_CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG" -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON -DTHREAD_SAFE=ON -DBUILD_ADDONS=ON -DBUILD_ADDON_PARSER=ON)
  121. ;;
  122. *)
  123. echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
  124. ;;
  125. esac
  126. # Restore timestamps of files
  127. travis_fold start mtime
  128. if [[ "$1" == "Build1" ]]
  129. then
  130. # Remove old mtime cache
  131. rm -rf travis/mtime_cache/cache.json
  132. fi
  133. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  134. travis_fold end mtime
  135. # Run and print output to avoid travis timeout
  136. bell &
  137. bellPID=$!
  138. run "$1"
  139. kill $bellPID