Skip to content

Commit

Permalink
ci: add asan and tsan builds to travis ci.
Browse files Browse the repository at this point in the history
asan = address sanitizer
tsan = thread sanitizer
  • Loading branch information
alanxz committed Jun 7, 2015
1 parent 426a3a7 commit e4a928b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
20 changes: 13 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ language: c
# been resolved.
sudo: required

compiler:
- gcc
- clang

# OSX isn't actually enabled at this point as we missed the boat. Hopefully
# they re-open sign-ups for OSS projects sometime soon.
os:
Expand All @@ -24,9 +20,19 @@ env:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "gDwqo3jHj+HHGzFKnxL/nwZhbVeh2pItw0TbeaHcLtWubUZaf85ViEQRaXPyfnbG7l0OEQq+PjyhKAfvViVq2NP0lGeeu4VM5uMZJhsCLN594BJr39Y4XzOapg0O8mEMhQ0DU2u1Zo4LMgEcRz67aosVQOj6QV30tOzp9fnxn9U="
matrix:
- CONFIG=cmake
- CONFIG=autotools

matrix:
include:
- compiler: gcc
env: CONFIG=autotools
- compiler: gcc
env: CONFIG=cmake
- compiler: clang
env: CONFIG=cmake
- compiler: clang
env: CONFIG=asan
- compiler: clang
env: CONFIG=tsan

# Make sure CMake is installed
install:
Expand Down
22 changes: 19 additions & 3 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,31 @@ build_autotools() {
}

build_cmake() {
mkdir $PWD/_build
cd $PWD/_build
CFLAGS="-fsanitize=undefined"
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../_install
cmake --build . --target install
ctest -V .
}

build_asan() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/../_install \
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -O1"
cmake --build . --target install
ctest -V .
}

build_tsan() {
mkdir $PWD/_build && cd $PWD/_build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/../_install \
-DCMAKE_C_FLAGS="-fsanitize=thread,undefined -O1"
cmake --build . --target install
ctest -V .
}

if [ "$#" -ne 1 ]; then
echo "Usage: $0 {autotools|cmake}"
echo "Usage: $0 {autotools|cmake|asan|tsan}"
exit 1
fi

Expand Down

0 comments on commit e4a928b

Please sign in to comment.