Skip to content

Commit ecba3c0

Browse files
committed
Use sanitizers in travis
1 parent e6b741a commit ecba3c0

File tree

3 files changed

+45
-60
lines changed

3 files changed

+45
-60
lines changed

.travis.yml

Lines changed: 36 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,58 @@
11
language: cpp
22

3+
cache: ccache
4+
35
matrix:
46
include:
5-
67
# Alpine Linux with musl-libc using g++
78
- os: linux
89
sudo: required
910
compiler: gcc
10-
cache: ccache
1111
services:
1212
- docker
1313
before_install:
1414
- docker pull diffblue/cbmc-builder:alpine-0.0.1
15+
- env > .env
16+
install:
17+
- docker run --env-file .env -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/cbmc-builder:alpine-0.0.1 sh -c "./travis_install.sh"
18+
script:
19+
- docker run --env-file .env -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/cbmc-builder:alpine-0.0.1 sh -c "./travis_script.sh"
1520
env:
16-
- PRE_COMMAND="docker run -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/cbmc-builder:alpine-0.0.1"
1721
- COMPILER="ccache g++"
1822

1923
# OS X using g++
2024
- os: osx
2125
sudo: false
2226
compiler: gcc
23-
cache: ccache
2427
before_install:
2528
#we create symlink to non-ccache gcc, to be used in tests
2629
- mkdir bin ; ln -s /usr/bin/gcc bin/gcc
2730
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
2831
- export PATH=/usr/local/opt/ccache/libexec:$PATH
2932
- ccache -M 1G
30-
env: COMPILER=g++
33+
env:
34+
- COMPILER="g++"
35+
- SAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
36+
- LINKFLAGS="${SAN_FLAGS}"
3137

3238
# OS X using clang++
3339
- os: osx
3440
sudo: false
3541
compiler: clang
36-
cache: ccache
3742
before_install:
3843
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
3944
- export PATH=/usr/local/opt/ccache/libexec:$PATH
4045
- ccache -M 1G
4146
env:
4247
- COMPILER="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
43-
- CCACHE_CPP2=yes
48+
- CCACHE_CPP2="yes"
49+
- SAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
50+
- LINKFLAGS="${SAN_FLAGS}"
4451

4552
# Ubuntu Linux with glibc using g++-5
4653
- os: linux
4754
sudo: false
4855
compiler: gcc
49-
cache: ccache
5056
addons:
5157
apt:
5258
sources:
@@ -55,16 +61,18 @@ matrix:
5561
- libwww-perl
5662
- g++-5
5763
- libubsan0
64+
- libasan0
5865
before_install:
5966
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
60-
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
61-
env: COMPILER="g++-5"
67+
env:
68+
- COMPILER="g++-5"
69+
- SAN_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
70+
- LINKFLAGS="-fuse-ld=gold ${SAN_FLAGS}"
6271

6372
# Ubuntu Linux with glibc using g++-5, debug mode
6473
- os: linux
6574
sudo: false
6675
compiler: gcc
67-
cache: ccache
6876
addons:
6977
apt:
7078
sources:
@@ -73,61 +81,39 @@ matrix:
7381
- libwww-perl
7482
- g++-5
7583
- libubsan0
84+
- libasan0
7685
before_install:
7786
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
78-
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
7987
env:
80-
- COMPILER="g++-5"
8188
- EXTRA_CXXFLAGS="-DDEBUG"
82-
script: echo "Not running any tests for a debug build."
83-
84-
# Ubuntu Linux with glibc using clang++-3.7
85-
- os: linux
86-
sudo: false
87-
compiler: clang
88-
cache: ccache
89-
addons:
90-
apt:
91-
sources:
92-
- ubuntu-toolchain-r-test
93-
- llvm-toolchain-precise-3.7
94-
packages:
95-
- libwww-perl
96-
- clang-3.7
97-
- libstdc++-5-dev
98-
- libubsan0
99-
before_install:
100-
- mkdir bin ; ln -s /usr/bin/clang-3.7 bin/gcc
101-
- export CCACHE_CPP2=yes
102-
# env: COMPILER=clang++-3.7 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined,integer -fno-omit-frame-pointer"
103-
env:
104-
- COMPILER="ccache clang++-3.7 -Qunused-arguments -fcolor-diagnostics"
105-
- CCACHE_CPP2=yes
89+
- COMPILER="g++-5"
90+
- SAN_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
91+
- LINKFLAGS="-fuse-ld=gold ${SAN_FLAGS}"
92+
script:
93+
- echo "Not running any tests for a debug build."
10694

