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
4.1 KiB

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. # CMake
  23. travis_fold start cmake
  24. mkdir build
  25. cd build
  26. cmake .. "${CMAKE_ARGS[@]}"
  27. echo
  28. if [ -f "CMakeFiles/CMakeError.log" ]
  29. then
  30. echo "Content of CMakeFiles/CMakeError.log:"
  31. cat CMakeFiles/CMakeError.log
  32. fi
  33. echo
  34. cd ..
  35. travis_fold end cmake
  36. fi
  37. # Make
  38. travis_fold start make
  39. cd build
  40. make -j$N_JOBS
  41. travis_fold end make
  42. # Set skip-file
  43. if [[ "$1" != "BuildLast" ]]
  44. then
  45. touch skip.txt
  46. else
  47. rm -rf skip.txt
  48. fi
  49. ;;
  50. Tasks)
  51. # Perform tasks
  52. if [[ "$TASK" == *Test* ]]
  53. then
  54. # Test all
  55. travis_fold start test_all
  56. cd build
  57. ctest test --output-on-failure
  58. travis_fold end test_all
  59. # Check correctness of build types
  60. echo "Checking correctness of build types"
  61. case "$CONFIG" in
  62. DefaultDebug*)
  63. ./bin/storm --version | grep "with flags .* -g" || (echo "Error: Missing flag '-g' for debug build." && return 1)
  64. ;;
  65. DefaultRelease*)
  66. ./bin/storm --version | grep "with flags .* -O3" || (echo "Error: Missing flag '-O3' for release build." && return 1)
  67. ./bin/storm --version | grep "with flags .* -DNDEBUG" || (echo "Error: Missing flag '-DNDEBUG' for release build." && return 1)
  68. ;;
  69. *)
  70. echo "Unrecognized value of CONFIG: $CONFIG"
  71. exit 1
  72. esac
  73. cd ..
  74. fi
  75. if [[ "$TASK" == *Doxygen* ]]
  76. then
  77. # Generate doxygen doc
  78. travis_fold start make_doc
  79. cd build
  80. make -j$N_JOBS doc
  81. # Disable jekyll as otherwise files with starting underscore are not published
  82. echo "" > doc/html/.nojekyll
  83. cd ..
  84. travis_fold end make_doc
  85. fi
  86. ;;
  87. *)
  88. echo "Unrecognized value of run: $1"
  89. exit 1
  90. esac
  91. }
  92. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  93. # ignored).
  94. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  95. case $COMPILER in
  96. gcc-6)
  97. export CC=gcc-6
  98. export CXX=g++-6
  99. ;;
  100. gcc)
  101. export CC=gcc
  102. export CXX=g++
  103. ;;
  104. clang-4)
  105. case "$OS" in
  106. linux)
  107. export CC=clang-4.0
  108. export CXX=clang++-4.0
  109. ;;
  110. osx)
  111. export CC=/usr/local/opt/llvm/bin/clang-4.0
  112. export CXX=/usr/local/opt/llvm/bin/clang++
  113. ;;
  114. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  115. esac
  116. ;;
  117. clang)
  118. export CC=clang
  119. export CXX=clang++
  120. ;;
  121. *)
  122. echo "Unrecognized value of COMPILER: $COMPILER"
  123. exit 1
  124. esac
  125. # Build
  126. echo CXX version: $($CXX --version)
  127. 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)
  128. 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))
  129. case "$CONFIG" in
  130. DefaultDebug*)
  131. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DCMAKE_CXX_FLAGS="$STLARG")
  132. ;;
  133. DefaultRelease*)
  134. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DSTORM_DEVELOPER=OFF -DSTORM_PORTABLE=ON -DCMAKE_CXX_FLAGS="$STLARG")
  135. ;;
  136. *)
  137. echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
  138. ;;
  139. esac
  140. # Restore timestamps of files
  141. travis_fold start mtime
  142. if [[ "$1" == "Build1" ]]
  143. then
  144. # Remove old mtime cache
  145. rm -rf travis/mtime_cache/cache.json
  146. fi
  147. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  148. travis_fold end mtime
  149. # Run and print output to avoid travis timeout
  150. bell &
  151. bellPID=$!
  152. trap 'rc=$?; kill $bellPID; exit $rc' EXIT
  153. run "$1"