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.

142 lines
3.0 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. ;;
  57. *)
  58. echo "Unrecognized value of run: $1"
  59. exit 1
  60. esac
  61. }
  62. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  63. # ignored).
  64. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  65. case $COMPILER in
  66. gcc-6)
  67. export CC=gcc-6
  68. export CXX=g++-6
  69. ;;
  70. gcc)
  71. export CC=gcc
  72. export CXX=g++
  73. ;;
  74. clang-4)
  75. case "$OS" in
  76. linux)
  77. export CC=clang-4.0
  78. export CXX=clang++-4.0
  79. ;;
  80. osx)
  81. export CC=/usr/local/opt/llvm/bin/clang-4.0
  82. export CXX=/usr/local/opt/llvm/bin/clang++
  83. ;;
  84. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  85. esac
  86. ;;
  87. clang)
  88. export CC=clang
  89. export CXX=clang++
  90. ;;
  91. *)
  92. echo "Unrecognized value of COMPILER: $COMPILER"
  93. exit 1
  94. esac
  95. # Build
  96. echo CXX version: $($CXX --version)
  97. 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)
  98. 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))
  99. case "$CONFIG" in
  100. DefaultDebug*)
  101. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DSTORM_PORTABLE=ON -DCMAKE_CXX_FLAGS="$STLARG")
  102. ;;
  103. DefaultRelease*)
  104. CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DSTORM_DEVELOPER=OFF -DSTORM_PORTABLE=ON -DCMAKE_CXX_FLAGS="$STLARG")
  105. ;;
  106. *)
  107. echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
  108. ;;
  109. esac
  110. # Restore timestamps of files
  111. travis_fold start mtime
  112. if [[ "$1" == "Build1" ]]
  113. then
  114. # Remove old mtime cache
  115. rm -rf travis/mtime_cache/cache.json
  116. fi
  117. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  118. travis_fold end mtime
  119. # Run and print output to avoid travis timeout
  120. bell &
  121. bellPID=$!
  122. trap 'rc=$?; kill $bellPID; exit $rc' EXIT
  123. run "$1"