Travis: Added Clang AddressSanitizer and UndefinedBehaviorSanitizer

This commit is contained in:
Benoit Blanchon
2017-01-01 21:29:38 +01:00
parent c5388cf8e7
commit b923e8f4df
4 changed files with 17 additions and 1 deletions

View File

@ -70,6 +70,12 @@ matrix:
sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8'] sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8']
packages: ['clang-3.8'] packages: ['clang-3.8']
env: SCRIPT=cmake CMAKE_CXX_COMPILER=clang++-3.8 env: SCRIPT=cmake CMAKE_CXX_COMPILER=clang++-3.8
- compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test','llvm-toolchain-precise-3.8']
packages: ['clang-3.8']
env: SCRIPT=sanitize CMAKE_CXX_COMPILER=clang++-3.8
- compiler: gcc - compiler: gcc
env: SCRIPT=coverage env: SCRIPT=coverage
- os: osx - os: osx

View File

@ -18,4 +18,8 @@ if(${COVERAGE})
set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
endif() endif()
if(${SANITIZE})
set(CMAKE_CXX_FLAGS "-fsanitize=address,undefined")
endif()
add_subdirectory(test) add_subdirectory(test)

7
scripts/travis/sanitize.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh -eux
curl https://cmake.org/files/v3.4/cmake-3.4.0-Linux-x86_64.tar.gz | tar xz -C /tmp --strip 1
/tmp/bin/cmake -DSANITIZE=true .
make
make test

View File

@ -12,7 +12,6 @@ file(GLOB TESTS_FILES *.hpp *.cpp)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options( add_compile_options(
-fno-exceptions -fno-exceptions
-fno-rtti
-pedantic -pedantic
-Wall -Wall
-Wcast-align -Wcast-align