language: cpp

compiler:
  - clang
  - gcc

env:
  - BUILD_TYPE=Debug    VALGRIND=true   SANITIZE='' 
  - BUILD_TYPE=Debug    VALGRIND=false  SANITIZE=undefined 
#  - BUILD_TYPE=Debug    VALGRIND=false  SANITIZE=address 
  - BUILD_TYPE=Release  VALGRIND=false  SANITIZE=''

addons:
  apt:
    sources:
      - george-edison55-precise-backports
      - llvm-toolchain-precise-3.8
      - ubuntu-toolchain-r-test
    packages:
      - clang-3.8
      - cmake
      - cmake-data
      - g++-5
      - valgrind

install:
  - if [ "$CXX" = "g++" ]; then export CXX="g++-5"; fi
  - if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.8"; fi

script: 
  - cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DSANITIZE="${SANITIZE}" .
  - make
  - if [ "${VALGRIND}" = "true" ]; then
      travis_wait valgrind --leak-check=full --track-origins=yes testsuite/cpp-sort-testsuite --rng-seed $RANDOM;
    else
      testsuite/cpp-sort-testsuite --rng-seed $RANDOM;
    fi

notifications:
  email: false

language: cpp

compiler:
  - clang
  - gcc

env:
  - BUILD_TYPE=Debug    VALGRIND=true   SANITIZE='' 
  - BUILD_TYPE=Debug    VALGRIND=false  SANITIZE=undefined 
#  - BUILD_TYPE=Debug    VALGRIND=false  SANITIZE=address 
  - BUILD_TYPE=Release  VALGRIND=false  SANITIZE=''

addons:
  apt:
    sources:
      - george-edison55-precise-backports
      - llvm-toolchain-precise-3.8
      - ubuntu-toolchain-r-test
    packages:
      - clang-3.8
      - cmake
      - cmake-data
      - g++-5
      - valgrind

install:
  - if [ "$CXX" = "g++" ]; then export CXX="g++-5"; fi
  - if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.8"; fi

script: 
  - cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DSANITIZE="${SANITIZE}" .
  - make
  - if [ "${VALGRIND}" = "true" ]; then
      travis_wait valgrind --leak-check=full --track-origins=yes --error-exitcode=1 testsuite/cpp-sort-testsuite --rng-seed $RANDOM;
    else
      testsuite/cpp-sort-testsuite --rng-seed $RANDOM;
    fi

notifications:
  email: false

Make Valgrind return 1 if it encountered errors
Make Valgrind return 1 if it encountered errors