107-
# Ubuntu Linux with glibc using clang++-3.7, debug mode
95+
# Ubuntu Linux with glibc using clang++-3.8
10896
- os: linux
10997
sudo: false
11098
compiler: clang
111-
cache: ccache
11299
addons:
113100
apt:
114101
sources:
115102
- ubuntu-toolchain-r-test
116-
- llvm-toolchain-precise-3.7
103+
- llvm-toolchain-precise-3.8
117104
packages:
118105
- libwww-perl
119-
- clang-3.7
106+
- clang-3.8
120107
- libstdc++-5-dev
121108
- libubsan0
109+
- libasan0
122110
before_install:
123-
- mkdir bin ; ln -s /usr/bin/clang-3.7 bin/gcc
124-
- export CCACHE_CPP2=yes
125-
# env: COMPILER=clang++-3.7 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined,integer -fno-omit-frame-pointer"
111+
- mkdir bin ; ln -s /usr/bin/clang-3.8 bin/gcc
126112
env:
127-
- COMPILER="ccache clang++-3.7 -Qunused-arguments -fcolor-diagnostics"
128-
- CCACHE_CPP2=yes
129-
- EXTRA_CXXFLAGS="-DDEBUG"
130-
script: echo "Not running any tests for a debug build."
113+
- COMPILER="ccache clang++-3.8 -Qunused-arguments -fcolor-diagnostics"
114+
- CCACHE_CPP2="yes"
115+
- SAN_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
116+
- LINKFLAGS="-fuse-ld=gold ${SAN_FLAGS}"
131117

132118
- env: NAME="CPP-LINT"
133119
install:
@@ -141,20 +127,10 @@ matrix:
141127
before_cache:
142128

143129
install:
144-
- COMMAND="make -C src minisat2-download" &&
145-
eval ${PRE_COMMAND} ${COMMAND}
146-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
147-
eval ${PRE_COMMAND} ${COMMAND}
148-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"$FLAGS $EXTRA_CXXFLAGS\" -j2 clobber.dir memory-models.dir musketeer.dir" &&
149-
eval ${PRE_COMMAND} ${COMMAND}
130+
- sh travis_install.sh
150131

151132
script:
152-
- if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
153-
COMMAND="env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test" &&
154-
eval ${PRE_COMMAND} ${COMMAND}
155-
- COMMAND="make -C unit CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
156-
eval ${PRE_COMMAND} ${COMMAND}
157-
- COMMAND="make -C unit test" && eval ${PRE_COMMAND} ${COMMAND}
133+
- sh travis_script.sh
158134

159135
before_cache:
160136
- ccache -s

travis_install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
set -e
3+
make -C src minisat2-download
4+
make -C src 'CXX=${COMPILER}' 'CXXFLAGS=${SAN_FLAGS} -O2 -g ${EXTRA_CXXFLAGS}' -j2 all clobber.dir memory-models.dir musketeer.dir

travis_script.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
set -e
3+
make -C unit 'CXX=${COMPILER}' 'CXXFLAGS=${SAN_FLAGS} -O2 -g ${EXTRA_CXXFLAGS}' -j2
4+
make -C unit test
5+
if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ; env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test

0 commit comments

Comments
 (0)