From 85e7ed7eea3e4da4676942ab2c5ecedc04c6dac3 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 7 Aug 2016 23:44:34 -0600 Subject: [PATCH] Add libc++ and MSAN builders to to travis. This patch adds three new build configurations to the travis CI. * Clang 3.8 w/ libc++ * Clang 3.8 w/ libc++, UBSAN, ASAN * Clang 3.8 w/ libc++, MSAN --- .travis-libcxx-setup.sh | 22 ++++++++++++++++++++++ .travis.yml | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 .travis-libcxx-setup.sh diff --git a/.travis-libcxx-setup.sh b/.travis-libcxx-setup.sh new file mode 100644 index 00000000..0f8ecde5 --- /dev/null +++ b/.travis-libcxx-setup.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Install a newer CMake version +curl -sSL https://cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.sh -o install-cmake.sh +chmod +x install-cmake.sh +sudo ./install-cmake.sh --prefix=/usr/local --skip-license + +# Checkout LLVM sources +git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source +git clone --depth=1 https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx +git clone --depth=1 https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi + +# Build and install libc++ (Use unstable ABI for better sanitizer coverage) +mkdir llvm-build && cd llvm-build +cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ + -DLIBCXX_ABI_UNSTABLE=ON \ + -DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \ + ../llvm-source +make cxx -j2 +sudo make install-libcxxabi install-libcxx +cd ../ diff --git a/.travis.yml b/.travis.yml index d4663e45..c73413ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,19 @@ sudo: required dist: trusty language: cpp +env: + global: + - /usr/local/bin:$PATH + # NOTE: The COMPILER variable is unused. It simply makes the display on # travis-ci.org more readable. matrix: include: - compiler: gcc + addons: + apt: + packages: + - lcov env: COMPILER=g++ C_COMPILER=gcc BUILD_TYPE=Coverage - compiler: gcc env: COMPILER=g++ C_COMPILER=gcc BUILD_TYPE=Debug @@ -26,6 +34,7 @@ matrix: env: COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Debug - compiler: clang env: COMPILER=clang++ C_COMPILER=clang BUILD_TYPE=Release + # Clang w/ libc++ - compiler: clang addons: apt: @@ -33,11 +42,34 @@ matrix: clang-3.8 env: - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug - - EXTRA_FLAGS="-fno-omit-frame-pointer -g -O2 -fsanitize=undefined,address -fno-sanitize-recover=all" + - LIBCXX_BUILD=1 + - EXTRA_FLAGS="-stdlib=libc++" + # Clang w/ libc++, ASAN, UBSAN + - compiler: clang + addons: + apt: + packages: + clang-3.8 + env: + - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug + - LIBCXX_BUILD=1 LIBCXX_SANITIZER="Undefined;Address" + - EXTRA_FLAGS="-stdlib=libc++ -fno-omit-frame-pointer -g -O2 -fsanitize=undefined,address -fno-sanitize-recover=all" - UBSAN_OPTIONS=print_stacktrace=1 - + # Clang w/ libc++ and MSAN + - compiler: clang + addons: + apt: + packages: + clang-3.8 + env: + - COMPILER=clang++-3.8 C_COMPILER=clang-3.8 BUILD_TYPE=Debug + - LIBCXX_BUILD=1 LIBCXX_SANITIZER=MemoryWithOrigins + - EXTRA_FLAGS="-stdlib=libc++ -g -O2 -fno-omit-frame-pointer -fsanitize=memory -fsanitize-memory-track-origins" before_script: + - if [ -n "${LIBCXX_BUILD}" ]; then + source .travis-libcxx-setup.sh; + fi - mkdir build && cd build install: @@ -48,7 +80,7 @@ install: fi script: - - cmake .. -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="${EXTRA_FLAGS}" + - cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="${EXTRA_FLAGS}" .. - make - make CTEST_OUTPUT_ON_FAILURE=1 test