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.

157 lines
3.6 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. # 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. TestAll)
  51. # Test all
  52. travis_fold start test_all
  53. cd build
  54. ctest test --output-on-failure
  55. travis_fold end test_all
  56. # Check correctness of build types
  57. echo "Checking correctness of build types"
  58. case "$CONFIG" in
  59. DefaultDebug*)
  60. ./bin/storm --version | grep "with flags .* -g" || (echo "Error: Missing flag '-g' for debug build." && return 1)
  61. ;;
  62. DefaultRelease*)
  63. ./bin/storm --version | grep "with flags .* -O3" || (echo "Error: Missing flag '-O3' for release build." && return 1)
  64. ./bin/storm --version | grep "with flags .* -DNDEBUG" || (echo "Error: Missing flag '-DNDEBUG' for release build." && return 1)
  65. ;;
  66. *)
  67. echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
  68. ;;
  69. esac
  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 -DSTORM_PORTABLE=ON -DCMAKE_CXX_FLAGS="$STLARG")
  116. ;;
  117. DefaultRelease*)
  118. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DSTORM_DEVELOPER=OFF -DSTORM_PORTABLE=ON -DCMAKE_CXX_FLAGS="$STLARG")
  119. ;;
  120. *)
  121. echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
  122. ;;
  123. esac
  124. # Restore timestamps of files
  125. travis_fold start mtime
  126. if [[ "$1" == "Build1" ]]
  127. then
  128. # Remove old mtime cache
  129. rm -rf travis/mtime_cache/cache.json
  130. fi
  131. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  132. travis_fold end mtime
  133. # Run and print output to avoid travis timeout
  134. bell &
  135. bellPID=$!
  136. trap 'rc=$?; kill $bellPID; exit $rc' EXIT
  137. run "$1"