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.

130 lines
3.1 KiB

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. Build*)
  14. if [[ "$1" == "Build1" ]]
  15. then
  16. # CMake
  17. travis_fold start cmake
  18. mkdir build
  19. cd build
  20. cmake .. "${CMAKE_ARGS[@]}"
  21. echo
  22. if [ -f "CMakeFiles/CMakeError.log" ]
  23. then
  24. echo "Content of CMakeFiles/CMakeError.log:"
  25. cat CMakeFiles/CMakeError.log
  26. fi
  27. echo
  28. cd ..
  29. travis_fold end cmake
  30. fi
  31. # Make
  32. travis_fold start make
  33. cd build
  34. make -j$N_JOBS
  35. travis_fold end make
  36. # Set skip-file
  37. if [[ "$1" != "BuildLast" ]]
  38. then
  39. touch skip.txt
  40. else
  41. rm -rf skip.txt
  42. fi
  43. ;;
  44. TestAll)
  45. # Test all
  46. travis_fold start test_all
  47. cd build
  48. # Hack to avoid memout problem with jit and sylvan
  49. # 1. Run other tests without builder tests
  50. ctest test --output-on-failure -E run-test-builder
  51. # 2. Run builder tests without sylvan tests
  52. ./bin/test-builder --gtest_filter=-"DdJaniModelBuilderTest_Sylvan.*"
  53. # 3. Just run sylvan tests
  54. ./bin/test-builder --gtest_filter="DdJaniModelBuilderTest_Sylvan.*"
  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) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
  101. DefaultRelease) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
  102. *) echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 ;;
  103. esac
  104. # Restore timestamps of files
  105. travis_fold start mtime
  106. if [[ "$1" == "Build1" ]]
  107. then
  108. # Remove old mtime cache
  109. rm -rf travis/mtime_cache/cache.json
  110. fi
  111. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  112. travis_fold end mtime
  113. run "$1"