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