姚凯文 姜嘉琪
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.

208 lines
6.7 KiB

  1. sudo: required
  2. dist: trusty
  3. language: cpp
  4. matrix:
  5. include:
  6. - compiler: gcc
  7. addons:
  8. apt:
  9. packages:
  10. - lcov
  11. env: COMPILER=g++ C_COMPILER=gcc BUILD_TYPE=Coverage
  12. - compiler: gcc
  13. addons:
  14. apt:
  15. packages:
  16. - g++-multilib
  17. - libc6:i386
  18. env:
  19. - COMPILER=g++
  20. - C_COMPILER=gcc
  21. - BUILD_TYPE=Debug
  22. - BUILD_32_BITS=ON
  23. - EXTRA_FLAGS="-m32"
  24. - compiler: gcc
  25. addons:
  26. apt:
  27. packages:
  28. - g++-multilib
  29. - libc6:i386
  30. env:
  31. - COMPILER=g++
  32. - C_COMPILER=gcc
  33. - BUILD_TYPE=Release
  34. - BUILD_32_BITS=ON
  35. - EXTRA_FLAGS="-m32"
  36. - compiler: gcc
  37. env:
  38. - INSTALL_GCC6_FROM_PPA=1
  39. - COMPILER=g++-6 C_COMPILER=gcc-6 BUILD_TYPE=Debug
  40. - ENABLE_SANITIZER=1
  41. - EXTRA_FLAGS="-fno-omit-frame-pointer -g -O2 -fsanitize=undefined,address -fuse-ld=gold"
  42. # Clang w/ libc++
  43. - compiler: clang
  44. dist: xenial
  45. addons:
  46. apt:
  47. packages:
  48. clang-3.8
  49. env:
  50. - INSTALL_GCC6_FROM_PPA=1
  51. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
  52. - LIBCXX_BUILD=1
  53. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  54. - compiler: clang
  55. dist: xenial
  56. addons:
  57. apt:
  58. packages:
  59. clang-3.8
  60. env:
  61. - INSTALL_GCC6_FROM_PPA=1
  62. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Release
  63. - LIBCXX_BUILD=1
  64. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  65. # Clang w/ 32bit libc++
  66. - compiler: clang
  67. dist: xenial
  68. addons:
  69. apt:
  70. packages:
  71. - clang-3.8
  72. - g++-multilib
  73. - libc6:i386
  74. env:
  75. - INSTALL_GCC6_FROM_PPA=1
  76. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
  77. - LIBCXX_BUILD=1
  78. - BUILD_32_BITS=ON
  79. - EXTRA_FLAGS="-m32"
  80. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  81. # Clang w/ 32bit libc++
  82. - compiler: clang
  83. dist: xenial
  84. addons:
  85. apt:
  86. packages:
  87. - clang-3.8
  88. - g++-multilib
  89. - libc6:i386
  90. env:
  91. - INSTALL_GCC6_FROM_PPA=1
  92. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Release
  93. - LIBCXX_BUILD=1
  94. - BUILD_32_BITS=ON
  95. - EXTRA_FLAGS="-m32"
  96. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  97. # Clang w/ libc++, ASAN, UBSAN
  98. - compiler: clang
  99. dist: xenial
  100. addons:
  101. apt:
  102. packages:
  103. clang-3.8
  104. env:
  105. - INSTALL_GCC6_FROM_PPA=1
  106. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
  107. - LIBCXX_BUILD=1 LIBCXX_SANITIZER="Undefined;Address"
  108. - ENABLE_SANITIZER=1
  109. - EXTRA_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=undefined,address -fno-sanitize-recover=all"
  110. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  111. - UBSAN_OPTIONS=print_stacktrace=1
  112. # Clang w/ libc++ and MSAN
  113. - compiler: clang
  114. dist: xenial
  115. addons:
  116. apt:
  117. packages:
  118. clang-3.8
  119. env:
  120. - INSTALL_GCC6_FROM_PPA=1
  121. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug
  122. - LIBCXX_BUILD=1 LIBCXX_SANITIZER=MemoryWithOrigins
  123. - ENABLE_SANITIZER=1
  124. - EXTRA_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=memory -fsanitize-memory-track-origins"
  125. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  126. # Clang w/ libc++ and MSAN
  127. - compiler: clang
  128. dist: xenial
  129. addons:
  130. apt:
  131. packages:
  132. clang-3.8
  133. env:
  134. - INSTALL_GCC6_FROM_PPA=1
  135. - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=RelWithDebInfo
  136. - LIBCXX_BUILD=1 LIBCXX_SANITIZER=Thread
  137. - ENABLE_SANITIZER=1
  138. - EXTRA_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all"
  139. - EXTRA_CXX_FLAGS="-stdlib=libc++"
  140. - os: osx
  141. osx_image: xcode8.3
  142. compiler: clang
  143. env:
  144. - COMPILER=clang++
  145. - BUILD_TYPE=Release
  146. - BUILD_32_BITS=ON
  147. - EXTRA_FLAGS="-m32"
  148. before_script:
  149. - if [ -n "${LIBCXX_BUILD}" ]; then
  150. source .libcxx-setup.sh;
  151. fi
  152. - if [ -n "${ENABLE_SANITIZER}" ]; then
  153. export EXTRA_OPTIONS="-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF";
  154. else
  155. export EXTRA_OPTIONS="";
  156. fi
  157. - mkdir -p build && cd build
  158. before_install:
  159. - if [ -z "$BUILD_32_BITS" ]; then
  160. export BUILD_32_BITS=OFF && echo disabling 32 bit build;
  161. fi
  162. - if [ -n "${INSTALL_GCC6_FROM_PPA}" ]; then
  163. sudo add-apt-repository -y "ppa:ubuntu-toolchain-r/test";
  164. sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60";
  165. fi
  166. install:
  167. - if [ -n "${INSTALL_GCC6_FROM_PPA}" ]; then
  168. travis_wait sudo -E apt-get -yq --no-install-suggests --no-install-recommends install g++-6;
  169. fi
  170. - if [ "${TRAVIS_OS_NAME}" == "linux" -a "${BUILD_32_BITS}" == "OFF" ]; then
  171. travis_wait sudo -E apt-get -y --no-install-suggests --no-install-recommends install llvm-3.9-tools;
  172. sudo cp /usr/lib/llvm-3.9/bin/FileCheck /usr/local/bin/;
  173. fi
  174. - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
  175. PATH=~/.local/bin:${PATH};
  176. pip install --user --upgrade pip;
  177. travis_wait pip install --user cpp-coveralls;
  178. fi
  179. - if [ "${C_COMPILER}" == "gcc-7" -a "${TRAVIS_OS_NAME}" == "osx" ]; then
  180. rm -f /usr/local/include/c++;
  181. brew update;
  182. travis_wait brew install gcc@7;
  183. fi
  184. - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
  185. sudo apt-get update -qq;
  186. sudo apt-get install -qq unzip cmake3;
  187. wget https://github.com/bazelbuild/bazel/releases/download/3.2.0/bazel-3.2.0-installer-linux-x86_64.sh --output-document bazel-installer.sh;
  188. travis_wait sudo bash bazel-installer.sh;
  189. fi
  190. - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
  191. curl -L -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/3.2.0/bazel-3.2.0-installer-darwin-x86_64.sh;
  192. travis_wait sudo bash bazel-installer.sh;
  193. fi
  194. script:
  195. - cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_C_FLAGS="${EXTRA_FLAGS}" -DCMAKE_CXX_FLAGS="${EXTRA_FLAGS} ${EXTRA_CXX_FLAGS}" -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DBENCHMARK_BUILD_32_BITS=${BUILD_32_BITS} ${EXTRA_OPTIONS} ..
  196. - make
  197. - ctest -C ${BUILD_TYPE} --output-on-failure
  198. - bazel test -c dbg --define google_benchmark.have_regex=posix --announce_rc --verbose_failures --test_output=errors --keep_going //test/...
  199. after_success:
  200. - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
  201. coveralls --include src --include include --gcov-options '\-lp' --root .. --build-root .;
  202. fi